> > The problem is not limited to flags like -m32 and -m64. Flags like > > -fsanitize=address can also affect preprocessor behavior. A complete > > list of such flags would be daunting to maintain. > > I didn't know about the -fsanitize=address effect, but it is easy to > determine: > > $ diff <(:|gcc -E -dM -|LC_ALL=C sort) <(:|gcc -fsanitize=address -E -dM > -|LC_ALL=C sort) > 155a156 > > #define __SANITIZE_ADDRESS__ 1
It is not limited to -fsanitize=address. -O does it as well: $ diff <(:|gcc -E -dM -|LC_ALL=C sort) <(:|gcc -O -E -dM -|LC_ALL=C sort) 0a1 > #define _FORTIFY_SOURCE 2 148c149 < #define __NO_INLINE__ 1 --- > #define __OPTIMIZE__ 1 But people do put options like -O and -fsanitize=address into $CFLAGS and not into $CPPFLAGS. So, if our check considers __OPTIMIZE__ and __SANITIZE_ADDRESS__ as relevant macros, it will fail in even the most basic setting, namely CC=gcc CFLAGS="-O2 -g" Probably we need to draw a line between - macros that often change the result of $CPP output (e.g. -D and -I options, but also -m32/-m64) - macros that rarely change the result of $CPP output because they are just witness macros of optimization options (e.g. __OPTIMIZE__). Bruno