]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
meson: disable Wdeclaration-after-statement
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 24 May 2025 16:40:47 +0000 (17:40 +0100)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 29 May 2025 22:07:52 +0000 (17:07 -0500)
Having declarations after statement is a C90 requirement, which was
relaxed with C99. While there are some arguments for having it enabled
in new code, there are benefits to the contrary which are more appealing
IMHO.

Namely, by keeping the declarations where the variables are used, better
outlines the scope, reduces chances of shadowing and helps us avoid
"unused variable" compiler warning in some paths.

Flip the warning to -Wno for now and future patches can remove some of
the workarounds we have in-tree.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/360
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
meson.build

index 1dd6ca383d54f26436d538aa67a09851a7361e39..4f3e9551fc925957f356c6493d1d6ab7b55460f3 100644 (file)
@@ -117,7 +117,6 @@ add_project_arguments(
     '-ffunction-sections',
     '-fno-common',
     '-Wchar-subscripts',
-    '-Wdeclaration-after-statement',
     '-Wendif-labels',
     '-Wfloat-equal',
     '-Wformat=2',
@@ -131,6 +130,7 @@ add_project_arguments(
     '-Wmissing-prototypes',
     '-Wnested-externs',
     '-Wno-attributes=clang::suppress',
+    '-Wno-declaration-after-statement',
     '-Wno-unused-parameter',
     '-Wold-style-definition',
     '-Wpointer-arith',