From: Jonathan Wakely <jwak...@redhat.com> The throw_allocator extension depends on <tr1/random> which depends on _GLIBCXX_USE_C99_STDINT_TR1.
The Transactional Memory support uses fixed-width integer types from <stdint.h>. * include/ext/throw_allocator.h [!_GLIBCXX_USE_C99_STDINT_TR1] (random_condition, throw_value_random, throw_allocator_random) (std::hash<throw_value_random>): Do not define when <tr1/random> is not usable. * src/c++11/cow-stdexcept.cc [!_GLIBCXX_USE_C99_STDINT_TR1]: Do not define transactional memory support when <stdint.h> is not usable. 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 <jwak...@redhat.com> + * include/ext/throw_allocator.h [!_GLIBCXX_USE_C99_STDINT_TR1] + (random_condition, throw_value_random, throw_allocator_random) + (std::hash<throw_value_random>): Do not define when <tr1/random> is + not usable. + * src/c++11/cow-stdexcept.cc [!_GLIBCXX_USE_C99_STDINT_TR1]: Do not + define transactional memory support when <stdint.h> is not usable. + * include/bits/hashtable_policy.h (__detail::__clp2): Use faster implementation that doesn't depend on <stdint.h> 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<random_condition> { @@ -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<typename _Tp> 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.14.4