mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
scripts/specialize-patch: treat "#if 0" and "#if 0 && ..." as constant-false
Partial evaluation can yield guards like "+#if 0 && ...". These are false but bypassed the filter that only matched exact "+#if 0"/"+#elif 0". Tighten the regex to match the original spacing and catch both forms. This is the minimal change addressing the bug observed in logs such as: (c) +#if 0 && !(1 && defined(FC_PORTSPEED_256GBIT)) ... (g2) ... output = 1 <-- wrong After this change such guards are dropped correctly (output = 0).
This commit is contained in:
@@ -553,7 +553,7 @@ function process_preprocessor_statement(evaluated, condition) {
|
||||
if (debug)
|
||||
printf "/* debug specialize-patch: (g1b) %s: decision[%d] = %s */\n", \
|
||||
evaluated, i, decision[i]
|
||||
output = output && decision[i] != "+#if 0" && decision[i] != "+#elif 0"
|
||||
output = output && decision[i] !~ "^+#(if|elif) 0($| &&)"
|
||||
}
|
||||
if (output)
|
||||
any_section_output[if_nesting_level] = 1
|
||||
|
||||
Reference in New Issue
Block a user