There are some CLang versions that do not support -fsemantic-interposition. If that's the case, the code is optimized so much that our mocking no longer works. Therefore, disable tests and produce a warning. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- Technically, this is a v2 of: https://listman.redhat.com/archives/libvir-list/2023-March/238943.html but a different approach is implemented, so I'm sending it anew. meson.build | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index a0682e8d0b..c15003ce02 100644 --- a/meson.build +++ b/meson.build @@ -2035,8 +2035,18 @@ subdir('src') subdir('tools') -build_tests = not get_option('tests').disabled() -if build_tests +build_tests = [ not get_option('tests').disabled() ] +if build_tests[0] and \ + cc.get_id() == 'clang' and \ + not supported_cc_flags.contains('-fsemantic-interposition') \ + and get_option('optimization') != '0' + # If CLang doesn't support -fsemantic-interposition then our + # mocking doesn't work. The best we can do is to not run the + # test suite. + build_tests = [ false, '!!! Forcibly disabling tests because CLang lacks -fsemantic-interposition. Update CLang or disable optimization !!!' ] +endif + +if build_tests[0] subdir('tests') endif -- 2.39.2