System header #define'ing __attribute__

Geoff Keating geoffk@geoffk.org
Wed Apr 2 08:38:00 GMT 2003


Jeff Epler <jepler@unpythonic.net> writes:

> I'm trying to compile gcc3.2 on bsdi2.1.  Yes, I know it's an obsolete
> platform.
> 
> I run into problems because in <sys/cdefs.h> there's the following:
> /*
>  * GCC1 and some versions of GCC2 declare dead (non-returning) and
>  * pure (no side effects) functions using "volatile" and "const";
>  * unfortunately, these then cause warnings under "-ansi -pedantic".
>  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
>  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
>  * in the distribution version of 2.5.5).
>  */
> #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
> #define __attribute__(x)        /* delete __attribute__ if non-gcc or gcc1 */
> 
> now, of course, this worked great for any gcc 2.x version, but not for
> any gcc 3.x version.  As it is, stuff in libgcc is built with
> wrong-width integers and everything goes to hell.
> 
> What's the proper way to make gcc aware of this problem and work around
> it?

In general, fixincludes, but if you just want to fix it in libgcc, I
would try #undef __attribute__.
-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc mailing list