diff options
author | pal1000 <liviuprodea@yahoo.com> | 2023-02-07 01:35:45 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-02-07 08:44:14 +0000 |
commit | 4347072443867f6337c33ffc330263bb851d9839 (patch) | |
tree | ef25e4d80500313b50dc47544056f604c4c233c2 | |
parent | 4888dd73918aaee71a3b029b5e8fab9d04640274 (diff) | |
download | mesa-4347072443867f6337c33ffc330263bb851d9839.tar.gz |
meson: Ignore unused variables when assertions are disabled
Fixes: 46b099e3
("meson: Ignore unused variables in release builds")
46b099e3 has some issues:
- it doesn't enable unused variables warning on release builds
with assertions enabled;
- it doesn't disable unused variables warning on debug builds
with assertions disabled;
- it doesn't disable unused variables warning when building
with MSVC and assertions are disabled regardless of buildtype,
see #8147. 3/4 regressions reported there have this limitation
alone as root cause.
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21154>
-rw-r--r-- | meson.build | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/meson.build b/meson.build index c0e2ab3cfdf..a5dc7d0ba03 100644 --- a/meson.build +++ b/meson.build @@ -1052,12 +1052,12 @@ else _trial_cpp += ['-ffunction-sections', '-fdata-sections'] endif - # Variables that are only used for assertions are considered unused in release - # builds. Don't treat this as an error, since we build with -Werror even for - # release in CI. - if get_option('buildtype') == 'release' - _trial_c += ['-Wno-unused-variable', '-Wno-unused-but-set-variable'] - _trial_cpp += ['-Wno-unused-variable', '-Wno-unused-but-set-variable'] + # Variables that are only used for assertions are considered unused when assertions + # are disabled. Don't treat this as an error, since we build with -Werror even if + # assertions are disabled. + if get_option('b_ndebug') == 'true' or (get_option('buildtype') == 'release' and get_option('b_ndebug') == 'if-release') + _trial_c += ['-Wno-unused-variable', '-Wno-unused-but-set-variable', '/wd4189'] + _trial_cpp += ['-Wno-unused-variable', '-Wno-unused-but-set-variable', '/wd4189'] endif c_args += cc.get_supported_arguments(_trial_c) |