aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2005-10-11 06:19:13 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2005-10-11 06:19:13 +0000
commit18c75543a89fc2b6a62b3e2967cb89b83fb96ada (patch)
treea25c3b10a5e437f7a6875e11b8b8bd9c85f26839
parente0c48a517ebd8213c2300b7d63907b2e85c0ef9c (diff)
downloadgcc-18c75543a89fc2b6a62b3e2967cb89b83fb96ada.zip
gcc-18c75543a89fc2b6a62b3e2967cb89b83fb96ada.tar.gz
gcc-18c75543a89fc2b6a62b3e2967cb89b83fb96ada.tar.bz2
re PR libstdc++/13583 (__use_cache not threadsafe)
PR libstdc++/13583 * include/bits/locale_classes.h (locale::_Impl::_M_install_cache): Move out of line. * src/locale.cc: Define here, add mutex. * configure.ac (libtool_VERSION): To 6:7:0. * configure: Regenerate. * testsuite/testsuite_abi.cc (check_version): Add GLIBCXX_3.4.7. * config/linker-map.gnu: Export locale::_Impl::_M_install_cache. From-SVN: r105221
-rw-r--r--libstdc++-v3/ChangeLog14
-rw-r--r--libstdc++-v3/config/linker-map.gnu16
-rwxr-xr-xlibstdc++-v3/configure2
-rw-r--r--libstdc++-v3/configure.ac2
-rw-r--r--libstdc++-v3/include/bits/locale_classes.h6
-rw-r--r--libstdc++-v3/src/locale.cc24
-rw-r--r--libstdc++-v3/testsuite/testsuite_abi.cc1
7 files changed, 56 insertions, 9 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 653b0de..e9f6883 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,17 @@
+2005-10-10 Benjamin Kosnik <bkoz@redhat.com>
+
+ * configure.ac (libtool_VERSION): To 6:7:0.
+ * configure: Regenerate.
+ * testsuite/testsuite_abi.cc (check_version): Add GLIBCXX_3.4.7.
+ * config/linker-map.gnu: Export locale::_Impl::_M_install_cache.
+
+2005-10-10 Ian Lance Taylor <ian@airs.com>
+
+ PR libstdc++/13583
+ * include/bits/locale_classes.h (locale::_Impl::_M_install_cache):
+ Move out of line.
+ * src/locale.cc: Define here, add mutex.
+
2005-10-09 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24061 (issue 6.19)
diff --git a/libstdc++-v3/config/linker-map.gnu b/libstdc++-v3/config/linker-map.gnu
index 0b89892..fa13a61 100644
--- a/libstdc++-v3/config/linker-map.gnu
+++ b/libstdc++-v3/config/linker-map.gnu
@@ -84,7 +84,7 @@ GLIBCXX_3.4 {
std::locale::[A-Zj-z]*;
std::locale::_[A-Ha-z]*;
std::locale::_Impl::[A-Za-z]*;
- std::locale::_Impl::_M_[A-Za-z]*;
+# std::locale::_Impl::_M_[A-Za-z]*;
std::locale::_[J-Ra-z]*;
std::locale::_S_normalize_category*;
std::locale::_[T-Za-z]*;
@@ -468,6 +468,12 @@ GLIBCXX_3.4 {
_ZNSt19istreambuf_iteratorI[cw]St11char_traitsI[cw]EEppEv;
+ # std::locale::Impl _M_ members
+ _ZNSt6locale5_Impl16_M_install_facetEPKNS_2idEPKNS_5facetE;
+ _ZNSt6locale5_Impl16_M_replace_facetEPKS0_PKNS_2idE;
+ _ZNSt6locale5_Impl19_M_replace_categoryEPKS0_PKPKNS_2idE;
+ _ZNSt6locale5_Impl21_M_replace_categoriesEPKS0_i;
+
# DO NOT DELETE THIS LINE. Port-specific symbols, if any, will be here.
local:
@@ -571,10 +577,16 @@ GLIBCXX_3.4.6 {
_ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv;
- _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEv;
+ _ZN9__gnu_cxx6__poolILb1EE13_M_initializeEv;
} GLIBCXX_3.4.5;
+GLIBCXX_3.4.7 {
+
+ _ZNSt6locale5_Impl16_M_install_cacheEPKNS_5facetE[jm];
+
+} GLIBCXX_3.4.6;
+
# Symbols in the support library (libsupc++) have their own tag.
CXXABI_1.3 {
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 1a32ed4..5a25997 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -1376,7 +1376,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:6:0
+libtool_VERSION=6:7:0
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index d350e6e..fc31bc6 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -12,7 +12,7 @@ AC_CONFIG_HEADER(config.h)
### am handles this now? ORIGINAL_LD_FOR_MULTILIBS=$LD
# For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:6:0
+libtool_VERSION=6:7:0
AC_SUBST(libtool_VERSION)
# Find the rest of the source tree framework.
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index 08c1927..aed938d 100644
--- a/libstdc++-v3/include/bits/locale_classes.h
+++ b/libstdc++-v3/include/bits/locale_classes.h
@@ -559,11 +559,7 @@ namespace std
{ _M_install_facet(&_Facet::id, __facet); }
void
- _M_install_cache(const facet* __cache, size_t __index) throw()
- {
- __cache->_M_add_reference();
- _M_caches[__index] = __cache;
- }
+ _M_install_cache(const facet*, size_t);
};
template<typename _Facet>
diff --git a/libstdc++-v3/src/locale.cc b/libstdc++-v3/src/locale.cc
index 0117d15..5498eae 100644
--- a/libstdc++-v3/src/locale.cc
+++ b/libstdc++-v3/src/locale.cc
@@ -33,6 +33,13 @@
#include <cwctype> // For towupper, etc.
#include <locale>
#include <bits/atomicity.h>
+#include <bits/concurrence.h>
+
+namespace __gnu_internal
+{
+ // Mutex object for cache access
+ static __glibcxx_mutex_define_initialized(locale_cache_mutex);
+}
namespace std
{
@@ -366,6 +373,23 @@ namespace std
}
}
+ void
+ locale::_Impl::
+ _M_install_cache(const facet* __cache, size_t __index)
+ {
+ __gnu_cxx::lock sentry(__gnu_internal::locale_cache_mutex);
+ if (_M_caches[__index] != 0)
+ {
+ // Some other thread got in first.
+ delete __cache;
+ }
+ else
+ {
+ __cache->_M_add_reference();
+ _M_caches[__index] = __cache;
+ }
+ }
+
// locale::id
// Definitions for static const data members of locale::id
_Atomic_word locale::id::_S_refcount; // init'd to 0 by linker
diff --git a/libstdc++-v3/testsuite/testsuite_abi.cc b/libstdc++-v3/testsuite/testsuite_abi.cc
index 223af51..d0e65af 100644
--- a/libstdc++-v3/testsuite/testsuite_abi.cc
+++ b/libstdc++-v3/testsuite/testsuite_abi.cc
@@ -185,6 +185,7 @@ check_version(symbol& test, bool added)
known_versions.push_back("GLIBCXX_3.4.4");
known_versions.push_back("GLIBCXX_3.4.5");
known_versions.push_back("GLIBCXX_3.4.6");
+ known_versions.push_back("GLIBCXX_3.4.7");
known_versions.push_back("CXXABI_1.3");
known_versions.push_back("CXXABI_1.3.1");
}