From ba515347cf36922e142bf9fad52a689ea25acc52 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 6 Jun 2023 13:07:04 +0100 Subject: [PATCH] meson: Disable some warnings when asserts/checks are disabled Some labels are only used when checks are enabled, and some variables are only used when assertions and/or checks are enabled. Instead of cluttering the code with extra #ifdefs, we silence those warnings: they're harmless in this case. We already do this in Autotools. Signed-off-by: Simon McVittie --- meson.build | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 5b61b047d..433a333d8 100644 --- a/meson.build +++ b/meson.build @@ -791,13 +791,10 @@ endif if not asserts warning_args += [ - '-Wno-unused-but-set-variable', - '-Wno-unused-variable', '-Wno-unused-function', ] endif - checks = get_option('checks') config.set('DBUS_ENABLE_CHECKS', checks ? 1 : false) config.set('DBUS_DISABLE_CHECKS', not checks ? 1 : false) @@ -807,6 +804,19 @@ config.set('HAVE_GIO_UNIX', have_gio_unix ? 1 : false) config.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_2_38') config.set('GLIB_VERSION_MAX_ALLOWED', 'G_ENCODE_VERSION(2,44)') +if not checks + warning_args += [ + '-Wno-unused-label', + ] +endif + +if not (asserts and checks) + warning_args += [ + '-Wno-unused-but-set-variable', + '-Wno-unused-variable', + ] +endif + windows_output_debug = get_option('windows_output_debug_string') config.set('DBUS_USE_OUTPUT_DEBUG_STRING', windows_output_debug) -- 2.47.3