public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r10-9703] libstdc++: Fix <bit> to work freestanding [PR 100060]
Date: Tue, 13 Apr 2021 17:52:13 +0000 (GMT)	[thread overview]
Message-ID: <20210413175213.CCA723857832@sourceware.org> (raw)

https://gcc.gnu.org/g:d83dace65b97112320042c7f4941b64ef339799d

commit r10-9703-gd83dace65b97112320042c7f4941b64ef339799d
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Apr 13 16:55:37 2021 +0100

    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.
    
    (cherry picked from commit 474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b)

Diff:
---
 libstdc++-v3/include/std/bit | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index f22ee528555..2b24f0d450b 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)
 {


                 reply	other threads:[~2021-04-13 17:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210413175213.CCA723857832@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).