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]
Other format: [Raw text]

gcc -std=c89 -xc++ undefines __cplusplus


Specifying -std=c89 with -xc++ undefines __cplusplus, but
leaves __GNUG__ defined.

In contrast, when -ansi is specified with -xc++, __cplusplus
_is_ defined

Is this intended behaviour?  It tweaks a parse error for me
when using __attribute__((unused)), eg:

#ifdef __GNUC__
# ifdef __cplusplus /* __GNUG__ */
#  define _ARGS_UNUSED(x)
# else
#  define _ARGS_UNUSED(x) x __attribute__((unused))
# endif 
#else /* !__GNUC__ */
# define _ARGS_UNUSED(x) x
#endif

static
__inline__
int
my_fwide(FILE* _ARGS_UNUSED(stream), int _ARGS_UNUSED(mode))
  {return -1;} /* limited to byte orientation */ 

This compiles okay with -xc++ -ansi, but not -xc++ -std=c99
The obvious workaround is to use __GNUG__ as the guard
(or don't set C std in C++)

Danny

http://digital.yahoo.com.au - 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]