This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
G++ defines _GNU_SOURCE, implies C99
- From: Michael Eager <eager at mvista dot com>
- To: gcc <gcc at gcc dot gnu dot org>, GCC Bugs <gcc-bugs at gcc dot gnu dot org>
- Date: Fri, 13 Sep 2002 15:37:59 -0700
- Subject: G++ defines _GNU_SOURCE, implies C99
- Organization: MontaVista Software, Inc.
I've been reading the gcc archive, gnats bug reports (2082),
and the FAQ about _GNU_SOURCE always being defined in g++.
In features.h, if _GNU_SOURCE is defined, then _USE_ISOC99 is
defined, which means that headers will contain extensions from
C99.
The FAQ only mentions this being a problem on Solaris, but
it is also a problem on Linux -- for example, _GNU_SOURCE is defined
in gcc/config/rs6000/linux.h, with the comment that this is a hack
which will be corrected. (By the way, the FAQ is misleading in
this respect: g++ -E -dM - < /dev/null does not show that _GNU_SOURCE
is predefined; but g++ -E -dM empty.c will.)
Oddly enough, IMO, PR 2082 (and subsequent duplicates) are closed.
The explaination for why this bug is closed is really not clear to
me: features.h has to be processed with the correct switches.
G++ 3.2 breaks the following conforming C++ code:
#include <math.h> (or <cmath>)
int round;
C99 introduced a new function named round, as well as others.
ISO C++ does not define a function named round, and, as far
as I'm aware, the C++ standard doesn't incorporate C99 changes.
So, can anyone elucidate why _GNU_SOURCE is defined by G++ and
not by GCC and/or why it implies _USE_ISOC99? And why this is
not a bug?
--
Michael Eager eager@mvista.com 408-328-8426
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA 94085