Skip to content

Commit d4977c7

Browse files
tklausertorvalds
authored andcommitted
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 <[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]>
1 parent 3354957 commit d4977c7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/checkpatch.pl

+5
Original file line numberDiff line numberDiff line change
@@ -2601,6 +2601,11 @@ sub process {
26012601
CHK("architecture specific defines should be avoided\n" . $herecurr);
26022602
}
26032603

2604+
# Check that the storage class is at the beginning of a declaration
2605+
if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) {
2606+
WARN("storage class should be at the beginning of the declaration\n" . $herecurr)
2607+
}
2608+
26042609
# check the location of the inline attribute, that it is between
26052610
# storage class and type.
26062611
if ($line =~ /\b$Type\s+$Inline\b/ ||

0 commit comments

Comments
 (0)