From 59bdb2463c1c7f4ea4e5363db043784139b294f5 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Wed, 1 Oct 2025 14:05:46 +0300 Subject: [PATCH] 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). --- scripts/specialize-patch | 2 +- scst/include/backport.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 5c002442f..06e49bafc 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -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 diff --git a/scst/include/backport.h b/scst/include/backport.h index ef0208006..0d58c05b1 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -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