[libcxx-commits] [libcxx] [libc] Do not include `langinfo.h` when using the LLVM C library (PR #106634)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 29 14:24:57 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
The `langinfo.h` header is a POSIX extension, so ideally we would be
able to build the C++ library without it. Currently the LLVM C library
doesn't support / provide it. This allows us to build the C++ library
with locales enabled. We can either disable it here, or just provide
stubs that do nothing as in https://github.com/llvm/llvm-project/pull/106620.


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


1 Files Affected:

- (modified) libcxx/src/locale.cpp (+2-1) 


``````````diff
diff --git a/libcxx/src/locale.cpp b/libcxx/src/locale.cpp
index 4efdc63c096611..06c4f414ed9fa9 100644
--- a/libcxx/src/locale.cpp
+++ b/libcxx/src/locale.cpp
@@ -34,7 +34,8 @@
 #  define _CTYPE_DISABLE_MACROS
 #endif
 
-#if !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) && !defined(__BIONIC__) && !defined(__NuttX__)
+#if !defined(_LIBCPP_MSVCRT) && !defined(__MINGW32__) && !defined(__BIONIC__) && !defined(__NuttX__) ||                \
+    defined(__LLVM_LIBC__)
 #  include <langinfo.h>
 #endif
 

``````````

</details>


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


More information about the libcxx-commits mailing list