From bc070bc1bcdf7114ddb695028d19e14cf9a7872e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 28 Jul 2015 05:38:07 +0000 Subject: [PATCH] scripts/specialize-patch: Handle #if 0 / #elif statement combinations correctly git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6431 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/specialize-patch | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/specialize-patch b/scripts/specialize-patch index aee6563e8..55cd4f51f 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -346,6 +346,15 @@ function process_preprocessor_statement(evaluated, condition) { } else if (evaluated ~ "^+#elif") { + matching_if = if_stmnt[if_nesting_level] + if (debug) + printf "/* debug specialize-patch: (g0a) %s: matching_if = %s */\n", \ + evaluated, matching_if + if (if_discarded[if_nesting_level]) { + sub("^+#elif", "+#if", input_line[0]) + if (debug) + printf "/* debug specialize-patch: (g0b) -> %s */\n", evaluated + } evaluated = handle_if(evaluated) } else if (evaluated ~ "^+#else") @@ -436,6 +445,9 @@ function process_preprocessor_statement(evaluated, condition) { if (lines >= 1 && line[lines - 1] == "+") delete_next_blank_line = 1 } + + if (evaluated ~ "^+#if") + if_discarded[if_nesting_level] = discard } function reset_hunk_state_variables() {