From ee364045492d44b9aad0814dc4fc5bcce0d6a4e2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 15 Jul 2022 11:38:26 +0100 Subject: [PATCH] meson: Enable more compiler warnings This provides parity with what we did in Autotools (most of it via AX_COMPILER_FLAGS_CFLAGS). Signed-off-by: Simon McVittie --- meson.build | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/meson.build b/meson.build index 99dfa900..3e11cb00 100644 --- a/meson.build +++ b/meson.build @@ -1055,12 +1055,51 @@ else '-Wno-missing-field-initializers', '-Wno-unused-parameter', + # General warnings for both C and C++ + # TODO: Some of these are probably redundant with Meson's warning_level + '-Warray-bounds', + '-Wcast-align', '-Wchar-subscripts', + '-Wdouble-promotion', + '-Wduplicated-branches', + '-Wduplicated-cond', '-Wfloat-equal', + '-Wformat-nonliteral', + '-Wformat-security', + '-Wformat=2', + '-Winit-self', + '-Winline', + '-Wlogical-op', + '-Wmissing-declarations', + '-Wmissing-format-attribute', + '-Wmissing-include-dirs', + '-Wmissing-noreturn', + '-Wnull-dereference', + '-Wpacked', + '-Wpointer-arith', + '-Wredundant-decls', + '-Wrestrict', + '-Wreturn-type', + '-Wshadow', + '-Wsign-compare', + '-Wstrict-aliasing', + '-Wswitch-default', + '-Wswitch-enum', + '-Wundef', + '-Wunused-but-set-variable', + '-Wwrite-strings', ] compile_warnings_c += [ + # Extra warnings just for C + '-Wdeclaration-after-statement', + '-Wimplicit-function-declaration', + '-Wjump-misses-init', + '-Wmissing-prototypes', + '-Wnested-externs', + '-Wold-style-definition', '-Wpointer-sign', + '-Wstrict-prototypes', ] endif