This is the mail archive of the 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: gcc -std=c89 -xc++ undefines __cplusplus

 --- Neil Booth <> wrote: > Danny Smith wrote:-
> > Specifying -std=c89 with -xc++ undefines __cplusplus, but
> > leaves __GNUG__ defined.
> I suggest you don't do this; -std=c89 is not a C++ switch
> and 3.3 will tell you that (I originally had it an error,
> but was asked to make it a warning.  Trying it out now
> gives
> $ gcc -std=c89 -x c++ /tmp/foo.c
> cc1plus: warning: "-std=c89" is valid for C/ObjC but not for C++
> cc1plus: error: unrecognized option `-std=c89'
> so it's both 8-)  I need to fix this.)

Thanks.  The warning (I would prefer a hard error) is good for the
__attribute__((unused)) example I gave. I am one of the mingw32 maintainers 
and am trying to get the C headers right to produce informative warnings or
errors rather than bug reports about parse errors.

Now I need to reexamine how c99 math functions are exposed in  mingw's math.h. 
Currently c99 math is guarded like this:

#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \
	|| !defined  __STRICT_ANSI__  || defined __GLIBCPP__

The __GLIBCPP__ is there to allow c99 cmath dependencies  in code that is
compiled with  gcc -ansi foo.cpp. 


> Neil. - Yahoo! Digital How To
- Get the best out of your PC!

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