]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
checkpatch: prefer __printf over __attribute__((format(printf,...)))
authorJoe Perches <joe@perches.com>
Fri, 16 Dec 2011 04:50:16 +0000 (15:50 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 20 Dec 2011 07:43:49 +0000 (18:43 +1100)
Add a warn for not using __printf.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
scripts/checkpatch.pl

index 885e3b43d64af21de23f9c4f574a09dbe8326392..e94626ca77cf2357cdd839003adaac7641d170cd 100755 (executable)
@@ -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",