diff options
author | Joe Perches <joe@perches.com> | 2012-01-10 18:09:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 19:30:50 -0500 |
commit | 5f14d3bd87ef5f979ea64c1f0862534d71786db7 (patch) | |
tree | 88982b950031e877156bf17c3755d9a128b336f8 /scripts/checkpatch.pl | |
parent | 270c49a088ae58d4b817861bb04bfec63b0966db (diff) |
checkpatch: prefer __printf over __attribute__((format(printf,...)))
Add a warn for not using __printf.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 6 |
1 files changed, 6 insertions, 0 deletions
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 { | |||
3114 | "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr); | 3114 | "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr); |
3115 | } | 3115 | } |
3116 | 3116 | ||
3117 | # Check for __attribute__ format(printf, prefer __printf | ||
3118 | if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) { | ||
3119 | WARN("PREFER_PRINTF", | ||
3120 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr); | ||
3121 | } | ||
3122 | |||
3117 | # check for sizeof(&) | 3123 | # check for sizeof(&) |
3118 | if ($line =~ /\bsizeof\s*\(\s*\&/) { | 3124 | if ($line =~ /\bsizeof\s*\(\s*\&/) { |
3119 | WARN("SIZEOF_ADDRESS", | 3125 | WARN("SIZEOF_ADDRESS", |