public inbox for libstdc++-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 r12-6665] libstdc++: Use GCC's predefined macro for endianness [PR104080]
Date: Tue, 18 Jan 2022 10:04:04 +0000 (GMT)	[thread overview]
Message-ID: <20220118100404.A3AFB3858D39@sourceware.org> (raw)

https://gcc.gnu.org/g:8f6b62e0f0c99e421d07bf1847259744db22924b

commit r12-6665-g8f6b62e0f0c99e421d07bf1847259744db22924b
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Jan 18 10:01:23 2022 +0000

    libstdc++: Use GCC's predefined macro for endianness [PR104080]
    
    Instead of hardcoded preprocessor conditionals with explicit target
    checks, just rely on the fact that __BYTE_ORDER__ is always defined by
    GCC.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/104080
            * src/c++17/fast_float/LOCAL_PATCHES: Update.
            * src/c++17/fast_float/fast_float.h (FASTFLOAT_IS_BIG_ENDIAN):
            Define in terms of __BYTE_ORDER__.

Diff:
---
 libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES | 1 +
 libstdc++-v3/src/c++17/fast_float/fast_float.h  | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES b/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES
index 447c7ed2cdb..5bb42933398 100644
--- a/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES
+++ b/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES
@@ -1,3 +1,4 @@
 r12-6647
 r12-6648
 r12-6664
+r12-6665
diff --git a/libstdc++-v3/src/c++17/fast_float/fast_float.h b/libstdc++-v3/src/c++17/fast_float/fast_float.h
index ee129309ba3..31fb88b8aba 100644
--- a/libstdc++-v3/src/c++17/fast_float/fast_float.h
+++ b/libstdc++-v3/src/c++17/fast_float/fast_float.h
@@ -128,7 +128,9 @@ from_chars_result from_chars_advanced(const char *first, const char *last,
 #define FASTFLOAT_VISUAL_STUDIO 1
 #endif
 
-#ifdef _WIN32
+#ifdef __BYTE_ORDER__
+#define FASTFLOAT_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#elif defined _WIN32
 #define FASTFLOAT_IS_BIG_ENDIAN 0
 #else
 #if defined(__APPLE__) || defined(__FreeBSD__)


                 reply	other threads:[~2022-01-18 10:04 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=20220118100404.A3AFB3858D39@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).