[libcxx-commits] [libcxx] 6747298 - Revert "[libc++] Only include_next C library headers when they exist"

Nico Weber via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 15 08:35:21 PST 2022


Author: Nico Weber
Date: 2022-11-15T11:35:00-05:00
New Revision: 674729813e3be02af7bda02cfe577398763f58b9

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

LOG: Revert "[libc++] Only include_next C library headers when they exist"

This reverts commit 226409c62879bf5ff9928cd23a4255cd7c614fe0.
Breaks check-clang on mac, see comments on https://reviews.llvm.org/D136683

Added: 
    

Modified: 
    libcxx/include/complex.h
    libcxx/include/ctype.h
    libcxx/include/errno.h
    libcxx/include/fenv.h
    libcxx/include/float.h
    libcxx/include/inttypes.h
    libcxx/include/limits.h
    libcxx/include/locale.h
    libcxx/include/math.h
    libcxx/include/setjmp.h
    libcxx/include/stdbool.h
    libcxx/include/stddef.h
    libcxx/include/stdint.h
    libcxx/include/stdio.h
    libcxx/include/stdlib.h
    libcxx/include/string.h
    libcxx/include/tgmath.h
    libcxx/include/wchar.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/complex.h b/libcxx/include/complex.h
index a3da21c843f3..a2814669c7d4 100644
--- a/libcxx/include/complex.h
+++ b/libcxx/include/complex.h
@@ -24,9 +24,13 @@
 #endif
 
 #ifdef __cplusplus
-#  include <ccomplex>
-#elif __has_include_next(<complex.h>)
-#  include_next <complex.h>
-#endif
+
+#include <ccomplex>
+
+#else  // __cplusplus
+
+#include_next <complex.h>
+
+#endif // __cplusplus
 
 #endif // _LIBCPP_COMPLEX_H

diff  --git a/libcxx/include/ctype.h b/libcxx/include/ctype.h
index 728173ed670f..ba0925069c64 100644
--- a/libcxx/include/ctype.h
+++ b/libcxx/include/ctype.h
@@ -35,9 +35,7 @@ int toupper(int c);
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<ctype.h>)
-#  include_next <ctype.h>
-#endif
+#include_next <ctype.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/errno.h b/libcxx/include/errno.h
index 7b02d2b47953..ea0559f0f5d1 100644
--- a/libcxx/include/errno.h
+++ b/libcxx/include/errno.h
@@ -28,9 +28,7 @@
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<errno.h>)
-#  include_next <errno.h>
-#endif
+#include_next <errno.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/fenv.h b/libcxx/include/fenv.h
index 15e41568cbf7..a9ba6800245b 100644
--- a/libcxx/include/fenv.h
+++ b/libcxx/include/fenv.h
@@ -56,9 +56,7 @@ int feupdateenv(const fenv_t* envp);
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<fenv.h>)
-#  include_next <fenv.h>
-#endif
+#include_next <fenv.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/float.h b/libcxx/include/float.h
index 9e5f711fab83..606081251dfb 100644
--- a/libcxx/include/float.h
+++ b/libcxx/include/float.h
@@ -76,9 +76,7 @@
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<float.h>)
-#  include_next <float.h>
-#endif
+#include_next <float.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/inttypes.h b/libcxx/include/inttypes.h
index b755526b8492..e0fd71f9b65d 100644
--- a/libcxx/include/inttypes.h
+++ b/libcxx/include/inttypes.h
@@ -248,9 +248,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
 #   define __STDC_FORMAT_MACROS
 #endif
 
-#if __has_include_next(<inttypes.h>)
-#  include_next <inttypes.h>
-#endif
+#include_next <inttypes.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/limits.h b/libcxx/include/limits.h
index 032a90967d0c..3e1e85a8a0b4 100644
--- a/libcxx/include/limits.h
+++ b/libcxx/include/limits.h
@@ -44,11 +44,7 @@
 #endif
 
 #ifndef __GNUC__
-
-#  if __has_include_next(<limits.h>)
-#    include_next <limits.h>
-#  endif
-
+#include_next <limits.h>
 #else
 // GCC header limits.h recursively includes itself through another header called
 // syslimits.h for some reason. This setup breaks down if we directly

diff  --git a/libcxx/include/locale.h b/libcxx/include/locale.h
index 3fb812035a52..17c0a705a009 100644
--- a/libcxx/include/locale.h
+++ b/libcxx/include/locale.h
@@ -43,8 +43,6 @@
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<locale.h>)
-#  include_next <locale.h>
-#endif
+#include_next <locale.h>
 
 #endif // _LIBCPP_LOCALE_H

diff  --git a/libcxx/include/math.h b/libcxx/include/math.h
index d60943086036..d5a7095a596a 100644
--- a/libcxx/include/math.h
+++ b/libcxx/include/math.h
@@ -297,9 +297,7 @@ long double    truncl(long double x);
 #  pragma GCC system_header
 #endif
 
