[cfe-commits] [PATCH] 7571: stddef.h and wint_t

Jay Foad jay.foad at gmail.com
Sat Jul 10 01:34:10 PDT 2010


> The fix will remove the header guard for the file, which defeats an important preprocessor optimization to avoid reincludes.  Is there another approach that would preserve the canonical header guard?

Does the optimisation rely on the guard being of the form "#ifndef
FOO", i.e. only checking a single symbol for definedness? If so, I
can't see a way to fix the bug and preserve the optimisation. The
problem is that stddef.h is being included for two different purposes:

1. to define wint_t
2. to declare all the stuff that the standard says stddef.h should declare

and each of these uses is more-or-less independent of whether the file
has already been included for the *other* purpose.

GCC's stddef.h has a rather complicated guard:

http://gcc.gnu.org/viewcvs/trunk/gcc/ginclude/stddef.h?view=markup

Thanks,
Jay.




More information about the cfe-commits mailing list