* [committed] libstdc++: Fix <bit> to work freestanding [PR 100060]
@ 2021-04-13 16:54 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-04-13 16:54 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 238 bytes --]
libstdc++-v3/ChangeLog:
PR libstdc++/100060
* include/std/bit: Only include <ext/numeric_traits.h> for
hosted build, use <limits> otherwise.
Tested powerpc64le-linux. Committed to trunk.
This needs to be backported to gcc-10 too.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1078 bytes --]
commit 474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Apr 13 16:55:37 2021
libstdc++: Fix <bit> to work freestanding [PR 100060]
libstdc++-v3/ChangeLog:
PR libstdc++/100060
* include/std/bit: Only include <ext/numeric_traits.h> for
hosted build, use <limits> otherwise.
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index fb78578448c..c5aae8bab03 100644
--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -34,7 +34,23 @@
#if __cplusplus >= 201402L
#include <type_traits>
-#include <ext/numeric_traits.h>
+
+#if _GLIBCXX_HOSTED
+# include <ext/numeric_traits.h>
+#else
+# include <limits>
+/// @cond undocumented
+namespace __gnu_cxx
+{
+ template<typename _Tp>
+ struct __int_traits
+ {
+ static constexpr int __digits = std::numeric_limits<_Tp>::digits;
+ static constexpr _Tp __max = std::numeric_limits<_Tp>::max();
+ };
+}
+/// @endcond
+#endif
namespace std _GLIBCXX_VISIBILITY(default)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-13 16:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13 16:54 [committed] libstdc++: Fix <bit> to work freestanding [PR 100060] Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).