From: Joe Perches Date: Thu, 8 Dec 2011 04:42:20 +0000 (+1100) Subject: checkpatch: prefer __printf over __attribute__((format(printf,...))) X-Git-Tag: next-20111209~3^2~112 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1cb71e7302a60890c7ae3ef9c2bc3e726d9c530c;p=karo-tx-linux.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 --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 885e3b43d64a..e94626ca77cf 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",