[cfe-commits] [PATCH] 7571: stddef.h and wint_t
clattner at apple.com
Fri Jul 9 14:12:09 PDT 2010
On Jul 9, 2010, at 1:10 AM, Jay Foad wrote:
> On Ubuntu I get:
> $ cat c.c
> #include <stddef.h>
> #include <wctype.h>
> $ clang -c c.c
> In file included from c.c:2:
> /usr/include/wctype.h:112:22: error: unknown type name 'wint_t'
> extern int iswalnum (wint_t __wc) __THROW;
> The problem is that Clang's stddef.h only defines win_t if
> __need_wint_t is defined the *first* time stddef.h is included.
> Glibc's wctype.h does this:
> /* Get wint_t from <stddef.h>. */
> # define __need_wint_t
> # include <stddef.h>
> but that doesn't work if stddef.h has been included previously.
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?
More information about the cfe-commits