From: Joe Perches Date: Tue, 10 Jan 2012 23:09:52 +0000 (-0800) Subject: checkpatch: prefer __printf over __attribute__((format(printf,...))) X-Git-Tag: v3.12-rc1~4091^2~43 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f14d3bd87ef5f979ea64c1f0862534d71786db7;p=kernel%2Fkernel-generic.git checkpatch: prefer __printf over __attribute__((format(printf,...))) Add a warn for not using __printf. Signed-off-by: Joe Perches Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 885e3b4..e94626c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3114,6 +3114,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",