From 9d24c8b223ec4253e3c6a2e14001de61fa993dbb Mon Sep 17 00:00:00 2001 From: Ernestas Kulik Date: Fri, 16 Feb 2018 19:14:08 +0200 Subject: [PATCH] build: meson: add warning flags Courtesy of GTK+. https://bugzilla.gnome.org/show_bug.cgi?id=793399 --- meson.build | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/meson.build b/meson.build index bb0419ed5..de12b8811 100644 --- a/meson.build +++ b/meson.build @@ -269,6 +269,27 @@ foreach m : struct_members endif endforeach +# Compiler flags +if cc.get_id() == 'gcc' or cc.get_id() == 'clang' + test_c_args = [ + '-Wall', + '-Wduplicated-branches', + '-Wstrict-prototypes', + '-Werror=declaration-after-statement', + '-Werror=format=2', + '-Werror=format-security', + '-Werror=implicit-function-declaration', + '-Werror=init-self', + '-Werror=missing-include-dirs', + '-Werror=missing-prototypes', + '-Werror=pointer-arith', + ] +else + test_c_args = [] +endif + +add_project_arguments(cc.get_supported_arguments(test_c_args), language: 'c') + # Windows Support (Vista+) if host_system == 'windows' glib_conf.set('_WIN32_WINNT', '0x0601')