]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Remove <random> dependency on _GLIBCXX_USE_C99_STDINT_TR1
authorJonathan Wakely <jwakely@redhat.com>
Fri, 12 May 2023 12:55:17 +0000 (13:55 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 12 May 2023 16:46:28 +0000 (17:46 +0100)
Since r9-2028-g8ba7f29e3dd064 we've defined most of <cstdint>
unconditionally, including uint_least32_t. This means that all of
<random> can be defined unconditionally, which means that std::shuffle
and std::ranges::shuffle can be too.

libstdc++-v3/ChangeLog:

* include/bits/algorithmfwd.h (shuffle): Do not depend on
_GLIBCXX_USE_C99_STDINT_TR1.
* include/bits/ranges_algo.h (shuffle): Likewise.
* include/bits/stl_algo.h (shuffle): Likewise.
* include/ext/random: Likewise.
* include/ext/throw_allocator.h (random_condition): Likewise.
* include/std/random: Likewise.
* src/c++11/cow-string-inst.cc: Likewise.
* src/c++11/random.cc: Likewise.

libstdc++-v3/include/bits/algorithmfwd.h
libstdc++-v3/include/bits/ranges_algo.h
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/include/ext/random
libstdc++-v3/include/ext/throw_allocator.h
libstdc++-v3/include/std/random
libstdc++-v3/src/c++11/cow-string-inst.cc
libstdc++-v3/src/c++11/random.cc

index 03e627866ad1eda2ab711f0134728c5cfcb33620..0d623901cd2db121472410965970abe1346406ab 100644 (file)
@@ -622,7 +622,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
   // set_symmetric_difference
   // set_union
 
-#if (__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99_STDINT_TR1)
+#if __cplusplus >= 201103L
   template<typename _RAIter, typename _UGenerator>
     void
     shuffle(_RAIter, _RAIter, _UGenerator&&);
index 410d3ae1dd8210460fdfa24d59762abfcd5116ac..da66ff8045d90f21f5d7871c7e17a880d1c83582 100644 (file)
@@ -1564,7 +1564,6 @@ namespace ranges
 
   inline constexpr __sample_fn sample{};
 
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
   struct __shuffle_fn
   {
     template<random_access_iterator _Iter, sentinel_for<_Iter> _Sent,
@@ -1591,7 +1590,6 @@ namespace ranges
   };
 
   inline constexpr __shuffle_fn shuffle{};
-#endif
 
   struct __push_heap_fn
   {
index 3d37091a9b4bc4c719316a903750fca43e93eaf9..5469549016688bf7abd864fb64b42e418753bc97 100644 (file)
@@ -3692,7 +3692,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
 #endif // C++17
 #endif // C++14
 
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
   /**
    *  @brief Generate two uniformly distributed integers using a
    *         single distribution invocation.
@@ -3803,8 +3802,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2)
       for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)
        std::iter_swap(__i, __first + __d(__g, __p_type(0, __i - __first)));
     }
-#endif // USE C99_STDINT
-
 #endif // C++11
 
 _GLIBCXX_BEGIN_NAMESPACE_ALGO
index 795c3c5389aef58bb051a4e2e2e178ad4b452d32..62acb67e05b04c703c543d4e9f9c30cef18a0780 100644 (file)
@@ -45,7 +45,7 @@
 # include <emmintrin.h>
 #endif
 
-#if defined(_GLIBCXX_USE_C99_STDINT_TR1) && defined(UINT32_C)
+#ifdef UINT32_C
 
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 {
@@ -3923,7 +3923,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
 #include <ext/opt_random.h>
 #include <ext/random.tcc>
 
-#endif // _GLIBCXX_USE_C99_STDINT_TR1 && UINT32_C
+#endif // UINT32_C
 
 #endif // C++11
 
index 0dbf00176dc120cf5e98a01461ce302c5e25713b..71b7198fa1e56c9a5f5f7b1f64ec317e08a8559c 100644 (file)
@@ -495,7 +495,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
   };
 
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
   /**
    *  @brief Base class for random probability control and throw.
    */
@@ -613,7 +612,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return _S_e;
     }
   };
-#endif // _GLIBCXX_USE_C99_STDINT_TR1
 
   /**
    *  @brief Class with exception generation control. Intended to be
@@ -769,7 +767,6 @@ _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>
   {
@@ -800,7 +797,6 @@ _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.
@@ -947,7 +943,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
     };
 
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
   /// Allocator throwing via random condition.
   template<typename _Tp>
     struct throw_allocator_random
@@ -973,7 +968,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       operator=(const throw_allocator_random&) = default;
 #endif
     };
-#endif // _GLIBCXX_USE_C99_STDINT_TR1
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
@@ -1002,7 +996,6 @@ 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>
@@ -1017,7 +1010,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
        return __result;
       }
     };
-#endif
 
 #pragma GCC diagnostic pop
 } // end namespace std
index e6591bc48a76f23d563933350658cabbbd21c299..a0785a46019d30755c438a0c168981ba6225990a 100644 (file)
 #else
 
 #include <cmath>
+#include <cstdint> // For uint_fast32_t, uint_fast64_t, uint_least32_t
 #include <cstdlib>
 #include <string>
 #include <iosfwd>
 #include <limits>
 #include <debug/debug.h>
 #include <type_traits>
-
-#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-
-#include <cstdint> // For uint_fast32_t, uint_fast64_t, uint_least32_t
 #include <bits/random.h>
 #include <bits/opt_random.h>
 #include <bits/random.tcc>
 
-#endif // _GLIBCXX_USE_C99_STDINT_TR1
-
 #endif // C++11
 
 #endif // _GLIBCXX_RANDOM
index c6b3a2cce1e1479a35c8b33cdeacb909b58e9f85..5a2b8ffa5689f3f4dda82f126fa25f8f88653a02 100644 (file)
@@ -33,7 +33,6 @@
 # error This file should not be compiled for this configuration.
 #endif
 
-#ifdef  _GLIBCXX_USE_C99_STDINT_TR1
 #include <random>
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -46,4 +45,3 @@ namespace std _GLIBCXX_VISIBILITY(default)
   random_device::_M_init_pretr1(const std::string& token)
   { _M_init(token.c_str(), token.length()); }
 } // namespace
-#endif
index daf934808cc007d44e440af6cb0c367d1cb42e67..6ecdc7169ab516c0fe4105bd7230a119aed6b566 100644 (file)
@@ -28,8 +28,6 @@
 #include <random>
 #include <system_error>
 
-#ifdef  _GLIBCXX_USE_C99_STDINT_TR1
-
 #if defined __i386__ || defined __x86_64__
 # include <cpuid.h>
 # ifdef _GLIBCXX_X86_RDRAND
@@ -674,4 +672,3 @@ namespace std _GLIBCXX_VISIBILITY(default)
   template struct __detail::_Mod<unsigned, 2147483647UL, 16807UL, 0UL>;
 #endif
 }
-#endif // _GLIBCXX_USE_C99_STDINT_TR1