From 54c674327fbe86c91211019a6d028ed8699bfaf3 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 26 Jul 2018 15:02:11 +0100 Subject: [PATCH] Add missing checks for _GLIBCXX_USE_C99_STDINT_TR1 The throw_allocator extension depends on which depends on _GLIBCXX_USE_C99_STDINT_TR1. The Transactional Memory support uses fixed-width integer types from . * include/ext/throw_allocator.h [!_GLIBCXX_USE_C99_STDINT_TR1] (random_condition, throw_value_random, throw_allocator_random) (std::hash): Do not define when is not usable. * src/c++11/cow-stdexcept.cc [!_GLIBCXX_USE_C99_STDINT_TR1]: Do not define transactional memory support when is not usable. From-SVN: r263004 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/ext/throw_allocator.h | 11 ++++++++--- libstdc++-v3/src/c++11/cow-stdexcept.cc | 2 ++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 66ee23d1fc7..285ea6b7dca 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2018-07-26 Jonathan Wakely + * include/ext/throw_allocator.h [!_GLIBCXX_USE_C99_STDINT_TR1] + (random_condition, throw_value_random, throw_allocator_random) + (std::hash): Do not define when is + not usable. + * src/c++11/cow-stdexcept.cc [!_GLIBCXX_USE_C99_STDINT_TR1]: Do not + define transactional memory support when is not usable. + * include/bits/hashtable_policy.h (__detail::__clp2): Use faster implementation that doesn't depend on types. * include/std/memory (align) [!_GLIBCXX_USE_C99_STDINT_TR1]: Use diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h index 7fd2ca149a0..dd7c692222e 100644 --- a/libstdc++-v3/include/ext/throw_allocator.h +++ b/libstdc++-v3/include/ext/throw_allocator.h @@ -482,7 +482,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } }; - +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Base class for random probability control and throw. */ @@ -596,7 +596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return _S_e; } }; - +#endif // _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Class with exception generation control. Intended to be @@ -752,6 +752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif }; +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// Type throwing via random condition. struct throw_value_random : public throw_value_base { @@ -782,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator=(throw_value_random&&) = default; #endif }; - +#endif // _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Allocator class with logging and exception generation control. @@ -920,6 +921,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { } }; +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// Allocator throwing via random condition. template struct throw_allocator_random @@ -940,6 +942,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { } }; +#endif // _GLIBCXX_USE_C99_STDINT_TR1 _GLIBCXX_END_NAMESPACE_VERSION } // namespace @@ -965,6 +968,7 @@ namespace std _GLIBCXX_VISIBILITY(default) } }; +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// Explicit specialization of std::hash for __gnu_cxx::throw_value_random. template<> struct hash<__gnu_cxx::throw_value_random> @@ -979,6 +983,7 @@ namespace std _GLIBCXX_VISIBILITY(default) return __result; } }; +#endif } // end namespace std #endif diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc index a2df7892fd4..54859d58820 100644 --- a/libstdc++-v3/src/c++11/cow-stdexcept.cc +++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc @@ -198,6 +198,7 @@ _GLIBCXX_END_NAMESPACE_VERSION // declared transaction-safe, so we just don't provide transactional clones // in this case. #if _GLIBCXX_USE_WEAK_REF +#ifdef _GLIBCXX_USE_C99_STDINT_TR1 extern "C" { @@ -456,4 +457,5 @@ CTORDTOR(15underflow_error, std::underflow_error, runtime_error) } +#endif // _GLIBCXX_USE_C99_STDINT_TR1 #endif // _GLIBCXX_USE_WEAK_REF -- 2.30.2