This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fixinc required for new FreeBSD 4.x bootstrap failures


Gerald Pfeifer wrote:
> 
> FreeBSD 4.x has constructs of the following kind in system headers like
> /usr/include/stdlib.h:
> 
>    int      abs __P((int)) __pure2;
> 
> where /usr/include/sys/cdefs.h has the following definitions
> 
> #if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
> #define __dead2
> #define __pure2
> #define __unused
> #endif
> #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
> #define __dead2         __attribute__((__noreturn__))
> #define __pure2         __attribute__((__const__))
> #define __unused
> #endif
> #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
> #define __dead2         __attribute__((__noreturn__))
> #define __pure2         __attribute__((__const__))
> #define __unused        __attribute__((__unused__))
> #endif
> 
> I'm sure everyone will spot the obvious, most silly mistake: in the
> case of __GNUC__ being >= nothing happens, and __pure2 will just stay
> in the output after preprocessing, leading to compile failures.
> 
> Can we work around this by some well-chosen amount of fixinc-ing?

In the TOT for stdlib.h, I think I'd clarify the alternating nature
of these by using "#elif" instead of "#endif\n#if", that way
the last clause becomes "#else" instead of another obscuring test.
Anyway, for fixinc, I think the simpliest fix is to constrain to
FreeBSD, grep for the stdlib.h header file version and then do
a "c-fix" that replaces that particular "== 3" with ">= 3".

Cheers - Bruce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]