[cfe-dev] wint_t definition

Andrew Price andy at andrewprice.me.uk
Tue Jan 5 18:39:11 CST 2010


Hi Andrew,

On Tue, Jan 05, 2010 at 01:18:11PM +1030, Andrew Jeffery wrote:
> Hi all,
> 
> In playing around with Clang I came across the attached C snippet
> which compiles with GCC but fails with Clang. This appears to be
> because GCC defines the wint_t type in stddef.h where Clang doesn't
> (changing the wctype.h include to wchar.h does away with the whole
> issue: wchar_t is defined and the wint_t issue becomes
> non-existent).

I encountered the same problem recently and looked into why it was
happening. I concluded that this glibc change probably had something to
do with it:

http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5703f4727380ca751da51a94664689b5e97dc89f

(specifically the last hunk of the diff).

> Should Clang be defining wint_t in stddef.h or is GCC at fault here
> (i.e. shouldn't be defining it there)? This bug shows up when
> configuring pkg-config's bundled glib[1]; at a high level, trying to
> build the bundled glib fails because some unrecognised parameters
> are passed to Clang. The parameters being passed to Clang were
> different to the ones being passed to GCC, so I had a poke around in
> the config.log to check for something going awry and found this
> issue*. Should I file a bug?

Judging by the wording of the standard (wchar.h should be included in
wctype.h to provide wint_t, as I understand it) it looks like this is a
glibc quirk. I felt it was easier to bodge my code to include wchar.h
before wctype.h than to get this fixed but good luck to you if you
attempt to do so.

Andrew


More information about the cfe-dev mailing list