Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f14d3bd authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

checkpatch: prefer __printf over __attribute__((format(printf,...)))



Add a warn for not using __printf.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 270c49a0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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",