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>
This commit is contained in:
Oliver Smith-Denny 2026-04-03 13:37:01 -07:00 committed by mergify[bot]
parent 8e873a83b2
commit be4fc071eb

View file

@ -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)