-#  if __has_include_next(<math.h>)
-#    include_next <math.h>
-#  endif
+#include_next <math.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/setjmp.h b/libcxx/include/setjmp.h
index f4a2bbcb0bd3..de4f9edf4886 100644
--- a/libcxx/include/setjmp.h
+++ b/libcxx/include/setjmp.h
@@ -31,9 +31,7 @@ void longjmp(jmp_buf env, int val);
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<setjmp.h>)
-#  include_next <setjmp.h>
-#endif
+#include_next <setjmp.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/stdbool.h b/libcxx/include/stdbool.h
index 5bba00568dff..0bc1aa8304ad 100644
--- a/libcxx/include/stdbool.h
+++ b/libcxx/include/stdbool.h
@@ -24,9 +24,7 @@
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<stdbool.h>)
-#  include_next <stdbool.h>
-#endif
+#include_next <stdbool.h>
 
 #ifdef __cplusplus
 #undef bool

diff  --git a/libcxx/include/stddef.h b/libcxx/include/stddef.h
index f1725db06212..19e344f2a000 100644
--- a/libcxx/include/stddef.h
+++ b/libcxx/include/stddef.h
@@ -42,9 +42,7 @@
 #  pragma GCC system_header
 #endif
 
-#  if __has_include_next(<stddef.h>)
-#    include_next <stddef.h>
-#  endif
+#include_next <stddef.h>
 
 #ifdef __cplusplus
     typedef decltype(nullptr) nullptr_t;

diff  --git a/libcxx/include/stdint.h b/libcxx/include/stdint.h
index fa7b011c71ae..ee71f62ab095 100644
--- a/libcxx/include/stdint.h
+++ b/libcxx/include/stdint.h
@@ -120,8 +120,6 @@
 #   define __STDC_CONSTANT_MACROS
 #endif
 
-#if __has_include_next(<stdint.h>)
-#  include_next <stdint.h>
-#endif
+#include_next <stdint.h>
 
 #endif // _LIBCPP_STDINT_H

diff  --git a/libcxx/include/stdio.h b/libcxx/include/stdio.h
index cea43aa7680b..ad1b4c05f1fa 100644
--- a/libcxx/include/stdio.h
+++ b/libcxx/include/stdio.h
@@ -104,9 +104,7 @@ void perror(const char* s);
 #  pragma GCC system_header
 #endif
 
-#  if __has_include_next(<stdio.h>)
-#    include_next <stdio.h>
-#  endif
+#include_next <stdio.h>
 
 #ifdef __cplusplus
 

diff  --git a/libcxx/include/stdlib.h b/libcxx/include/stdlib.h
index 64581b67f245..e4dce9c54546 100644
--- a/libcxx/include/stdlib.h
+++ b/libcxx/include/stdlib.h
@@ -90,9 +90,7 @@ void *aligned_alloc(size_t alignment, size_t size);                       // C11
 #  pragma GCC system_header
 #endif
 
-#  if __has_include_next(<stdlib.h>)
-#    include_next <stdlib.h>
-#  endif
+#include_next <stdlib.h>
 
 #ifdef __cplusplus
 extern "C++" {

diff  --git a/libcxx/include/string.h b/libcxx/include/string.h
index 627cbae781c1..082c632a29bc 100644
--- a/libcxx/include/string.h
+++ b/libcxx/include/string.h
@@ -57,9 +57,7 @@ size_t strlen(const char* s);
 #  pragma GCC system_header
 #endif
 
-#if __has_include_next(<string.h>)
-#  include_next <string.h>
-#endif
+#include_next <string.h>
 
 // MSVCRT, GNU libc and its derivates may already have the correct prototype in
 // <string.h>. This macro can be defined by users if their C library provides

diff  --git a/libcxx/include/tgmath.h b/libcxx/include/tgmath.h
index e6f0a4ab2611..c65091708a9a 100644
--- a/libcxx/include/tgmath.h
+++ b/libcxx/include/tgmath.h
@@ -24,11 +24,13 @@
 #endif
 
 #ifdef __cplusplus
-#  include <ctgmath>
-#else
-#  if __has_include_next(<tgmath.h>)
-#    include_next <tgmath.h>
-#  endif
-#endif
+
+#include <ctgmath>
+
+#else  // __cplusplus
+
+#include_next <tgmath.h>
+
+#endif // __cplusplus
 
 #endif // _LIBCPP_TGMATH_H

diff  --git a/libcxx/include/wchar.h b/libcxx/include/wchar.h
index c684508dc2cc..0fba53b268ae 100644
--- a/libcxx/include/wchar.h
+++ b/libcxx/include/wchar.h
@@ -120,9 +120,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
 #define __CORRECT_ISO_CPP_WCHAR_H_PROTO
 #endif
 
-#  if __has_include_next(<wchar.h>)
-#    include_next <wchar.h>
-#  endif
+#include_next <wchar.h>
 
 // Determine whether we have const-correct overloads for wcschr and friends.
 #if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)


        


More information about the libcxx-commits mailing list