aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2017-03-28 17:01:30 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2017-04-06 22:48:02 +0100
commit4ef4a659f20635d0345dc829772e199cbfb16fbe (patch)
tree4d43690290069b4a4a31ac7b6e8572a104cdb2e7
parent205b3757236538977aeef663c63ba4c4ec7ffbe0 (diff)
downloadmeson-4ef4a659f20635d0345dc829772e199cbfb16fbe.zip
meson-4ef4a659f20635d0345dc829772e199cbfb16fbe.tar.gz
meson-4ef4a659f20635d0345dc829772e199cbfb16fbe.tar.bz2
Fix test cases/common/37 on Cygwin
Including newlib's <stdlib.h> brings in a '#define __has_include 0', so using -U__has_include on the command line isn't going to remove it (so the fallback doesn't happen and the test fails) Instead use a '#undef __has_include' at the end of the prefix to excerise this. (newlib's <stdlib.h> is derived from FreeBSD, so the same problem will probably be seen there)
-rw-r--r--test cases/common/37 has header/meson.build18
1 files changed, 9 insertions, 9 deletions
diff --git a/test cases/common/37 has header/meson.build b/test cases/common/37 has header/meson.build
index 4299ce5..b53849c 100644
--- a/test cases/common/37 has header/meson.build
+++ b/test cases/common/37 has header/meson.build
@@ -11,19 +11,19 @@ configure_file(input : non_existant_header,
# Test that the fallback to __has_include also works on all compilers
if host_system != 'darwin'
- args = [[], ['-U__has_include']]
+ fallbacks = ['', '\n#undef __has_include']
else
# On Darwin's clang you can't redefine builtin macros so the above doesn't work
- args = [[]]
+ fallbacks = ['']
endif
-foreach arg : args
+foreach fallback : fallbacks
foreach comp : [meson.get_compiler('c'), meson.get_compiler('cpp')]
- assert(comp.has_header('stdio.h', args : arg), 'Stdio missing.')
+ assert(comp.has_header('stdio.h', prefix : fallback), 'Stdio missing.')
# stdio.h doesn't actually need stdlib.h, but just test that setting the
# prefix does not result in an error.
- assert(comp.has_header('stdio.h', prefix : '#include <stdlib.h>', args : arg),
+ assert(comp.has_header('stdio.h', prefix : '#include <stdlib.h>' + fallback),
'Stdio missing.')
# XInput.h should not require type definitions from windows.h, but it does
@@ -32,9 +32,9 @@ foreach arg : args
# We only do this check on MSVC because MinGW often defines its own wrappers
# that pre-include windows.h
if comp.get_id() == 'msvc'
- assert(comp.has_header('XInput.h', prefix : '#include <windows.h>', args : arg),
+ assert(comp.has_header('XInput.h', prefix : '#include <windows.h>' + fallback),
'XInput.h should not be missing on Windows')
- assert(comp.has_header('XInput.h', prefix : '#define _X86_', args : arg),
+ assert(comp.has_header('XInput.h', prefix : '#define _X86_' + fallback),
'XInput.h should not need windows.h')
endif
@@ -42,13 +42,13 @@ foreach arg : args
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80005
# https://github.com/mesonbuild/meson/issues/1458
if host_system == 'linux'
- assert(comp.has_header('linux/if.h', args : arg),
+ assert(comp.has_header('linux/if.h', prefix : fallback),
'Could not find <linux/if.h>')
endif
# This header exists in the source and the builddir, but we still must not
# find it since we are looking in the system directories.
- assert(not comp.has_header(non_existant_header, args : arg),
+ assert(not comp.has_header(non_existant_header, prefix : fallback),
'Found non-existant header.')
endforeach
endforeach