]> xenbits.xensource.com Git - libvirt.git/commitdiff
meson: Don't build tests when CLang lacks -fsemantic-interposition
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 21 Mar 2023 16:01:34 +0000 (17:01 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 24 Mar 2023 10:15:23 +0000 (11:15 +0100)
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@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
meson.build

index a0682e8d0b181f5581188a06dcf04f560790d460..c15003ce02c7a5938c40408ba9c60c67ea1c04f9 100644 (file)
@@ -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