meson: fix clang-tidy
meson fixed the bugs that prevented using the sanitizer args, but using such a fixed meson will provide broken flags to the subprojects. *sigh* Change-Id: I0ab54351b19a3879e9a97daed1621dc5f730d376
This commit is contained in:
+18
-12
@@ -43,9 +43,10 @@ project('lix', 'cpp', 'rust',
|
|||||||
'debug=true',
|
'debug=true',
|
||||||
'optimization=2',
|
'optimization=2',
|
||||||
'errorlogs=true', # Please print logs for tests that fail
|
'errorlogs=true', # Please print logs for tests that fail
|
||||||
# Instead of using the default sanitizer, we combine this with
|
# NOTE we attempted to use meson for sanitizer config once (22e2ecdc43), but that
|
||||||
# -fsanitize-undefined-trap-on-error below in this file.
|
# broke clang-tidy in the devshell. our plugin ended up with undefined symbols in
|
||||||
'b_sanitize=signed-integer-overflow',
|
# the linked object, and clang-tidy helpfully just ignores objects it can't load.
|
||||||
|
#'b_sanitize=signed-integer-overflow',
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -690,15 +691,20 @@ add_project_arguments(
|
|||||||
sanitize_args = []
|
sanitize_args = []
|
||||||
cargo_sanitizer_args = []
|
cargo_sanitizer_args = []
|
||||||
|
|
||||||
# 2024-03-24: jade benchmarked the default sanitize reporting in clang and got
|
# We turn off the production UBSan if the slower dev UBSan is requested, to
|
||||||
# a regression of about 10% on hackage-packages.nix with clang. So if the
|
# give better diagnostics.
|
||||||
# signed-integer-overflow sanitizer is requested (our default), we trap instead.
|
if cxx.get_id() in ['gcc', 'clang'] and 'undefined' not in get_option('b_sanitize')
|
||||||
# Trapping has an unmeasurably low overhead in Nix evaluation benchmarks.
|
# 2024-03-24: jade benchmarked the default sanitize reporting in clang and got
|
||||||
if cxx.get_id() in ['gcc', 'clang'] and 'signed-integer-overflow' in get_option('b_sanitize')
|
# a regression of about 10% on hackage-packages.nix with clang. So we are trapping instead.
|
||||||
|
#
|
||||||
|
# This has an unmeasurably low overhead in Nix evaluation benchmarks.
|
||||||
|
#
|
||||||
# N.B. Meson generates a completely nonsense warning here:
|
# N.B. Meson generates a completely nonsense warning here:
|
||||||
# https://github.com/mesonbuild/meson/issues/9822
|
# https://github.com/mesonbuild/meson/issues/9822
|
||||||
# -fsanitize-undefined-trap-on-error is not representable in -Db_sanitize=
|
# Both of these args cannot be written in the default meson configuration.
|
||||||
sanitize_args = ['-fsanitize-undefined-trap-on-error']
|
# b_sanitize=signed-integer-overflow is ignored, and
|
||||||
|
# -fsanitize-undefined-trap-on-error is not representable.
|
||||||
|
sanitize_args = ['-fsanitize=signed-integer-overflow', '-fsanitize-undefined-trap-on-error']
|
||||||
add_project_arguments(sanitize_args, language: 'cpp')
|
add_project_arguments(sanitize_args, language: 'cpp')
|
||||||
add_project_link_arguments(sanitize_args, language: 'cpp')
|
add_project_link_arguments(sanitize_args, language: 'cpp')
|
||||||
endif
|
endif
|
||||||
@@ -708,9 +714,9 @@ if cxx.get_id() == 'clang' and get_option('b_sanitize') != ''
|
|||||||
add_project_link_arguments('-shared-libsan', language : 'cpp')
|
add_project_link_arguments('-shared-libsan', language : 'cpp')
|
||||||
cargo_sanitizer_args = [
|
cargo_sanitizer_args = [
|
||||||
'-shared-libsan',
|
'-shared-libsan',
|
||||||
'-fsanitize=' + get_option('b_sanitize'),
|
get_option('b_sanitize') != 'none' ? '-fsanitize=' + get_option('b_sanitize') : [],
|
||||||
sanitize_args,
|
sanitize_args,
|
||||||
]
|
].flatten()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Clang gets grumpy about missing libasan symbols if -shared-libasan is not
|
# Clang gets grumpy about missing libasan symbols if -shared-libasan is not
|
||||||
|
|||||||
@@ -423,7 +423,6 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
++ lib.optionals hostPlatform.isStatic [
|
++ lib.optionals hostPlatform.isStatic [
|
||||||
"-Denable-embedded-sandbox-shell=true"
|
"-Denable-embedded-sandbox-shell=true"
|
||||||
"-Denable-contrib-plugins=false"
|
"-Denable-contrib-plugins=false"
|
||||||
"-Db_sanitize=none"
|
|
||||||
]
|
]
|
||||||
++ lib.optional ciBuildAndDeleteBothLibraries "-Ddefault_library=both"
|
++ lib.optional ciBuildAndDeleteBothLibraries "-Ddefault_library=both"
|
||||||
# musl doesn't support fibers, and we can't detect this with meson alone.
|
# musl doesn't support fibers, and we can't detect this with meson alone.
|
||||||
|
|||||||
Reference in New Issue
Block a user