diff options
author | Torvald Riegel <triegel@redhat.com> | 2016-01-15 22:42:41 +0000 |
---|---|---|
committer | Torvald Riegel <torvald@gcc.gnu.org> | 2016-01-15 22:42:41 +0000 |
commit | a04d5fc95d7494824b07feb6c57cf71b4891e3de (patch) | |
tree | 2a0e76101e1e20d6aaa161901261dee89f905afb /libstdc++-v3/include | |
parent | 40c43acacc1765416278e6636c20c5e3a78a7384 (diff) | |
download | gcc-a04d5fc95d7494824b07feb6c57cf71b4891e3de.zip gcc-a04d5fc95d7494824b07feb6c57cf71b4891e3de.tar.gz gcc-a04d5fc95d7494824b07feb6c57cf71b4891e3de.tar.bz2 |
libstdc++: Make certain exceptions transaction_safe.
From-SVN: r232454
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/Makefile.am | 13 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.in | 10 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/basic_string.h | 12 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/c++config | 16 | ||||
-rw-r--r-- | libstdc++-v3/include/std/stdexcept | 54 |
5 files changed, 81 insertions, 24 deletions
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 07dc48a..39327d9 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -1200,6 +1200,14 @@ stamp-cxx11-abi: echo 0 > stamp-cxx11-abi endif +if ENABLE_ALLOCATOR_NEW +stamp-allocator-new: + echo 1 > stamp-allocator-new +else +stamp-allocator-new: + echo 0 > stamp-allocator-new +endif + # NB: The non-empty default ldbl_compat works around an AIX sed # oddity, see libstdc++/31957 for details. ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ @@ -1210,13 +1218,15 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ stamp-visibility \ stamp-extern-template \ stamp-dual-abi \ - stamp-cxx11-abi + stamp-cxx11-abi \ + stamp-allocator-new @date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\ ns_version=`cat stamp-namespace-version` ;\ visibility=`cat stamp-visibility` ;\ externtemplate=`cat stamp-extern-template` ;\ dualabi=`cat stamp-dual-abi` ;\ cxx11abi=`cat stamp-cxx11-abi` ;\ + allocatornew=`cat stamp-allocator-new` ;\ ldbl_compat='s,g,g,' ;\ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \ ${CONFIG_HEADER} > /dev/null 2>&1 \ @@ -1227,6 +1237,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ -e "s,define _GLIBCXX_EXTERN_TEMPLATE$$, define _GLIBCXX_EXTERN_TEMPLATE $$externtemplate," \ -e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \ -e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \ + -e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \ -e "$$ldbl_compat" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index f2fb4da..e74fae8 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -1631,6 +1631,11 @@ stamp-host: ${host_headers} ${bits_host_headers} ${ext_host_headers} ${host_head @ENABLE_CXX11_ABI_FALSE@stamp-cxx11-abi: @ENABLE_CXX11_ABI_FALSE@ echo 0 > stamp-cxx11-abi +@ENABLE_ALLOCATOR_NEW_TRUE@stamp-allocator-new: +@ENABLE_ALLOCATOR_NEW_TRUE@ echo 1 > stamp-allocator-new +@ENABLE_ALLOCATOR_NEW_FALSE@stamp-allocator-new: +@ENABLE_ALLOCATOR_NEW_FALSE@ echo 0 > stamp-allocator-new + # NB: The non-empty default ldbl_compat works around an AIX sed # oddity, see libstdc++/31957 for details. ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ @@ -1641,13 +1646,15 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ stamp-visibility \ stamp-extern-template \ stamp-dual-abi \ - stamp-cxx11-abi + stamp-cxx11-abi \ + stamp-allocator-new @date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\ ns_version=`cat stamp-namespace-version` ;\ visibility=`cat stamp-visibility` ;\ externtemplate=`cat stamp-extern-template` ;\ dualabi=`cat stamp-dual-abi` ;\ cxx11abi=`cat stamp-cxx11-abi` ;\ + allocatornew=`cat stamp-allocator-new` ;\ ldbl_compat='s,g,g,' ;\ grep "^[ ]*#[ ]*define[ ][ ]*_GLIBCXX_LONG_DOUBLE_COMPAT[ ][ ]*1[ ]*$$" \ ${CONFIG_HEADER} > /dev/null 2>&1 \ @@ -1658,6 +1665,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \ -e "s,define _GLIBCXX_EXTERN_TEMPLATE$$, define _GLIBCXX_EXTERN_TEMPLATE $$externtemplate," \ -e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \ -e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \ + -e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \ -e "$$ldbl_compat" \ < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\ sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \ diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index e7460bb..374c985 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -4902,6 +4902,18 @@ _GLIBCXX_END_NAMESPACE_CXX11 int compare(size_type __pos, size_type __n1, const _CharT* __s, size_type __n2) const; + +# ifdef _GLIBCXX_TM_TS_INTERNAL + friend void + ::_txnal_cow_string_C1_for_exceptions(void* that, const char* s, + void* exc); + friend const char* + ::_txnal_cow_string_c_str(const void *that); + friend void + ::_txnal_cow_string_D1(void *that); + friend void + ::_txnal_cow_string_D1_commit(void *that); +# endif }; #endif // !_GLIBCXX_USE_CXX11_ABI diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index 6b13f5c..387a7bb 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -481,6 +481,22 @@ namespace std # define _GLIBCXX_BEGIN_EXTERN_C extern "C" { # define _GLIBCXX_END_EXTERN_C } +#define _GLIBCXX_USE_ALLOCATOR_NEW + +// Conditionally enable annotations for the Transactional Memory TS on C++11. +// Most of the following conditions are due to limitations in the current +// implementation. +#if __cplusplus >= 201103L && _GLIBCXX_USE_CXX11_ABI \ + && _GLIBCXX_USE_DUAL_ABI && __cpp_transactional_memory >= 201505L \ + && !_GLIBCXX_FULLY_DYNAMIC_STRING && __GXX_WEAK__ \ + && _GLIBCXX_USE_ALLOCATOR_NEW +#define _GLIBCXX_TXN_SAFE transaction_safe +#define _GLIBCXX_TXN_SAFE_DYN transaction_safe_dynamic +#else +#define _GLIBCXX_TXN_SAFE +#define _GLIBCXX_TXN_SAFE_DYN +#endif + #else // !__cplusplus # define _GLIBCXX_BEGIN_EXTERN_C # define _GLIBCXX_END_EXTERN_C diff --git a/libstdc++-v3/include/std/stdexcept b/libstdc++-v3/include/std/stdexcept index 9983501..aef27cc 100644 --- a/libstdc++-v3/include/std/stdexcept +++ b/libstdc++-v3/include/std/stdexcept @@ -117,11 +117,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: /** Takes a character string describing the error. */ explicit - logic_error(const string& __arg); + logic_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit - logic_error(const char*); + logic_error(const char*) _GLIBCXX_TXN_SAFE; #endif #if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS @@ -129,12 +129,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION logic_error& operator=(const logic_error&) _GLIBCXX_USE_NOEXCEPT; #endif - virtual ~logic_error() _GLIBCXX_USE_NOEXCEPT; + virtual ~logic_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; /** Returns a C-style character string describing the general cause of * the current error (the same string passed to the ctor). */ virtual const char* - what() const _GLIBCXX_USE_NOEXCEPT; + what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; + +# ifdef _GLIBCXX_TM_TS_INTERNAL + friend void* + ::_txnal_logic_error_get_msg(void* e); +# endif }; /** Thrown by the library, or by you, to report domain errors (domain in @@ -142,9 +147,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class domain_error : public logic_error { public: - explicit domain_error(const string& __arg); + explicit domain_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L - explicit domain_error(const char*); + explicit domain_error(const char*) _GLIBCXX_TXN_SAFE; #endif virtual ~domain_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -153,9 +158,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class invalid_argument : public logic_error { public: - explicit invalid_argument(const string& __arg); + explicit invalid_argument(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L - explicit invalid_argument(const char*); + explicit invalid_argument(const char*) _GLIBCXX_TXN_SAFE; #endif virtual ~invalid_argument() _GLIBCXX_USE_NOEXCEPT; }; @@ -165,9 +170,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class length_error : public logic_error { public: - explicit length_error(const string& __arg); + explicit length_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L - explicit length_error(const char*); + explicit length_error(const char*) _GLIBCXX_TXN_SAFE; #endif virtual ~length_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -177,9 +182,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class out_of_range : public logic_error { public: - explicit out_of_range(const string& __arg); + explicit out_of_range(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L - explicit out_of_range(const char*); + explicit out_of_range(const char*) _GLIBCXX_TXN_SAFE; #endif virtual ~out_of_range() _GLIBCXX_USE_NOEXCEPT; }; @@ -196,11 +201,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: /** Takes a character string describing the error. */ explicit - runtime_error(const string& __arg); + runtime_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L explicit - runtime_error(const char*); + runtime_error(const char*) _GLIBCXX_TXN_SAFE; #endif #if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_DEFINE_STDEXCEPT_COPY_OPS @@ -208,21 +213,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION runtime_error& operator=(const runtime_error&) _GLIBCXX_USE_NOEXCEPT; #endif - virtual ~runtime_error() _GLIBCXX_USE_NOEXCEPT; + virtual ~runtime_error() _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; /** Returns a C-style character string describing the general cause of * the current error (the same string passed to the ctor). */ virtual const char* - what() const _GLIBCXX_USE_NOEXCEPT; + what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT; + +# ifdef _GLIBCXX_TM_TS_INTERNAL + friend void* + ::_txnal_runtime_error_get_msg(void* e); +# endif }; /** Thrown to indicate range errors in internal computations. */ class range_error : public runtime_error { public: - explicit range_error(const string& __arg); + explicit range_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L - explicit range_error(const char*); + explicit range_error(const char*) _GLIBCXX_TXN_SAFE; #endif virtual ~range_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -231,9 +241,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class overflow_error : public runtime_error { public: - explicit overflow_error(const string& __arg); + explicit overflow_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L - explicit overflow_error(const char*); + explicit overflow_error(const char*) _GLIBCXX_TXN_SAFE; #endif virtual ~overflow_error() _GLIBCXX_USE_NOEXCEPT; }; @@ -242,9 +252,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class underflow_error : public runtime_error { public: - explicit underflow_error(const string& __arg); + explicit underflow_error(const string& __arg) _GLIBCXX_TXN_SAFE; #if __cplusplus >= 201103L - explicit underflow_error(const char*); + explicit underflow_error(const char*) _GLIBCXX_TXN_SAFE; #endif virtual ~underflow_error() _GLIBCXX_USE_NOEXCEPT; }; |