History

checkpatch: improve the STORAGE_CLASS test

Make sure static, extern, and asmlinkage appear before a specific type. e.g.: int asmlinkage foo(void) is better written asmlinkage int foo(void)

Joe Perches committed 9 years ago

Commit 596ed451 parent 0f556851 file · +10 −2Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+10−2
@@ -5576,10 +5576,18 @@ sub process { · 5575 unmodified lines
55765576 "architecture specific defines should be avoided\n" . $herecurr);
55775577 }
55785578
5579+# check that the storage class is not after a type
5580+ if ($line =~ /\b($Type)\s+($Storage)\b/) {
5581+ WARN("STORAGE_CLASS",
5582+ "storage class '$2' should be located before type '$1'\n" . $herecurr);
5583+ }
55795584 # Check that the storage class is at the beginning of a declaration
5580− if ($line =~ /\b$Storage\b/ && $line !~ /^.\s*$Storage\b/) {
5585+ if ($line =~ /\b$Storage\b/ &&
5586+ $line !~ /^.\s*$Storage/ &&
5587+ $line =~ /^.\s*(.+?)\$Storage\s/ &&
5588+ $1 !~ /[\,\)]\s*$/) {
55815589 WARN("STORAGE_CLASS",
5582− "storage class should be at the beginning of the declaration\n" . $herecurr)
5590+ "storage class should be at the beginning of the declaration\n" . $herecurr);
55835591 }
55845592
55855593 # check the location of the inline attribute, that it is between

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t