This is the mail archive of the
mailing list for the GCC project.
Re: gcc -std=c89 -xc++ undefines __cplusplus
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: Neil Booth <neil at daikokuya dot co dot uk>
- Cc: GCC <gcc at gcc dot gnu dot org>
- Date: Sat, 24 Aug 2002 21:15:00 +1000 (EST)
- Subject: Re: gcc -std=c89 -xc++ undefines __cplusplus
--- Neil Booth <email@example.com> 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
> $ 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.
http://digital.yahoo.com.au - Yahoo! Digital How To
- Get the best out of your PC!