summaryrefslogtreecommitdiff
path: root/lib/sbin/cpp.pl
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-12-13 02:46:25 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-12-13 02:46:25 +0000
commit5f9d3d0185a837c8cfcf79d0efe00001be556d0e (patch)
tree5e7f619be70f9e2781e0d5b0ea6187028f9191b1 /lib/sbin/cpp.pl
parent0ce7e4f9865633a3e7217653086467ed35f67d99 (diff)
Correct ProcessIf: When evaluating a macro in an #if statement,
convert the macro value to either 0 or 1 before returning it. Otherwise things fail badly if the macro is defined but empty: The returned value is then not an integer, and cpp.pl would keep both the #if and the #else branch of an if statement. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4205 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/cpp.pl')
-rwxr-xr-xlib/sbin/cpp.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sbin/cpp.pl b/lib/sbin/cpp.pl
index 375abad0..0016fdff 100755
--- a/lib/sbin/cpp.pl
+++ b/lib/sbin/cpp.pl
@@ -680,7 +680,7 @@ sub ProcessIf
else
{
# print STDERR "#if <constant> called on non-digit and non-define $val at $filename\::$linenumber !\n";
- $retval = defined($defines{$val}) ? $defines{$val} : 0;
+ $retval = defined($defines{$val}) ? ($defines{$val} ? 1 : 0) : 0;
}
}
else