This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/1773] __cplusplus defined to 1, should be 199711L
- From: "ro at CeBiTec dot Uni-Bielefeld.DE" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 7 Mar 2011 19:06:06 +0000
- Subject: [Bug libstdc++/1773] __cplusplus defined to 1, should be 199711L
- Auto-submitted: auto-generated
- References: <bug-1773-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
--- Comment #73 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> 2011-03-07 19:05:14 UTC ---
> --- Comment #72 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-03-07 16:38:06 UTC ---
> If I remember correctly, mostly Solaris issues prevented us from defining
> __cplusplus to a meaningful value. Since now we have a pretty active
> maintainer, Rainer, I'm adding him in CC and asking him to play a bit with the
> straightforward cpp_init_builtins patch defining __cplusplus to 199711 for
> c++98 (and 201103 in c++0x mode?)
I've used the following patch and gave it a try on Solaris 8 to 11, both
SPARC and x86:
diff -r 599e2b06493d libcpp/init.c
--- a/libcpp/init.c Fri Mar 04 18:31:41 2011 +0100
+++ b/libcpp/init.c Mon Mar 07 20:02:13 2011 +0100
@@ -452,8 +452,12 @@
|| CPP_OPTION (pfile, std)))
_cpp_define_builtin (pfile, "__STDC__ 1");
- if (CPP_OPTION (pfile, cplusplus))
- _cpp_define_builtin (pfile, "__cplusplus 1");
+ if (CPP_OPTION (pfile, lang) == CLK_CXX98
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX)
+ _cpp_define_builtin (pfile, "__cplusplus 19971L");
+ else if (CPP_OPTION (pfile, lang) == CLK_CXX0X
+ || CPP_OPTION (pfile, lang) == CLK_GNUCXX0X)
+ _cpp_define_builtin (pfile, "__cplusplus 201103L");
else if (CPP_OPTION (pfile, lang) == CLK_ASM)
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
Unfortunately, even on Solaris 11/x86 bootstrap breaks quickly building
i386-pc-solaris2.11/bits/stdc++.h.gch/O2ggnu++0x.gch:
In file included from
/vol/gcc/src/hg/trunk/local/libstdc++-v3/include/precompiled/stdc++.h:42:0:
/var/gcc/regression/trunk/11-gcc-gas/build/i386-pc-solaris2.11/libstdc++-v3/include/cmath:
In function 'double std::abs(double)':
/var/gcc/regression/trunk/11-gcc-gas/build/i386-pc-solaris2.11/libstdc++-v3/include/cmath:82:3:
error: redefinition of 'double std::abs(double)'
/usr/include/iso/math_iso.h:159:16: error: 'double std::abs(double)' previously
defined here
and many many more errors.
cmath has
inline double
abs(double __x)
{ return __builtin_fabs(__x); }
while <iso/math_iso.h> has
inline double abs(double __X) { return fabs(__X); }
I haven't looked at the failures on older Solaris versions yet, which
will likely be different.
Rainer