[committed] libstdc++: Reduce <atomic> dependency on _GLIBCXX_USE_C99_STDINT_TR1

Message ID 20230512164843.1303299-1-jwakely@redhat.com
State Accepted
Headers
Series [committed] libstdc++: Reduce <atomic> dependency on _GLIBCXX_USE_C99_STDINT_TR1 |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Jonathan Wakely May 12, 2023, 4:48 p.m. UTC
  Tested powerpc64le-linux. Pushed to trunk.

-- >8 --

Since r9-2028-g8ba7f29e3dd064 we've defined most of <cstdint>
unconditionally, so we can do the same for most of the std::atomic
aliases such as std::atomic_int_least32_t.

The only aliases that need to depend on _GLIBCXX_USE_C99_STDINT_TR1 are
the ones for the integer types that are not guaranteed to be defined,
e.g. std::atomic_int32_t.

libstdc++-v3/ChangeLog:

	* include/std/atomic (atomic_int_least8_t, atomic_uint_least8_t)
	(atomic_int_least16_t, atomic_uint_least16_t)
	(atomic_int_least32_t, atomic_uint_least32_t)
	(atomic_int_least64_t, atomic_uint_least64_t)
	(atomic_int_fast16_t, atomic_uint_fast16_t)
	(atomic_int_fast32_t, atomic_uint_fast32_t)
	(atomic_int_fast64_t, atomic_uint_fast64_t)
	(atomic_intmax_t, atomic_uintmax_t): Define unconditionally.
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Adjust.
---
 libstdc++-v3/include/std/atomic                              | 5 +----
 .../testsuite/29_atomics/headers/stdatomic.h/c_compat.cc     | 4 +---
 2 files changed, 2 insertions(+), 7 deletions(-)
  

Patch

diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 96e87ded864..b502027e4a4 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -1130,7 +1130,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// atomic_uint64_t
   typedef atomic<uint64_t>		atomic_uint64_t;
-
+#endif
 
   /// atomic_int_least8_t
   typedef atomic<int_least8_t>		atomic_int_least8_t;
@@ -1180,7 +1180,6 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// atomic_uint_fast64_t
   typedef atomic<uint_fast64_t>		atomic_uint_fast64_t;
-#endif
 
 
   /// atomic_intptr_t
@@ -1195,13 +1194,11 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
   /// atomic_ptrdiff_t
   typedef atomic<ptrdiff_t>		atomic_ptrdiff_t;
 
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
   /// atomic_intmax_t
   typedef atomic<intmax_t>		atomic_intmax_t;
 
   /// atomic_uintmax_t
   typedef atomic<uintmax_t>		atomic_uintmax_t;
-#endif
 
   // Function definitions, atomic_flag operations.
   inline bool
diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc
index edf19960cbb..8dd7054a997 100644
--- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc
+++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc
@@ -79,6 +79,7 @@  static_assert(is_same<atomic_int32_t,  _Atomic(int32_t)>);
 static_assert(is_same<atomic_uint32_t, _Atomic(uint32_t)>);
 static_assert(is_same<atomic_int64_t,  _Atomic(int64_t)>);
 static_assert(is_same<atomic_uint64_t, _Atomic(uint64_t)>);
+#endif
 static_assert(is_same<atomic_int_least8_t,   _Atomic(int_least8_t)>);
 static_assert(is_same<atomic_uint_least8_t,  _Atomic(uint_least8_t)>);
 static_assert(is_same<atomic_int_least16_t,  _Atomic(int_least16_t)>);
@@ -95,13 +96,10 @@  static_assert(is_same<atomic_int_fast32_t,  _Atomic(int_fast32_t)>);
 static_assert(is_same<atomic_uint_fast32_t, _Atomic(uint_fast32_t)>);
 static_assert(is_same<atomic_int_fast64_t,  _Atomic(int_fast64_t)>);
 static_assert(is_same<atomic_uint_fast64_t, _Atomic(uint_fast64_t)>);
-#endif
 static_assert(is_same<atomic_intptr_t,  _Atomic(intptr_t)>);
 static_assert(is_same<atomic_uintptr_t, _Atomic(uintptr_t)>);
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
 static_assert(is_same<atomic_intmax_t,  _Atomic(intmax_t)>);
 static_assert(is_same<atomic_uintmax_t, _Atomic(uintmax_t)>);
-#endif
 #include <stddef.h>
 static_assert(is_same<atomic_size_t,    _Atomic(size_t)>);
 static_assert(is_same<atomic_ptrdiff_t, _Atomic(ptrdiff_t)>);