Messages in this thread Patch in this message | | | Subject | [PATCH] checkpatch: Prefer __printf not __attribute__((format(printf,...))) | From | Joe Perches <> | Date | Wed, 02 Nov 2011 04:27:37 +0200 |
| |
Add a warn for not using __printf.
Signed-off-by: Joe Perches <joe@perches.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",
| |