diff options
| author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-23 23:19:51 +0530 |
|---|---|---|
| committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-01-26 09:16:48 +0530 |
| commit | fbbfbfac7e13ad2fb594f52678652afc262c1005 (patch) | |
| tree | a5971c7123f8ddace2ea241cda6cb30df25870ad /test cases | |
| parent | 7e1654bf083a78080ce92f0f2fe0310aae41e0d3 (diff) | |
| download | meson-fbbfbfac7e13ad2fb594f52678652afc262c1005.tar.gz | |
compilers: Fix builtin checks with clang on Linux
Our "43 has function" test should also work with clang and icc on Linux,
so enable them. Also detect builtins with __has_builtin if available,
which is much faster on clang.
There is a feature request for the same with GCC too:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970
Diffstat (limited to 'test cases')
| -rw-r--r-- | test cases/common/43 has function/meson.build | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test cases/common/43 has function/meson.build b/test cases/common/43 has function/meson.build index 323ed0093..b2bb43a20 100644 --- a/test cases/common/43 has function/meson.build +++ b/test cases/common/43 has function/meson.build @@ -31,12 +31,16 @@ foreach cc : compilers error('Found non-existent function "hfkerhisadf".') endif + if cc.has_function('hfkerhisadf', args : unit_test_args) + error('Found non-existent function "hfkerhisadf".') + endif + # With glibc on Linux lchmod is a stub that will always return an error, # we want to detect that and declare that the function is not available. # We can't check for the C library used here of course, but if it's not # implemented in glibc it's probably not implemented in any other 'slimmer' # C library variants either, so the check should be safe either way hopefully. - if host_system == 'linux' and cc.get_id() == 'gcc' + if host_system == 'linux' assert (cc.has_function('poll', prefix : '#include <poll.h>', args : unit_test_args), 'couldn\'t detect "poll" when defined by a header') |
