From 377fc3e81d6e928293a00a5d9d4eb3ca9def8449 Mon Sep 17 00:00:00 2001 From: bkoz Date: Tue, 27 Sep 2011 00:02:54 +0000 Subject: [PATCH] 2011-09-26 Benjamin Kosnik PR libstdc++/48698 * acinclude.m4 (GLIBCXX_ENABLE_SYMVERS): Set libtool_VERSION here. * configure.ac: Move AC_SUBST of libtool_VERSION past call to GLIBCXX_ENABLE_SYMVERS. * configure: Regenerate. * include/bits/c++config: Use __7 as versioned namespace name. * config/abi/pre/gnu-versioned-namespace.ver: Change mangling as per above. * include/c_global/cwchar: Adjust nested namespaces. * testsuite/20_util/bind/48698.cc: Add test case. * testsuite/ext/profile/mutex_extensions_neg.cc: Change line number. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179221 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 15 ++++++ libstdc++-v3/acinclude.m4 | 11 ++++- .../config/abi/pre/gnu-versioned-namespace.ver | 56 +++++++++++----------- libstdc++-v3/configure | 36 +++++++------- libstdc++-v3/configure.ac | 8 +--- libstdc++-v3/include/bits/c++config | 37 +++++++------- libstdc++-v3/include/c_global/cwchar | 4 +- libstdc++-v3/testsuite/20_util/bind/48698.cc | 31 ++++++++++++ .../testsuite/ext/profile/mutex_extensions_neg.cc | 2 +- 9 files changed, 126 insertions(+), 74 deletions(-) create mode 100644 libstdc++-v3/testsuite/20_util/bind/48698.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9830cca2ef5..05f7ef262ca 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,18 @@ +2011-09-25 Benjamin Kosnik + + PR libstdc++/48698 + * acinclude.m4 (GLIBCXX_ENABLE_SYMVERS): Set libtool_VERSION here. + * configure.ac: Move AC_SUBST of libtool_VERSION past call to + GLIBCXX_ENABLE_SYMVERS. + * configure: Regenerate. + * include/bits/c++config: Use __7 as versioned namespace name. + * config/abi/pre/gnu-versioned-namespace.ver: Change mangling as + per above. + * include/c_global/cwchar: Adjust nested namespaces. + * testsuite/20_util/bind/48698.cc: Add test case. + * testsuite/ext/profile/mutex_extensions_neg.cc: Change line number. + 2011-09-25 Paolo Carlini Revert (no longer necessary post r179130): diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index ccfb2ce5e30..1b9d025efc3 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -3054,10 +3054,15 @@ dnl dnl Add version tags to symbols in shared library (or not), additionally dnl marking other symbols as private/local (or not). dnl +dnl Sets libtool_VERSION, and determines shared library SONAME. +dnl +dnl This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no. +dnl dnl --enable-symvers=style adds a version script to the linker call when dnl creating the shared library. The choice of version script is dnl controlled by 'style'. dnl --disable-symvers does not. +dnl dnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)] dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to dnl choose a default style based on linker characteristics. Passing @@ -3194,7 +3199,10 @@ changequote([,])dnl fi fi -# Everything parsed; figure out what file to use. +# For libtool versioning info, format is CURRENT:REVISION:AGE +libtool_VERSION=6:17:0 + +# Everything parsed; figure out what files and settings to use. case $enable_symvers in no) SYMVER_FILE=config/abi/pre/none.ver @@ -3205,6 +3213,7 @@ case $enable_symvers in [Define to use GNU versioning in the shared library.]) ;; gnu-versioned-namespace) + libtool_VERSION=7:0:0 SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1, [Define to use GNU namespace versioning in the shared library.]) diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver index ab9380c3705..32bcf67d819 100644 --- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver +++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver @@ -20,23 +20,23 @@ ## with this library; see the file COPYING3. If not see ## . -GLIBCXX_5.0 { +GLIBCXX_7.0 { global: # Names inside the 'extern' block are demangled names. extern "C++" { - std::_6::*; + std::__7::*; std::* }; # locale - _ZNSt2_69has_facetINS_*; + _ZNSt3__79has_facetINS_*; # hash - _ZNSt8__detail2_612__prime_listE; - _ZNSt3tr18__detail2_612__prime_listE; + _ZNSt8__detail3__712__prime_listE; + _ZNSt3tr18__detail3__712__prime_listE; # thread/mutex/condition_variable/future __once_proxy; @@ -73,41 +73,41 @@ GLIBCXX_5.0 { _ZTv0_n*; # std::__detail::_List_node_base - _ZNSt8__detail2_615_List_node_base7_M_hook*; - _ZNSt8__detail2_615_List_node_base9_M_unhookEv; - _ZNSt8__detail2_615_List_node_base10_M_reverseEv; - _ZNSt8__detail2_615_List_node_base11_M_transfer*; - _ZNSt8__detail2_615_List_node_base4swapER*; + _ZNSt8__detail3__715_List_node_base7_M_hook*; + _ZNSt8__detail3__715_List_node_base9_M_unhookEv; + _ZNSt8__detail3__715_List_node_base10_M_reverseEv; + _ZNSt8__detail3__715_List_node_base11_M_transfer*; + _ZNSt8__detail3__715_List_node_base4swapER*; # std::__convert_to_v - _ZNSt2_614__convert_to_v*; + _ZNSt3__714__convert_to_v*; # std::__copy_streambufs - _ZNSt2_617__copy_streambufsI*; - _ZNSt2_621__copy_streambufs_eofI*; + _ZNSt3__717__copy_streambufsI*; + _ZNSt3__721__copy_streambufs_eofI*; # __gnu_cxx::__atomic_add # __gnu_cxx::__exchange_and_add - _ZN9__gnu_cxx2_612__atomic_addEPV[il][il]; - _ZN9__gnu_cxx2_618__exchange_and_addEPV[li][il]; + _ZN9__gnu_cxx3__712__atomic_addEPV[il][il]; + _ZN9__gnu_cxx3__718__exchange_and_addEPV[li][il]; # __gnu_cxx::__pool - _ZN9__gnu_cxx2_66__poolILb[01]EE13_M_initializeEv; - _ZN9__gnu_cxx2_66__poolILb[01]EE16_M_reserve_blockE[jm][jm]; - _ZN9__gnu_cxx2_66__poolILb[01]EE16_M_reclaim_blockEPc[jm]; - _ZN9__gnu_cxx2_66__poolILb[01]EE10_M_destroyEv; - _ZN9__gnu_cxx2_66__poolILb1EE16_M_get_thread_idEv; + _ZN9__gnu_cxx3__76__poolILb[01]EE13_M_initializeEv; + _ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reserve_blockE[jm][jm]; + _ZN9__gnu_cxx3__76__poolILb[01]EE16_M_reclaim_blockEPc[jm]; + _ZN9__gnu_cxx3__76__poolILb[01]EE10_M_destroyEv; + _ZN9__gnu_cxx3__76__poolILb1EE16_M_get_thread_idEv; - _ZN9__gnu_cxx2_617__pool_alloc_base9_M_refillE[jm]; - _ZN9__gnu_cxx2_617__pool_alloc_base16_M_get_free_listE[jm]; - _ZN9__gnu_cxx2_617__pool_alloc_base12_M_get_mutexEv; + _ZN9__gnu_cxx3__717__pool_alloc_base9_M_refillE[jm]; + _ZN9__gnu_cxx3__717__pool_alloc_base16_M_get_free_listE[jm]; + _ZN9__gnu_cxx3__717__pool_alloc_base12_M_get_mutexEv; - _ZN9__gnu_cxx2_69free_list6_M_getE[jm]; - _ZN9__gnu_cxx2_69free_list8_M_clearEv; + _ZN9__gnu_cxx3__79free_list6_M_getE[jm]; + _ZN9__gnu_cxx3__79free_list8_M_clearEv; # __gnu_cxx::stdio_sync_filebuf - _ZTVN9__gnu_cxx2_618stdio_sync_filebufI[cw]St2_611char_traitsI[cw]EEE; - _ZN9__gnu_cxx2_618stdio_sync_filebufI[cw]NSt2_611char_traitsI[cw]EEE[5-9]*; + _ZTVN9__gnu_cxx3__718stdio_sync_filebufI[cw]St3__711char_traitsI[cw]EEE; + _ZN9__gnu_cxx3__718stdio_sync_filebufI[cw]NSt3__711char_traitsI[cw]EEE[5-9]*; # debug mode _ZN11__gnu_debug19_Safe_sequence_base12_M_get_mutexEv; @@ -212,7 +212,7 @@ CXXABI_2.0 { _ZSt15_Fnv_hash_bytesPKv*; # __gnu_cxx::_verbose_terminate_handler() - _ZN9__gnu_cxx2_627__verbose_terminate_handlerEv; + _ZN9__gnu_cxx3__727__verbose_terminate_handlerEv; # *_type_info classes, ctor and dtor _ZN10__cxxabiv117__array_type_info*; diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 423d4470409..ef663beee0c 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -645,6 +645,7 @@ GLIBCXX_LDBL_COMPAT_FALSE GLIBCXX_LDBL_COMPAT_TRUE ENABLE_VISIBILITY_FALSE ENABLE_VISIBILITY_TRUE +libtool_VERSION ENABLE_SYMVERS_SOL2_FALSE ENABLE_SYMVERS_SOL2_TRUE ENABLE_SYMVERS_SUN_FALSE @@ -788,7 +789,6 @@ build_vendor build_cpu build multi_basedir -libtool_VERSION target_alias host_alias build_alias @@ -2825,10 +2825,6 @@ ac_config_headers="$ac_config_headers config.h" # exported. Only used at the end of this file. ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD -# For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=6:17:0 - - # Find the rest of the source tree framework. # Default to --enable-multilib # Check whether --enable-multilib was given. @@ -11489,7 +11485,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11492 "configure" +#line 11488 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11595,7 +11591,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11598 "configure" +#line 11594 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14953,7 +14949,7 @@ fi # # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. cat > conftest.$ac_ext << EOF -#line 14956 "configure" +#line 14952 "configure" struct S { ~S(); }; void bar(); void foo() @@ -15321,7 +15317,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; } # Fake what AC_TRY_COMPILE does. cat > conftest.$ac_ext << EOF -#line 15324 "configure" +#line 15320 "configure" int main() { typedef bool atomic_type; @@ -15358,7 +15354,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15361 "configure" +#line 15357 "configure" int main() { typedef short atomic_type; @@ -15395,7 +15391,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15398 "configure" +#line 15394 "configure" int main() { // NB: _Atomic_word not necessarily int. @@ -15433,7 +15429,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15436 "configure" +#line 15432 "configure" int main() { typedef long long atomic_type; @@ -15509,7 +15505,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15512 "configure" +#line 15508 "configure" int main() { _Decimal32 d1; @@ -15551,7 +15547,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu # unnecessary for this test. cat > conftest.$ac_ext << EOF -#line 15554 "configure" +#line 15550 "configure" template struct same { typedef T2 type; }; @@ -15585,7 +15581,7 @@ $as_echo "$enable_int128" >&6; } rm -f conftest* cat > conftest.$ac_ext << EOF -#line 15588 "configure" +#line 15584 "configure" template struct same { typedef T2 type; }; @@ -63971,7 +63967,6 @@ $as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h fi - # Check whether --enable-linux-futex was given. if test "${enable_linux_futex+set}" = set; then : enableval=$enable_linux_futex; @@ -64497,7 +64492,6 @@ ac_config_commands="$ac_config_commands include/gstdint.h" -# This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU c++filt" >&5 $as_echo_n "checking for GNU c++filt... " >&6; } @@ -64735,7 +64729,10 @@ $as_echo "$as_me: WARNING: === Symbol versioning will be disabled." >&2;} fi fi -# Everything parsed; figure out what file to use. +# For libtool versioning info, format is CURRENT:REVISION:AGE +libtool_VERSION=6:17:0 + +# Everything parsed; figure out what files and settings to use. case $enable_symvers in no) SYMVER_FILE=config/abi/pre/none.ver @@ -64747,6 +64744,7 @@ $as_echo "#define _GLIBCXX_SYMVER_GNU 1" >>confdefs.h ;; gnu-versioned-namespace) + libtool_VERSION=7:0:0 SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver $as_echo "#define _GLIBCXX_SYMVER_GNU_NAMESPACE 1" >>confdefs.h @@ -64897,6 +64895,8 @@ fi $as_echo "$glibcxx_ptrdiff_t_is_i" >&6; } + + # Check whether --enable-visibility was given. if test "${enable_visibility+set}" = set; then : enableval=$enable_visibility; diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 8b528baaf97..eb2fe85a7c4 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -11,10 +11,6 @@ AC_CONFIG_HEADER(config.h) # exported. Only used at the end of this file. ### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD -# For libtool versioning info, format is CURRENT:REVISION:AGE -libtool_VERSION=6:17:0 -AC_SUBST(libtool_VERSION) - # Find the rest of the source tree framework. AM_ENABLE_MULTILIB(, ..) @@ -305,13 +301,13 @@ fi # Check for _Unwind_GetIPInfo. GCC_CHECK_UNWIND_GETIPINFO - GCC_LINUX_FUTEX([AC_DEFINE(HAVE_LINUX_FUTEX, 1, [Define if futex syscall is available.])]) GCC_HEADER_STDINT(include/gstdint.h) -# This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no. GLIBCXX_ENABLE_SYMVERS([yes]) +AC_SUBST(libtool_VERSION) + GLIBCXX_ENABLE_VISIBILITY([yes]) ac_ldbl_compat=no diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index e8a2946dcc3..8c61de311d4 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -176,41 +176,42 @@ namespace std // Defined if inline namespaces are used for versioning. -#define _GLIBCXX_INLINE_VERSION +#define _GLIBCXX_INLINE_VERSION // Inline namespace for symbol versioning. #if _GLIBCXX_INLINE_VERSION + namespace std { - inline namespace _6 { } + inline namespace __7 { } - namespace rel_ops { inline namespace _6 { } } + namespace rel_ops { inline namespace __7 { } } namespace tr1 { - inline namespace _6 { } - namespace placeholders { inline namespace _6 { } } - namespace regex_constants { inline namespace _6 { } } - namespace __detail { inline namespace _6 { } } + inline namespace __7 { } + namespace placeholders { inline namespace __7 { } } + namespace regex_constants { inline namespace __7 { } } + namespace __detail { inline namespace __7 { } } } - namespace decimal { inline namespace _6 { } } + namespace decimal { inline namespace __7 { } } - namespace chrono { inline namespace _6 { } } - namespace placeholders { inline namespace _6 { } } - namespace regex_constants { inline namespace _6 { } } - namespace this_thread { inline namespace _6 { } } + namespace chrono { inline namespace __7 { } } + namespace placeholders { inline namespace __7 { } } + namespace regex_constants { inline namespace __7 { } } + namespace this_thread { inline namespace __7 { } } - namespace __detail { inline namespace _6 { } } - namespace __regex { inline namespace _6 { } } + namespace __detail { inline namespace __7 { } } + namespace __regex { inline namespace __7 { } } } namespace __gnu_cxx { - inline namespace _6 { } - namespace __detail { inline namespace _6 { } } + inline namespace __7 { } + namespace __detail { inline namespace __7 { } } } -# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace _6 { +# define _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace __7 { # define _GLIBCXX_END_NAMESPACE_VERSION } #else # define _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -227,7 +228,7 @@ namespace std namespace __cxx1998 { #if _GLIBCXX_INLINE_VERSION - inline namespace _6 { } + inline namespace __7 { } #endif } diff --git a/libstdc++-v3/include/c_global/cwchar b/libstdc++-v3/include/c_global/cwchar index 5a33965777e..a2b1168f9a0 100644 --- a/libstdc++-v3/include/c_global/cwchar +++ b/libstdc++-v3/include/c_global/cwchar @@ -136,6 +136,8 @@ namespace std namespace std _GLIBCXX_VISIBILITY(default) { +_GLIBCXX_BEGIN_NAMESPACE_VERSION + using ::wint_t; using ::btowc; @@ -207,8 +209,6 @@ namespace std _GLIBCXX_VISIBILITY(default) using ::wcsstr; using ::wmemchr; -_GLIBCXX_BEGIN_NAMESPACE_VERSION - #ifndef __CORRECT_ISO_CPP_WCHAR_H_PROTO inline wchar_t* wcschr(wchar_t* __p, wchar_t __c) diff --git a/libstdc++-v3/testsuite/20_util/bind/48698.cc b/libstdc++-v3/testsuite/20_util/bind/48698.cc new file mode 100644 index 00000000000..a623735f3eb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/bind/48698.cc @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2011 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 3, 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 COPYING3. If not see +// . + +// 20.7.11 Function template bind + +#include + +int f(int i); + +// Don't want placeholders to interfere with a possibly-versioned namespace. +int g() +{ + std::bind(f, std::placeholders::_6); +} diff --git a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc index eb77fb4837e..ba515b7fb6b 100644 --- a/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc +++ b/libstdc++-v3/testsuite/ext/profile/mutex_extensions_neg.cc @@ -25,4 +25,4 @@ #include -// { dg-error "multiple inlined namespaces" "" { target *-*-* } 255 } +// { dg-error "multiple inlined namespaces" "" { target *-*-* } 256 } -- 2.11.0