[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1320200857.15779.4.camel@Joe-Laptop>
Date: Wed, 02 Nov 2011 04:27:37 +0200
From: Joe Perches <joe@...ches.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Andy Whitcroft <apw@...onical.com>
Subject: [PATCH] checkpatch: Prefer __printf not
__attribute__((format(printf,...)))
Add a warn for not using __printf.
Signed-off-by: Joe Perches <joe@...ches.com>
---
On Tue, 2011-11-01 at 15:09 -0700, Andrew Morton wrote:
> hm, we don't appear to have a checkpatch rule telling people not to use
> __attribute__((format(printf, ...))). Who should I hassle about that? :)
Probably Andy Whitcroft. Until he reappears though...
scripts/checkpatch.pl | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5e93342..6cae370 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3097,6 +3097,12 @@ sub process {
"__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr);
}
+# Check for __attribute__ format(printf, prefer __printf
+ if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) {
+ WARN("PREFER_PRINTF",
+ "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr);
+ }
+
# check for sizeof(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("SIZEOF_ADDRESS",
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists