diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/headers_check.pl | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 72924a7fcf1e..b62c319611a2 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl | |||
@@ -34,9 +34,11 @@ foreach my $file (@files) { | |||
34 | $lineno = 0; | 34 | $lineno = 0; |
35 | while ($line = <FH>) { | 35 | while ($line = <FH>) { |
36 | $lineno++; | 36 | $lineno++; |
37 | check_include(); | 37 | &check_include(); |
38 | check_prototypes(); | 38 | &check_asm_types(); |
39 | check_config(); | 39 | &check_sizetypes(); |
40 | &check_prototypes(); | ||
41 | &check_config(); | ||
40 | } | 42 | } |
41 | close FH; | 43 | close FH; |
42 | } | 44 | } |
@@ -73,3 +75,42 @@ sub check_config | |||
73 | } | 75 | } |
74 | } | 76 | } |
75 | 77 | ||
78 | my $linux_asm_types; | ||
79 | sub check_asm_types() | ||
80 | { | ||
81 | if ($lineno == 1) { | ||
82 | $linux_asm_types = 0; | ||
83 | } elsif ($linux_asm_types >= 1) { | ||
84 | return; | ||
85 | } | ||
86 | if ($line =~ m/^\s*#\s*include\s+<asm\/types.h>/) { | ||
87 | $linux_asm_types = 1; | ||
88 | printf STDERR "$filename:$lineno: " . | ||
89 | "include of <linux/types.h> is preferred over <asm/types.h>\n" | ||
90 | # Warn until headers are all fixed | ||
91 | #$ret = 1; | ||
92 | } | ||
93 | } | ||
94 | |||
95 | my $linux_types; | ||
96 | sub check_sizetypes | ||
97 | { | ||
98 | if ($lineno == 1) { | ||
99 | $linux_types = 0; | ||
100 | } elsif ($linux_types >= 1) { | ||
101 | return; | ||
102 | } | ||
103 | if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) { | ||
104 | $linux_types = 1; | ||
105 | return; | ||
106 | } | ||
107 | if ($line =~ m/__[us](8|16|32|64)\b/) { | ||
108 | printf STDERR "$filename:$lineno: " . | ||
109 | "found __[us]{8,16,32,64} type " . | ||
110 | "without #include <linux/types.h>\n"; | ||
111 | $linux_types = 2; | ||
112 | # Warn until headers are all fixed | ||
113 | #$ret = 1; | ||
114 | } | ||
115 | } | ||
116 | |||