This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54451] c++11/random.cc build failure when _GLIBCXX_USE_C99_STDINT_TR1 is not defined in config.h
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 09 Sep 2012 11:50:18 +0000
- Subject: [Bug libstdc++/54451] c++11/random.cc build failure when _GLIBCXX_USE_C99_STDINT_TR1 is not defined in config.h
- Auto-submitted: auto-generated
- References: <bug-54451-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54451
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-09-09
Ever Confirmed|0 |1
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-09-09 11:50:18 UTC ---
(In reply to comment #0)
> Commenting out '#ifdef _GLIBCXX_USE_C99_STDINT_TR1' fixed build problem, but
> I'm not sure that it is correct solution.
It's not.
(In reply to comment #1)
> etc. Those are the only uses of it in code that I can find.
It's used in many more headers.
> It seems like it
> isn't exactly the best name for the define (it no longer just applies to TR1),
> but it doesn't do too much. I can't think of a case where this would not be
> desired behavior (I don't remember, but I *think* that the C++ standard says
> that those typenames should be in the standard namespace).
But the C standard requires <stdint.h> and if the OS doesn't provide that we
can't provide a useful <cstdint>.
> Anyway, it doesn't appear like removing that code will have any adverse
> effects.
It would completely break libstdc++ on platforms without <stdint.h>, such as
djgpp
The fix is simply to check for the macro in random.cc
index 50b5359..1d0723d 100644
--- a/libstdc++-v3/src/c++11/random.cc
+++ b/libstdc++-v3/src/c++11/random.cc
@@ -24,6 +24,8 @@
#include <random>
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+
#if defined __i386__ || defined __x86_64__
# include <cpuid.h>
#endif
@@ -142,5 +144,5 @@ namespace std _GLIBCXX_VISIBILITY(default)
0xffffffffUL, 7,
0x9d2c5680UL, 15,
0xefc60000UL, 18, 1812433253UL>;
-
}
+#endif