Skip to content

Commit 6747298

Browse files
committed
Revert "[libc++] Only include_next C library headers when they exist"
This reverts commit 226409c. Breaks check-clang on mac, see comments on https://reviews.llvm.org/D136683
1 parent bf68a59 commit 6747298

File tree

18 files changed

+32
-60
lines changed

18 files changed

+32
-60
lines changed

libcxx/include/complex.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@
2424
#endif
2525

2626
#ifdef __cplusplus
27-
# include <ccomplex>
28-
#elif __has_include_next(<complex.h>)
29-
# include_next <complex.h>
30-
#endif
27+
28+
#include <ccomplex>
29+
30+
#else // __cplusplus
31+
32+
#include_next <complex.h>
33+
34+
#endif // __cplusplus
3135

3236
#endif // _LIBCPP_COMPLEX_H

libcxx/include/ctype.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ int toupper(int c);
3535
# pragma GCC system_header
3636
#endif
3737

38-
#if __has_include_next(<ctype.h>)
39-
# include_next <ctype.h>
40-
#endif
38+
#include_next <ctype.h>
4139

4240
#ifdef __cplusplus
4341

libcxx/include/errno.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
# pragma GCC system_header
2929
#endif
3030

31-
#if __has_include_next(<errno.h>)
32-
# include_next <errno.h>
33-
#endif
31+
#include_next <errno.h>
3432

3533
#ifdef __cplusplus
3634

libcxx/include/fenv.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ int feupdateenv(const fenv_t* envp);
5656
# pragma GCC system_header
5757
#endif
5858

59-
#if __has_include_next(<fenv.h>)
60-
# include_next <fenv.h>
61-
#endif
59+
#include_next <fenv.h>
6260

6361
#ifdef __cplusplus
6462

libcxx/include/float.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@
7676
# pragma GCC system_header
7777
#endif
7878

79-
#if __has_include_next(<float.h>)
80-
# include_next <float.h>
81-
#endif
79+
#include_next <float.h>
8280

8381
#ifdef __cplusplus
8482

libcxx/include/inttypes.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
248248
# define __STDC_FORMAT_MACROS
249249
#endif
250250

251-
#if __has_include_next(<inttypes.h>)
252-
# include_next <inttypes.h>
253-
#endif
251+
#include_next <inttypes.h>
254252

255253
#ifdef __cplusplus
256254

libcxx/include/limits.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@
4444
#endif
4545

4646
#ifndef __GNUC__
47-
48-
# if __has_include_next(<limits.h>)
49-
# include_next <limits.h>
50-
# endif
51-
47+
#include_next <limits.h>
5248
#else
5349
// GCC header limits.h recursively includes itself through another header called
5450
// syslimits.h for some reason. This setup breaks down if we directly

libcxx/include/locale.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@
4343
# pragma GCC system_header
4444
#endif
4545

46-
#if __has_include_next(<locale.h>)
47-
# include_next <locale.h>
48-
#endif
46+
#include_next <locale.h>
4947

5048
#endif // _LIBCPP_LOCALE_H

libcxx/include/math.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,7 @@ long double truncl(long double x);
297297
# pragma GCC system_header
298298
#endif
299299

300-
# if __has_include_next(<math.h>)
301-
# include_next <math.h>
302-
# endif
300+
#include_next <math.h>
303301

304302
#ifdef __cplusplus
305303

libcxx/include/setjmp.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ void longjmp(jmp_buf env, int val);
3131
# pragma GCC system_header
3232
#endif
3333

34-
#if __has_include_next(<setjmp.h>)
35-
# include_next <setjmp.h>
36-
#endif
34+
#include_next <setjmp.h>
3735

3836
#ifdef __cplusplus
3937

libcxx/include/stdbool.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
# pragma GCC system_header
2525
#endif
2626

27-
#if __has_include_next(<stdbool.h>)
28-
# include_next <stdbool.h>
29-
#endif
27+
#include_next <stdbool.h>
3028

3129
#ifdef __cplusplus
3230
#undef bool

libcxx/include/stddef.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242
# pragma GCC system_header
4343
#endif
4444

45-
# if __has_include_next(<stddef.h>)
46-
# include_next <stddef.h>
47-
# endif
45+
#include_next <stddef.h>
4846

4947
#ifdef __cplusplus
5048
typedef decltype(nullptr) nullptr_t;

libcxx/include/stdint.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@
120120
# define __STDC_CONSTANT_MACROS
121121
#endif
122122

123-
#if __has_include_next(<stdint.h>)
124-
# include_next <stdint.h>
125-
#endif
123+
#include_next <stdint.h>
126124

127125
#endif // _LIBCPP_STDINT_H

libcxx/include/stdio.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ void perror(const char* s);
104104
# pragma GCC system_header
105105
#endif
106106

107-
# if __has_include_next(<stdio.h>)
108-
# include_next <stdio.h>
109-
# endif
107+
#include_next <stdio.h>
110108

111109
#ifdef __cplusplus
112110

libcxx/include/stdlib.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
9090
# pragma GCC system_header
9191
#endif
9292

93-
# if __has_include_next(<stdlib.h>)
94-
# include_next <stdlib.h>
95-
# endif
93+
#include_next <stdlib.h>
9694

9795
#ifdef __cplusplus
9896
extern "C++" {

libcxx/include/string.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ size_t strlen(const char* s);
5757
# pragma GCC system_header
5858
#endif
5959

60-
#if __has_include_next(<string.h>)
61-
# include_next <string.h>
62-
#endif
60+
#include_next <string.h>
6361

6462
// MSVCRT, GNU libc and its derivates may already have the correct prototype in
6563
// <string.h>. This macro can be defined by users if their C library provides

libcxx/include/tgmath.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
#endif
2525

2626
#ifdef __cplusplus
27-
# include <ctgmath>
28-
#else
29-
# if __has_include_next(<tgmath.h>)
30-
# include_next <tgmath.h>
31-
# endif
32-
#endif
27+
28+
#include <ctgmath>
29+
30+
#else // __cplusplus
31+
32+
#include_next <tgmath.h>
33+
34+
#endif // __cplusplus
3335

3436
#endif // _LIBCPP_TGMATH_H

libcxx/include/wchar.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
120120
#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
121121
#endif
122122

123-
# if __has_include_next(<wchar.h>)
124-
# include_next <wchar.h>
125-
# endif
123+
#include_next <wchar.h>
126124

127125
// Determine whether we have const-correct overloads for wcschr and friends.
128126
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)

0 commit comments

Comments
 (0)