From 6918f040486075fcde4edaa37583043c658083ff Mon Sep 17 00:00:00 2001 From: bkoz Date: Tue, 6 May 2008 18:57:46 +0000 Subject: [PATCH] 2008-05-06 Benjamin Kosnik 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 | 6 ++++++ libstdc++-v3/include/bits/c++config | 17 +++++++--------- .../29_atomics/headers/stdatomic.h/debug_mode.c | 23 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b5201c5..f50f917 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2008-05-06 Benjamin Kosnik + + 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 * include/parallel/multiway_merge.h: diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index f967bd2..f4029b2 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -80,6 +80,7 @@ namespace tr1 { } } */ +#if __cplusplus #ifdef _GLIBCXX_DEBUG # define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1 @@ -103,15 +104,12 @@ // _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 index 0000000..8b2c857 --- /dev/null +++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/debug_mode.c @@ -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 -- 2.7.4