This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/11196] parse error before numeric constant <M_PI is defined in C++>
- From: "jan at etpmod dot phys dot tue dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Mar 2004 12:20:57 -0000
- Subject: [Bug libstdc++/11196] parse error before numeric constant <M_PI is defined in C++>
- References: <20030615172415.11196.is88071@cis.nctu.edu.tw>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From jan at etpmod dot phys dot tue dot nl 2004-03-08 12:20 -------
The bug is that the C++ front end implicitly #defines _GNU_SOURCE.
In glibc (I have version 2.3.2 here) this, amongst others, enables _BSD_SOURCE
(see /usr/include/features.h). That in turn enables non-standard symbols like
M_PI in math.h. Hence the failure.
As a result one can argue that this is a C++ front end bug... however:
gcc/config/linux.h tells us that:
/* The GNU C++ standard library requires that these macros be defined. */
#undef CPLUSPLUS_CPP_SPEC
#define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
... so this may be a libstdc++ issue after all.
The #define is also present for other configuration files in gcc/config/* and
subdirectories.
I googled and searched the libstdc++ archives and Changelog files, but did no
find the reason why _GNU_SOURCE is in fact needed by gnu's libstdc++. I just
removed the -D_GNU_SOURCE from gcc/config/linux.h (on i686-suse-linux) and
bootstrapped gcc (HEAD) with languages=c,c++. That went just fine and
(obviously) fixed the problem reported here.
Could some libstdc++ guru explain why this define is actually needed?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11196