This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: [libcpp] Correctly define __cplusplus (PR libstdc++-v3/1773)


Jason,

> On 08/09/2011 09:14 AM, Marc Glisse wrote:
>> I don't think we should define the C++ 2011 value yet. In my opinion, we
>> should wait until:
>> 1) the standard is official
>> 2) gcc implements most of it: people will want to use __cplusplus as a
>> test to know if they can use C++0X features, not if the compiler does
>> some effort to implement half of them.
>
> I'm of two minds about this, but I see that clang and edg still use 199711L
> in C++0x mode, so let's stick with that for now.

with the prerequisite patches now installed, here's the reworked version
of the final patch.

Tested as described for the rest, ok for mainline?

	Rainer


2011-03-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR libstdc++/1773
	* init.c (cpp_init_builtins): Define __cplusplus 19971L.

# HG changeset patch
# Parent 1751547561d4c2f04c27d9507fb5cd679c6b3eb3
Properly define __cplusplus (PR libstdc++-v3/1773)

diff --git a/libcpp/init.c b/libcpp/init.c
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -453,7 +453,7 @@ cpp_init_builtins (cpp_reader *pfile, in
     _cpp_define_builtin (pfile, "__STDC__ 1");
 
   if (CPP_OPTION (pfile, cplusplus))
-    _cpp_define_builtin (pfile, "__cplusplus 1");
+    _cpp_define_builtin (pfile, "__cplusplus 199711L");
   else if (CPP_OPTION (pfile, lang) == CLK_ASM)
     _cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
   else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]