[libcxx-commits] [libcxx] [libc++] Don't rely on a transitively included BYTE_ORDER in ctype_base (PR #213032)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 07:27:57 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

Use libc++'s own _LIBCPP_BIG_ENDIAN macro instead of BYTE_ORDER, which was relied upon from a transitive <endian.h> include on Glibc.

---
Full diff: https://github.com/llvm/llvm-project/pull/213032.diff


1 Files Affected:

- (modified) libcxx/include/__locale (+2-1) 


``````````diff
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index 28bc17f8368a6..f6458d80fbbdc 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -12,6 +12,7 @@
 
 #include <__config>
 #include <__configuration/availability.h>
+#include <__configuration/platform.h>
 
 #if _LIBCPP_HAS_LOCALIZATION
 
@@ -345,7 +346,7 @@ public:
   static const mask xdigit = _ISxdigit;
   static const mask blank  = _ISblank;
   _LIBCPP_DIAGNOSTIC_POP
-#    if defined(__mips__) || (BYTE_ORDER == BIG_ENDIAN)
+#    if defined(__mips__) || defined(_LIBCPP_BIG_ENDIAN)
   static const mask __regex_word = static_cast<mask>(_ISbit(15));
 #    else
   static const mask __regex_word = 0x80;

``````````

</details>


https://github.com/llvm/llvm-project/pull/213032


More information about the libcxx-commits mailing list