This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: fixinc required for new FreeBSD 4.x bootstrap failures
- From: Bruce Korb <bkorb at veritas dot com>
- To: Gerald Pfeifer <gerald at pfeifer dot com>
- Cc: gcc at gcc dot gnu dot org, Bruce Korb <bkorb at gnu dot org>, Loren James Rittle <rittle at labs dot mot dot com>, David O'Brien <obrien at freebsd dot org>, Alexander Kabaev <kan at freebsd dot org>
- Date: Mon, 13 Sep 2004 08:56:34 -0700
- Subject: Re: fixinc required for new FreeBSD 4.x bootstrap failures
- Organization: Home
- References: <Pine.BSF.4.61.0409131219190.90584@acrux.dbai.tuwien.ac.at>
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