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

Chris Lattner clattner at apple.com
Sat Jul 10 10:20:39 PDT 2010


On Jul 10, 2010, at 1:34 AM, Jay Foad wrote:

>> 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?

Yes, #if !defined(x) or #ifndef

> 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

What requires it to have this behavior?  If there is no other way to do this, then I'm ok with the patch.

-Chris

> 
> 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