Branch: refs/heads/master
Home: https://github.com/tianocore/edk2
Commit: c51403090f63efa4e463cd17095dd9f012a00c4b
https://github.com/tianocore/edk2/commit/c51403090f63efa4e463cd17095dd9f012a00c4b
Author: Dongyan Qian <[email protected]>
Date: 2026-10-08 (Thu, 08 Oct 2026)
Changed paths:
M BaseTools/Source/Python/Workspace/MetaFileParser.py
Log Message:
-----------
BaseTools: Reject trailing content after !else and !endif
The DSC parser accepts "!else if <expression>" as an unconditional
!else branch without evaluating the trailing condition. This can select
an unintended build branch instead of reporting the syntax error.
For example, the following incorrect syntax is currently accepted:
!if $(MODE) == 1
# Branch A
!else if $(MODE) == 2
# Branch B
!endif
When MODE is 3, the parser treats the second directive as a plain !else
and selects branch B. Replacing it with "!elseif $(MODE) == 2" would
correctly select neither branch.
Reject trailing content after !else and !endif. When the first word
following !else is "if", suggest "!elseif <expression>" instead.
Trailing comments remain valid because they are removed before
directive parsing.
Cc: Fei Shen <[email protected]>
Signed-off-by: Dongyan Qian <[email protected]>
To unsubscribe from these emails, change your notification settings at
https://github.com/tianocore/edk2/settings/notifications
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits