diff options
| author | Dongyan Qian <qiandongyan@loongson.cn> | 2026-09-16 09:45:38 +0300 |
|---|---|---|
| committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2026-10-08 06:58:55 +0300 |
| commit | c51403090f63efa4e463cd17095dd9f012a00c4b (patch) | |
| tree | 81d5f4d5ea04f1e735d8ba3c7ac6928772f4ebaa /BaseTools/Source/Python/CommonDataClass | |
| parent | 78fdd2db8932d619eced4c69ef06a13c4f6469b2 (diff) | |
| download | edk2-c51403090f63efa4e463cd17095dd9f012a00c4b.tar.xz | |
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 <shenfei@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Diffstat (limited to 'BaseTools/Source/Python/CommonDataClass')
0 files changed, 0 insertions, 0 deletions
