[libcxx-commits] [libcxx] f1f5220 - [libc++] Only include the system <stdint.h> and <locale.h> if they exist (#115017)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 6 04:54:01 PST 2024


Author: Louis Dionne
Date: 2024-11-06T07:53:56-05:00
New Revision: f1f5220958eb02a7ca4aa21cb95df4746e91bc3b

URL: https://github.com/llvm/llvm-project/commit/f1f5220958eb02a7ca4aa21cb95df4746e91bc3b
DIFF: https://github.com/llvm/llvm-project/commit/f1f5220958eb02a7ca4aa21cb95df4746e91bc3b.diff

LOG: [libc++] Only include the system <stdint.h> and <locale.h> if they exist (#115017)

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.

Added: 
    

Modified: 
    libcxx/include/clocale
    libcxx/include/cstdint

Removed: 
    


################################################################################
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


        


More information about the libcxx-commits mailing list