|<< Back to previous view|
[PCC-403] #if conditional leaks some information Created: 25/Aug/12 Updated: 15/Sep/12
The #if conditional is leaking some information when the test is expanded from a macro, which carries over to affect the next conditional
the following code demonstrates the issue
#define VAL 5
#define FOO defined(VAL)
#define BAR defined(FOOBAR)
when compiled with pcc -E, produces (without blank lines)
which is clearly wrong.. but if the code is changed to
then it works ok..
|Comment by Anders Magnusson [ 30/Aug/12 05:59 PM ]|
Hm, 6.10.1 clause 3 says:
" If the token defined is generated as a result of this replacement process or use of the defined unary operator does not match one of the two specified forms prior to macro replacement, the behavior is undefined. "
So, using defined here enters the "undefined" area...?
|Comment by Iain Hibbert [ 01/Sep/12 10:36 AM ]|
|I have emailed the author of the upstream code that was using this construct (IPF, in the NetBSD sources), will work on it separately..|
|Comment by Iain Hibbert [ 15/Sep/12 07:13 PM ]|
|I have fixed this in the upstream code so it is no longer an issue|