System header #define'ing __attribute__

Jeff Epler jepler@unpythonic.net
Wed Apr 2 00:46:00 GMT 2003


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?

Jeff Epler
jepler@unpythonic.net
(wishing his employer would also declare bsdi2.1 obsolete)



More information about the Gcc mailing list