[libcxx-commits] [libcxx] [libcxx] Include __llvm-libc-common.h if applicable (PR #156331)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 1 07:09:35 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: William Huynh (saturn691)

<details>
<summary>Changes</summary>

Currently on embedded platforms, `<features.h>` is not being included. We need at least one of the LLVM-libc headers to be included, to have access to the define `__LLVM_LIBC__`. Therefore, as a temporary solution until #<!-- -->147956 is merged, we include a check for the LLVM-libc common header library.

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


1 Files Affected:

- (modified) libcxx/include/__configuration/platform.h (+5) 


``````````diff
diff --git a/libcxx/include/__configuration/platform.h b/libcxx/include/__configuration/platform.h
index f3c199dee172b..cf7d9d965cf30 100644
--- a/libcxx/include/__configuration/platform.h
+++ b/libcxx/include/__configuration/platform.h
@@ -49,6 +49,11 @@
 #  include <picolibc.h>
 #endif
 
+// TODO: we should remove this once (#147956) is merged, for the same reason as listed above.
+#if __has_include(<__llvm-libc-common.h>)
+#  include <__llvm-libc-common.h>
+#endif
+
 #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"

``````````

</details>


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


More information about the libcxx-commits mailing list