Skip to content

Commit

Permalink
checkpatch: warn on declaration with storage class not at the beginning
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Jean Delvare <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
tklauser authored and torvalds committed May 25, 2010
1 parent 3354957 commit d4977c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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/ ||
Expand Down

0 comments on commit d4977c7

Please sign in to comment.