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
This commit is contained in:
Bart Van Assche
2015-07-28 05:38:07 +00:00
parent 2609ee1b86
commit bc070bc1bc

View File

@@ -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() {