From 7d55571c13f3e8dc5221a975c929dc2856b8204a Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 16 Nov 2022 10:42:29 +0000 Subject: [PATCH] build: Explicitly enable -Wmissing-field-initializers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was previously only enabled (by default) on macOS, which led to code being committed which triggered warnings, as that CI job is not always run. Avoid that risk by always enabling the warning. The reasoning for using this warning is that explicit initialisation is clearer than implicit. We also want to support GLib’s public headers being used in projects which build with `-Werror=missing-field-initializers`, but can’t easily enable the warning for our public headers but not our internal code. So enable it everywhere. Make it a warning rather than an error, as there’s a risk that system header changes will trigger it in distro release builds, which would cause false build failures. By making it a warning, GLib developers can build with `-Werror` and promote it to an error, while distros can choose not to. Signed-off-by: Philip Withnall Helps: #2812 --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 30a65e873..518de215b 100644 --- a/meson.build +++ b/meson.build @@ -477,6 +477,7 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang' '-Wduplicated-branches', '-Wimplicit-fallthrough', '-Wmisleading-indentation', + '-Wmissing-field-initializers', '-Wnonnull', '-Wunused', # Due to maintained deprecated code, we do not want to see unused parameters