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:
Gleb Chesnokov
2025-10-01 14:05:46 +03:00
parent 9543060a2c
commit 59bdb2463c
2 changed files with 2 additions and 2 deletions

View File

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

View File

@@ -2152,7 +2152,7 @@ static inline int fc_block_rport(struct fc_rport *rport)
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) && \
(!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \
RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 4) && \
(RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 4)) && \
!(defined(UEK_KABI_RENAME) && defined(FC_PORTSPEED_256GBIT))
#define ELS_RDP 0x18
#endif