This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
gcc -std=c89 -xc++ undefines __cplusplus
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: GCC <gcc at gcc dot gnu dot org>
- Date: Sat, 24 Aug 2002 14:00:32 +1000 (EST)
- Subject: 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!