From: Emil Velikov Date: Sat, 24 May 2025 16:40:47 +0000 (+0100) Subject: meson: disable Wdeclaration-after-statement X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1f9213931846fdad7455a5cac507a68000de220;p=thirdparty%2Fkmod.git meson: disable Wdeclaration-after-statement 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 Link: https://github.com/kmod-project/kmod/pull/360 Signed-off-by: Lucas De Marchi --- diff --git a/meson.build b/meson.build index 1dd6ca38..4f3e9551 100644 --- a/meson.build +++ b/meson.build @@ -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',