From: Tobias Klauser Date: Mon, 24 May 2010 21:33:30 +0000 (-0700) Subject: checkpatch: warn on declaration with storage class not at the beginning X-Git-Tag: upstream/snapshot3+hdmi~14402 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4977c78e9c7dd042f96f4a21d957bc25a561333;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git checkpatch: warn on declaration with storage class not at the beginning The C99 specification states in section 6.11.5: The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature. Signed-off-by: Tobias Klauser Acked-by: Jean Delvare Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index de0f467..bd88f11 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2601,6 +2601,11 @@ sub process { CHK("architecture specific defines should be avoided\n" . $herecurr); } +# Check that the storage class is at the beginning of a declaration + if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) { + WARN("storage class should be at the beginning of the declaration\n" . $herecurr) + } + # check the location of the inline attribute, that it is between # storage class and type. if ($line =~ /\b$Type\s+$Inline\b/ ||