Bison vs. const vs. AIX
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Fri Nov 17 08:18:00 GMT 2000
> From: Mark Mitchell <mark@codesourcery.com>
>
> On AIX, using `cc' to bootstrap doesn't work. The reason is that in
> that `cc' supports `const', but doesn't define __STDC__. So, all of
> our headers use `const', but in c-parse.c, Bison does:
>
> #ifndef __cplusplus
> #ifndef __STDC__
> #define const
> #endif
> #endif
>
> Then, we get const-mismatches in the body of c-parse.c.
>
> I don't see a generic way to fix this problem. I was going to
> duplicate the Bison logic in system.h, but that fails if the compiler
> rejects multiple definitions of the same macro, which some compilers
> do. (Note that Bison is not polite enough to have wrapped its
> definition in `#ifndef const'.)
>
> Does anyone see a way to fix this problem? Otherwise, we need to
> force the bootstrap compiler to be `xlc', rather than `cc', on AIX.
The true switch used in the rest of gcc is ANSI_PROTOTYPES defined in
ansidecl.h. That macro is set when __STDC__, _AIX (causing this
problem), and other special cases. What we need to do to get bison on
board is to tell it we are __STDC__ when ANSI_PROTOTYPES is defined.
How about putting the following code in the file?
/* Warning! Gross hack alert. <Explanation...> */
#if defined(ANSI_PROTOTYPES) && !defined(__STDC__)
#define __STDC__
#endif
You should probably try putting it in just after c_parse_init() so it
gets done just above the bison inserted const define.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions
More information about the Gcc-bugs
mailing list