Commit 54c67432 by Jonathan Wakely Committed by Jonathan Wakely

Add missing checks for _GLIBCXX_USE_C99_STDINT_TR1

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.

From-SVN: r263004
parent 4957b284
2018-07-26 Jonathan Wakely <jwakely@redhat.com> 2018-07-26 Jonathan Wakely <jwakely@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 * include/bits/hashtable_policy.h (__detail::__clp2): Use faster
implementation that doesn't depend on <stdint.h> types. implementation that doesn't depend on <stdint.h> types.
* include/std/memory (align) [!_GLIBCXX_USE_C99_STDINT_TR1]: Use * include/std/memory (align) [!_GLIBCXX_USE_C99_STDINT_TR1]: Use
......
...@@ -482,7 +482,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -482,7 +482,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
}; };
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
/** /**
* @brief Base class for random probability control and throw. * @brief Base class for random probability control and throw.
*/ */
...@@ -596,7 +596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -596,7 +596,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return _S_e; return _S_e;
} }
}; };
#endif // _GLIBCXX_USE_C99_STDINT_TR1
/** /**
* @brief Class with exception generation control. Intended to be * @brief Class with exception generation control. Intended to be
...@@ -752,6 +752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -752,6 +752,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
}; };
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
/// Type throwing via random condition. /// Type throwing via random condition.
struct throw_value_random : public throw_value_base<random_condition> struct throw_value_random : public throw_value_base<random_condition>
{ {
...@@ -782,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -782,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator=(throw_value_random&&) = default; operator=(throw_value_random&&) = default;
#endif #endif
}; };
#endif // _GLIBCXX_USE_C99_STDINT_TR1
/** /**
* @brief Allocator class with logging and exception generation control. * @brief Allocator class with logging and exception generation control.
...@@ -920,6 +921,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -920,6 +921,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { } ~throw_allocator_limit() _GLIBCXX_USE_NOEXCEPT { }
}; };
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
/// Allocator throwing via random condition. /// Allocator throwing via random condition.
template<typename _Tp> template<typename _Tp>
struct throw_allocator_random struct throw_allocator_random
...@@ -940,6 +942,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -940,6 +942,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { } ~throw_allocator_random() _GLIBCXX_USE_NOEXCEPT { }
}; };
#endif // _GLIBCXX_USE_C99_STDINT_TR1
_GLIBCXX_END_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION
} // namespace } // namespace
...@@ -965,6 +968,7 @@ namespace std _GLIBCXX_VISIBILITY(default) ...@@ -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. /// Explicit specialization of std::hash for __gnu_cxx::throw_value_random.
template<> template<>
struct hash<__gnu_cxx::throw_value_random> struct hash<__gnu_cxx::throw_value_random>
...@@ -979,6 +983,7 @@ namespace std _GLIBCXX_VISIBILITY(default) ...@@ -979,6 +983,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
return __result; return __result;
} }
}; };
#endif
} // end namespace std } // end namespace std
#endif #endif
......
...@@ -198,6 +198,7 @@ _GLIBCXX_END_NAMESPACE_VERSION ...@@ -198,6 +198,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
// declared transaction-safe, so we just don't provide transactional clones // declared transaction-safe, so we just don't provide transactional clones
// in this case. // in this case.
#if _GLIBCXX_USE_WEAK_REF #if _GLIBCXX_USE_WEAK_REF
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
extern "C" { extern "C" {
...@@ -456,4 +457,5 @@ CTORDTOR(15underflow_error, std::underflow_error, runtime_error) ...@@ -456,4 +457,5 @@ CTORDTOR(15underflow_error, std::underflow_error, runtime_error)
} }
#endif // _GLIBCXX_USE_C99_STDINT_TR1
#endif // _GLIBCXX_USE_WEAK_REF #endif // _GLIBCXX_USE_WEAK_REF
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment