[libcxx-commits] [libcxx] [libc++] Only include the system <stdint.h> and <locale.h> if they exist (PR #115017)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 5 08:08:44 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
Prior to aa7f377c96, we only did an #include_next of those system headers if they existed. After removing those headers from libc++, we started assuming that the system provided the headers because we unconditionally started including them. This patch fixes that.
---
Full diff: https://github.com/llvm/llvm-project/pull/115017.diff
2 Files Affected:
- (modified) libcxx/include/clocale (+3-1)
- (modified) libcxx/include/cstdint (+3-1)
``````````diff
diff --git a/libcxx/include/clocale b/libcxx/include/clocale
index 4d53aa7eb29b29..a82a166712c26e 100644
--- a/libcxx/include/clocale
+++ b/libcxx/include/clocale
@@ -36,7 +36,9 @@ lconv* localeconv();
#include <__config>
-#include <locale.h>
+#if __has_include(<locale.h>)
+# include <locale.h>
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/cstdint b/libcxx/include/cstdint
index 9c9b2323d06ea9..b3167c33f24778 100644
--- a/libcxx/include/cstdint
+++ b/libcxx/include/cstdint
@@ -142,7 +142,9 @@ Types:
#include <__config>
-#include <stdint.h>
+#if __has_include(<stdint.h>)
+# include <stdint.h>
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
``````````
</details>
https://github.com/llvm/llvm-project/pull/115017
More information about the libcxx-commits
mailing list