From: Vladimír Čunát Date: Wed, 7 Jun 2023 08:30:33 +0000 (+0200) Subject: meson: add more warnings from the C compiler X-Git-Tag: v5.7.0~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9fd7e9d4bea4b98e589d222109039445995d870;p=thirdparty%2Fknot-resolver.git 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. --- diff --git a/meson.build b/meson.build index 3f301e5a7..41e04d10b 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 )