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]

Re: __STDC_VERSION__ is undefined in gcc-3.x?


On Sun, Jul 29, 2001 at 08:56:03PM +0100, Neil Booth wrote:
> Gordon Sadler wrote:-
> 
> > 2.95.x no matter which -std=xxx I pass it always returns 199409. Under 3.x,
> > unless I specify one of the -std=c9x options or gnu9x __STDC_VERSION__ is 
> > undefined. So it appears -ansi (aka -std=c89) should not define
> > __STDC_VERSION__? In that case, 2.95.x is wrong?
> 
> I believe all of this to be true.  But 2.95 does not use cpplib by
> default, and therefore cppinit.c, I believe.  You might need to look
> at cccp.c, which could do a different thing (I don't have a copy of it
> handy).
> 
Right cccp.c from 2.95-branch has similar language to cppinit.c:
  if (!traditional) {
    install ((U_CHAR *) "__STDC__", -1, T_CONST, "1", -1);
    install ((U_CHAR *) "__STDC_VERSION__", -1, T_CONST, "199409L", -1);
  }
> > and perhaps the default for
> > at least the 3.x-branch should be changed to 'iso9899:199409'?
> 
> I think the current behaviour is what we want.  Since C89 compilers do
> not define the macro, it is supposed to be a way for programs to check
> whether they are being compiled by a C89 compiler or not.
> 
Hmm, in that case all code that previously checked this and was compiled
with 2.95.x is 'misinformed'? As the default for 2.95.x is gnu89 and this 
macro is defined at all times. (As an aside, gcc.texi claims when better 
support for the c99 standard is included with gcc it will become the 
default, hence my reason to change the default for now to iso9899:199409. 
Previous behavior is still possible with -ansi).

-- 
Gordon Sadler


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