From e084a47a0a28f0bae70057ddb7812cb283456d07 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 26 Jan 2017 10:14:57 +0530 Subject: [PATCH] compilers: Don't run built-in checks on MSVC MSVC does not have built-ins, so this is totally useless. Instead, add a test for intrinsics to ensure that we do find them. --- mesonbuild/compilers.py | 4 ++++ test cases/common/43 has function/meson.build | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index c800bbe34..de14d4af5 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1046,6 +1046,10 @@ class CCompiler(Compiler): if self.links(templ.format(**fargs), env, extra_args, dependencies): return True + # MSVC does not have compiler __builtin_-s. + if self.get_id() == 'msvc': + return False + # Detect function as a built-in # # Some functions like alloca() are defined as compiler built-ins which diff --git a/test cases/common/43 has function/meson.build b/test cases/common/43 has function/meson.build index d4a2431bf..eb30acd07 100644 --- a/test cases/common/43 has function/meson.build +++ b/test cases/common/43 has function/meson.build @@ -28,6 +28,11 @@ foreach cc : compilers assert(cc.has_function('fprintf', prefix : '#include ', args : unit_test_args), '"fprintf" function not found with include (on msvc).') + # Compiler intrinsics + assert(cc.has_function('strcmp'), + 'strcmp intrinsic should have been found on MSVC') + assert(cc.has_function('strcmp', prefix : '#include '), + 'strcmp intrinsic should have been found with #include on MSVC') endif if cc.has_function('hfkerhisadf', prefix : '#include',