mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-21 20:51:27 +00:00
Patch from Bart Van Assche <bart.vanassche@gmail.com>:
The current version of generate-kernel-patch does not remove preprocessor statements that should have been removed because intended for another kernel version (surrounded by #if LINUX_VERSION_CODE ... KERNEL_VERSION(...) / #endif). The patch below fixes this. I have verified the patch below by comparing the patch generated by the old and the new versions of the generate-kernel-patch script: $ diff p1 p2 7190d7189 < +#if defined(EXTRACHECKS) 7196c7195,7196 < +#endif --- > > + > > + 13056d13055 < +#ifdef STRICT_SERIALIZING 13058d13056 < +#elif !defined(SCSI_EXEC_REQ_FIFO_DEFINED) 13060d13057 < +#else 13062c13059,13062 < +#endif --- > > + > > + > > + > > + Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@392 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -119,12 +119,17 @@ function handle_if()
|
||||
evaluated = "+#if undecided"
|
||||
}
|
||||
#printf "%s -> %s\n", $0, evaluated
|
||||
if (evaluated ~ "^+#elif")
|
||||
if (evaluated ~ "^+#if")
|
||||
{
|
||||
if_stmnt[if_nesting_level] = evaluated
|
||||
}
|
||||
else
|
||||
{
|
||||
sub("^+#elif ", "+#if ! " + decision[if_nesting_level] + " && ", evaluated)
|
||||
evaluated = evaluate(evaluated)
|
||||
}
|
||||
decision[if_nesting_level] = evaluated
|
||||
matching_if = if_stmnt[if_nesting_level]
|
||||
}
|
||||
|
||||
|
||||
@@ -145,10 +150,12 @@ function process_preprocessor_statement() {
|
||||
}
|
||||
else if (evaluated ~ "^+#else")
|
||||
{
|
||||
matching_if = if_stmnt[if_nesting_level]
|
||||
decision[if_nesting_level] = invert(decision[if_nesting_level])
|
||||
}
|
||||
else if (evaluated ~ "^+#endif")
|
||||
{
|
||||
matching_if = if_stmnt[if_nesting_level]
|
||||
if_nesting_level--
|
||||
}
|
||||
else
|
||||
@@ -163,20 +170,13 @@ function process_preprocessor_statement() {
|
||||
output = output && decision[i] != "+#if 0"
|
||||
}
|
||||
}
|
||||
if (evaluated ~ "^+#if [01]$" \
|
||||
|| condition \
|
||||
&& evaluated !~ "^+#if" \
|
||||
&& last_if_nesting_level >= 0 \
|
||||
&& decision[last_if_nesting_level] ~ "+#if [01]$" \
|
||||
|| ! condition \
|
||||
&& last_if_nesting_level >= 0 \
|
||||
&& decision[last_if_nesting_level] == "+#if 0")
|
||||
if (output && (! condition || condition && matching_if !~ "^+#if [01]"))
|
||||
{
|
||||
print "+"
|
||||
print $0
|
||||
}
|
||||
else
|
||||
{
|
||||
print $0
|
||||
print "+"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user