[libc++] Guard include of <features.h> with __has_include (#127691) · llvm/llvm-project@d420bf8 (original) (raw)
File tree
1 file changed
lines changed
- libcxx/include/__configuration
1 file changed
lines changed
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
@@ -32,12 +32,14 @@ | |||
32 | 32 | ||
33 | 33 | // Need to detect which libc we're using if we're on Linux. | |
34 | 34 | #if defined(__linux__) | | defined(__AMDGPU__) |
35 | -# include <features.h> | ||
36 | -# if defined(__GLIBC_PREREQ) | ||
37 | -# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) | ||
38 | -# else | ||
39 | -# define _LIBCPP_GLIBC_PREREQ(a, b) 0 | ||
40 | -# endif // defined(__GLIBC_PREREQ) | ||
35 | +# if __has_include(<features.h>) | ||
36 | +# include <features.h> | ||
37 | +# if defined(__GLIBC_PREREQ) | ||
38 | +# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) | ||
39 | +# else | ||
40 | +# define _LIBCPP_GLIBC_PREREQ(a, b) 0 | ||
41 | +# endif // defined(__GLIBC_PREREQ) | ||
42 | +# endif | ||
41 | 43 | #endif | |
42 | 44 | ||
43 | 45 | #ifndef __BYTE_ORDER__ |