From e9fd7e9d4bea4b98e589d222109039445995d870 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Wed, 7 Jun 2023 10:30:33 +0200 Subject: meson: add more warnings from the C compiler I tested this still builds with gcc 6, gcc 13, clang 7, clang 16. Our CI additionally does `-Werror`, so that the properties will get maintained (on some Debian's default compiler and clang). Warnings with gcc 13 seem clear for me now, too. --- meson.build | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'meson.build') diff --git a/meson.build b/meson.build index 3f301e5a..41e04d10 100644 --- a/meson.build +++ b/meson.build @@ -130,12 +130,21 @@ message('---------------------------') ## Compiler args add_project_arguments( '-D_GNU_SOURCE', + + # Various warnings. Let's use any warning that doesn't "cause problems". + '-Wall', '-Wformat', '-Wformat-security', '-Wtype-limits', '-Wshadow', '-Werror=implicit-function-declaration', # Probably messed up includes; implicit functions are evil! '-Werror=attributes', # Missing cleanup attribute could lead to memory leaks. + '-Wstrict-prototypes', # `void foo();` is basically always a mistake, in our code at least. + '-Wold-style-definition', + '-Wignored-qualifiers', + '-Woverride-init', + '-Wuninitialized', + '-fvisibility=hidden', '-DHAVE_ASPRINTF=' + have_asprintf.to_int().to_string(), @@ -258,6 +267,7 @@ if clangtidy.found() command: [ clangtidy, '-quiet', + '-extra-arg=-Wno-unknown-warning-option', # version in CI is weird in this '-p', meson.build_root(), ] + c_src_lint ) -- cgit v1.2.3