2008-05-06 Benjamin Kosnik <bkoz@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 May 2008 18:57:46 +0000 (18:57 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 May 2008 18:57:46 +0000 (18:57 +0000)
PR libstdc++/36130
* include/bits/c++config: Namespace macros and setup only in C++.
* testsuite/29_atomics/headers/stdatomic.h/debug_mode.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134995 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/c++config
libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c [new file with mode: 0644]

index b5201c5..f50f917 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-06  Benjamin Kosnik  <bkoz@redhat.com>
+
+       PR libstdc++/36130
+       * include/bits/c++config: Namespace macros and setup only in C++.
+       * testsuite/29_atomics/headers/stdatomic.h/debug_mode.c: New.
+       
 2008-05-06  Johannes Singler  <singler@ira.uka.de>
 
         * include/parallel/multiway_merge.h:
index f967bd2..f4029b2 100644 (file)
@@ -80,6 +80,7 @@
     namespace tr1 { }
   }
 */
+#if __cplusplus
 
 #ifdef _GLIBCXX_DEBUG
 # define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1
 // _GLIBCXX_STD
 // _GLIBCXX_STD_D
 // _GLIBCXX_STD_P
-
 //
 // Macros for enclosing namespaces and possibly nested namespaces.
 // _GLIBCXX_BEGIN_NAMESPACE
 // _GLIBCXX_END_NAMESPACE
 // _GLIBCXX_BEGIN_NESTED_NAMESPACE
 // _GLIBCXX_END_NESTED_NAMESPACE
-// _GLIBCXX_BEGIN_POTENTIAL_NESTED_NAMESPACE
-// _GLIBCXX_END_POTENTIAL_NESTED_NAMESPACE
 #ifndef _GLIBCXX_USE_NAMESPACE_ASSOCIATION
 # define _GLIBCXX_STD_D _GLIBCXX_STD
 # define _GLIBCXX_STD_P _GLIBCXX_STD
@@ -215,8 +213,7 @@ namespace std
 #undef _GLIBCXX_LONG_DOUBLE_COMPAT
 
 // Namespace associations for long double 128 mode.
-#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ \
-  && defined __cplusplus
+#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__ 
 namespace std
 {
   inline namespace __gnu_cxx_ldbl128 { }
@@ -232,17 +229,17 @@ namespace std
 
 
 // Defines for C compatibility. In particular, define extern "C"
-// linkage only when using  C++, same with namespaces.
-#if __cplusplus
+// linkage only when using C++.
 # define _GLIBCXX_BEGIN_EXTERN_C extern "C" {
 # define _GLIBCXX_END_EXTERN_C }
-#else
-# define _GLIBCXX_BEGIN_EXTERN_C
-# define _GLIBCXX_END_EXTERN_C
+
+#else // !__cplusplus
 # undef _GLIBCXX_BEGIN_NAMESPACE
 # undef _GLIBCXX_END_NAMESPACE
 # define _GLIBCXX_BEGIN_NAMESPACE(X) 
 # define _GLIBCXX_END_NAMESPACE 
+# define _GLIBCXX_BEGIN_EXTERN_C
+# define _GLIBCXX_END_EXTERN_C 
 #endif
 
 // First includes.
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c
new file mode 100644 (file)
index 0000000..8b2c857
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-options "-x c -D_GLIBCXX_DEBUG" }
+// { dg-do compile }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// libstdc++/36130
+#include <stdatomic.h>