Skip to content

Commit dba1008

Browse files
lanodaneli-schwartz
authored andcommitted
test cases/common/32 has header: disable undef with libcxx
Can be tested with adding -stdlib=libc++ to C++ flags. In file included from /usr/include/c++/v1/stdio.h:93: In file included from /usr/include/c++/v1/__config:14: In file included from /usr/include/c++/v1/__configuration/abi.h:15: /usr/include/c++/v1/__configuration/platform.h:35:7: error: function-like macro '__has_include' is not defined 35 | # if __has_include(<features.h>) | ^ /usr/include/c++/v1/__configuration/platform.h:48:5: error: function-like macro '__has_include' is not defined 48 | #if __has_include(<picolibc.h>) | ^ 1 warning and 2 errors generated. '
1 parent d1090ed commit dba1008

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test cases/common/32 has header/meson.build

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
project('has header', 'c', 'cpp')
22

33
host_system = host_machine.system()
4+
cpp = meson.get_compiler('cpp')
45

56
non_existent_header = 'ouagadougou.h'
67

@@ -9,16 +10,20 @@ configure_file(input : non_existent_header,
910
output : non_existent_header,
1011
configuration : configuration_data())
1112

13+
is_libcxx = cpp.has_header_symbol('ciso646', '_LIBCPP_VERSION')
14+
1215
# Test that the fallback to __has_include also works on all compilers
13-
if host_system != 'darwin'
16+
#
17+
# darwin: can't redefine builtin macros so the above doesn't work
18+
# libcxx: Undefining __has_include() breaks LLVM libcxx platform.h
19+
if host_system != 'darwin' and not is_libcxx
1420
fallbacks = ['', '\n#undef __has_include']
1521
else
16-
# On Darwin's clang you can't redefine builtin macros so the above doesn't work
1722
fallbacks = ['']
1823
endif
1924

2025
foreach fallback : fallbacks
21-
foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')]
26+
foreach comp : [meson.get_compiler('c'), cpp]
2227
assert(comp.has_header('stdio.h', prefix : fallback), 'Stdio missing.')
2328

2429
# stdio.h doesn't actually need stdlib.h, but just test that setting the

0 commit comments

Comments
 (0)