]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
meson: add more warnings from the C compiler
authorVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 7 Jun 2023 08:30:33 +0000 (10:30 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Thu, 8 Jun 2023 06:13:06 +0000 (08:13 +0200)
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

index 3f301e5a7eb1bf01a70f6b22f630a8b57d8091f5..41e04d10b9fba8024d69ffad51c3167dfb4565e7 100644 (file)
@@ -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
   )