summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python
diff options
context:
space:
mode:
authorOliver Smith-Denny <osde@microsoft.com>2026-04-03 23:37:01 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-04-21 03:18:43 +0300
commitbe4fc071eb01c7420707e887c92a3adf3e07ea72 (patch)
tree7bd7d7d460b88344ee7598e1cb0ed8ea37a620be /BaseTools/Source/Python
parent8e873a83b27eb2358c6a841ae220738255f53d0b (diff)
downloadedk2-be4fc071eb01c7420707e887c92a3adf3e07ea72.tar.xz
BaseTools: Reject Inline Comments in tools_def
There is a bug in BaseTools currently when an inline comment is used in tools_def. The comment is not stripped out and wreaks havoc down the line, causing BaseTools to get confused elsewhere and drop build options it should be applying. This fixes that behavior by following the build spec which states: Comments are only allows on separate lines and may not be appended appear on actual entry lines. Inline comments are now not allowed and the build will fail and specify why and where. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Diffstat (limited to 'BaseTools/Source/Python')
-rw-r--r--BaseTools/Source/Python/Common/ToolDefClassObject.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/Common/ToolDefClassObject.py b/BaseTools/Source/Python/Common/ToolDefClassObject.py
index afc20a3c17..e8dd798f02 100644
--- a/BaseTools/Source/Python/Common/ToolDefClassObject.py
+++ b/BaseTools/Source/Python/Common/ToolDefClassObject.py
@@ -108,6 +108,10 @@ class ToolDefClassObject(object):
if Line == "" or Line[0] == '#':
continue
+ if '#' in Line:
+ EdkLogger.error("tools_def.txt parser", FILE_PARSE_FAILURE,
+ "tools_def.txt: Inline comments are not allowed. Line: " + str(Index + 1))
+
if Line.startswith("!include"):
IncFile = Line[8:].strip()
Done, IncFile = self.ExpandMacros(IncFile)