This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PR libstdc++/54576: random_device isn't protected by _GLIBCXX_USE_C99_STDINT_TR1


Hi,

include/random has

#ifdef _GLIBCXX_USE_C99_STDINT_TR1

#include <cstdint> // For uint_fast32_t, uint_fast64_t, uint_least32_t
#include <bits/random.h>
#include <bits/random.tcc>

#endif // _GLIBCXX_USE_C99_STDINT_TR1

random_device is defined in <bits/random.h>. But src/c++11/random.cc
has

#include <random>
...
  void
  random_device::_M_init(const std::string& token)
  {

It doesn't check if _GLIBCXX_USE_C99_STDINT_TR1 is defined.  This
patch checks it.  OK to install?

Thanks.


H.J.
--
2012-09-13  H.J. Lu  <hongjiu.lu@intel.com>

	PR libstdc++/54576
	* libstdc++-v3/src/c++11/random.cc: Check if
	_GLIBCXX_USE_C99_STDINT_TR1 is defined.

diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc
index 4342df4..bb51fba 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -24,6 +24,7 @@
 
 #include <random>
 
+#ifdef  _GLIBCXX_USE_C99_STDINT_TR1
 #if defined __i386__ || defined __x86_64__
 # include <cpuid.h>
 #endif
@@ -144,3 +145,4 @@ namespace std _GLIBCXX_VISIBILITY(default)
     0xefc60000UL, 18, 1812433253UL>;
 
 }
+#endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]