From: <vl...@us...> - 2008-05-23 15:19:53
|
Revision: 392 http://scst.svn.sourceforge.net/scst/?rev=392&view=rev Author: vlnb Date: 2008-05-23 08:19:52 -0700 (Fri, 23 May 2008) Log Message: ----------- Patch from Bart Van Assche <bar...@gm...>: 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 <bar...@gm...> Modified Paths: -------------- trunk/scripts/specialize-patch Modified: trunk/scripts/specialize-patch =================================================================== --- trunk/scripts/specialize-patch 2008-05-23 15:12:34 UTC (rev 391) +++ trunk/scripts/specialize-patch 2008-05-23 15:19:52 UTC (rev 392) @@ -119,12 +119,17 @@ 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 @@ } 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 @@ 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 "+" } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |