tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] __GNUC__ and GLIBC header mess


From: Marc Andre Tanner
Subject: [Tinycc-devel] __GNUC__ and GLIBC header mess
Date: Fri, 28 Sep 2007 18:15:58 +0200
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

There is a problem with the glibc headers. If you run

 cat > glibc-bug.c << EOF
 #include <glob.h>
 EOF

 tcc -c -D_FILE_OFFSET_BITS=64 glibc-bug.c

you get an error because of incompatible types for redefinition of 'glob64'.

glob.h includes sys/cdefs.h which inlcudes features.h and there __USE_FILE_OFFSET64 is set to 1.

features.h:

 #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
 # define __USE_FILE_OFFSET64    1
 #endif

The error happens within glob.h. Since __GNUC__ is not defined glob is defined as glob64.

 #if __USE_FILE_OFFSET64 && __GNUC__ < 2
 # define glob glob64
 # define globfree globfree64
 #endif

Then later in glob.h we find

 #if !defined __USE_FILE_OFFSET64 || __GNUC__ < 2
   extern int glob (... with glob_t ...)
 #endif

again the check is true because __GNUC__ is not defined.
but because of the earlier #define glob is replaced by glob64.

Further down in glob.h there is

 #ifdef __USE_LARGEFILE64
   extern int glob64 (... with glob64_t ...)
 #endif

so in the end we have 2 different definitions of glob64 which tcc rightfully complains.

Are the glibc headers actually supposed to work with other compilers than gcc?

The proper fix would probably be to check every time whether __GNUC__ is defined at all.

Any suggestion is welcome.

Marc

--
 Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]