From: Jim Cromie Date: Tue, 25 Mar 2025 23:51:54 +0000 (-0600) Subject: checkpatch: dont warn about unused macro arg on empty body X-Git-Tag: v6.16-rc1~91^2~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df3d527495376e29333035e087ead194580ea3b2;p=thirdparty%2Flinux.git checkpatch: dont warn about unused macro arg on empty body Patch series "2 checkpatch fixes, one pr_info_once". 2 small tweaks to checkpatch, 1 reducing several pages of powernow "not-relevant-here" log-msgs to a few lines This patch (of 3): We currently get: WARNING: Argument 'name' is not used in function-like macro on: #define DRM_CLASSMAP_USE(name) /* nothing here */ Following this advice is wrong here, and shouldn't be fixed by ignoring args altogether; the macro should properly fail if invoked with 0 or 2+ args. Link: https://lkml.kernel.org/r/20250325235156.663269-1-jim.cromie@gmail.com Link: https://lkml.kernel.org/r/20250325235156.663269-2-jim.cromie@gmail.com Signed-off-by: Jim Cromie Acked-by: Joe Perches Reviewed-by: Louis Chauvet Cc: Andy Whitcroft Cc: Joe Perches Cc: Dwaipayan Ray Cc: Lukas Bulwahn Cc:"Rafael J. Wysocki" Cc: Viresh Kumar Signed-off-by: Andrew Morton --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3d22bf863eec9..75349f766b89d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6024,7 +6024,7 @@ sub process { } # check if this is an unused argument - if ($define_stmt !~ /\b$arg\b/) { + if ($define_stmt !~ /\b$arg\b/ && $define_stmt) { WARN("MACRO_ARG_UNUSED", "Argument '$arg' is not used in function-like macro\n" . "$herectx"); }