[libcxx-commits] [PATCH] D158216: [libc++] Assume that __BYTE_ORDER__ is always present
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Sep 1 09:12:23 PDT 2023
This revision was automatically updated to reflect the committed changes.
philnik marked an inline comment as done.
Closed by commit rG0a97720d0197: [libc++] Assume that __BYTE_ORDER__ is always present (authored by philnik).
Changed prior to commit:
https://reviews.llvm.org/D158216?vs=551257&id=555410#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158216/new/
https://reviews.llvm.org/D158216
Files:
libcxx/include/__config
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -417,48 +417,19 @@
# include <features.h> // for __NATIVE_ASCII_F
# endif
-# ifdef __LITTLE_ENDIAN__
-# if __LITTLE_ENDIAN__
-# define _LIBCPP_LITTLE_ENDIAN
-# endif // __LITTLE_ENDIAN__
-# endif // __LITTLE_ENDIAN__
-
-# ifdef __BIG_ENDIAN__
-# if __BIG_ENDIAN__
-# define _LIBCPP_BIG_ENDIAN
-# endif // __BIG_ENDIAN__
-# endif // __BIG_ENDIAN__
-
-# ifdef __BYTE_ORDER__
-# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-# define _LIBCPP_LITTLE_ENDIAN
-# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-# define _LIBCPP_BIG_ENDIAN
-# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-# endif // __BYTE_ORDER__
+# ifndef __BYTE_ORDER__
+# error \
+ "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform"
+# endif
-# ifdef __FreeBSD__
-# include <osreldate.h>
-# include <sys/endian.h>
-# if _BYTE_ORDER == _LITTLE_ENDIAN
-# define _LIBCPP_LITTLE_ENDIAN
-# else // _BYTE_ORDER == _LITTLE_ENDIAN
-# define _LIBCPP_BIG_ENDIAN
-# endif // _BYTE_ORDER == _LITTLE_ENDIAN
-# endif // __FreeBSD__
-
-# if defined(__NetBSD__) || defined(__OpenBSD__)
-# include <sys/endian.h>
-# if _BYTE_ORDER == _LITTLE_ENDIAN
-# define _LIBCPP_LITTLE_ENDIAN
-# else // _BYTE_ORDER == _LITTLE_ENDIAN
-# define _LIBCPP_BIG_ENDIAN
-# endif // _BYTE_ORDER == _LITTLE_ENDIAN
-# endif // defined(__NetBSD__) || defined(__OpenBSD__)
+# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+# define _LIBCPP_LITTLE_ENDIAN
+# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+# define _LIBCPP_BIG_ENDIAN
+# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# if defined(_WIN32)
# define _LIBCPP_WIN32API
-# define _LIBCPP_LITTLE_ENDIAN
# define _LIBCPP_SHORT_WCHAR 1
// Both MinGW and native MSVC provide a "MSVC"-like environment
# define _LIBCPP_MSVCRT_LIKE
@@ -531,17 +502,6 @@
# define _LIBCPP_USING_DEV_RANDOM
# endif
-# if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
-# include <endian.h>
-# if __BYTE_ORDER == __LITTLE_ENDIAN
-# define _LIBCPP_LITTLE_ENDIAN
-# elif __BYTE_ORDER == __BIG_ENDIAN
-# define _LIBCPP_BIG_ENDIAN
-# else // __BYTE_ORDER == __BIG_ENDIAN
-# error unable to determine endian
-# endif
-# endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
-
# if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
# else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158216.555410.patch
Type: text/x-patch
Size: 2854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230901/3d857180/attachment.bin>
More information about the libcxx-commits
mailing list