meson: Don't build tests when CLang lacks -fsemantic-interposition

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>
This commit is contained in:
Michal Privoznik 2023-03-21 17:01:34 +01:00
parent 7334972c9a
commit 7944700b40

View 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