diff options
-rwxr-xr-x | scripts/checkpatch.pl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7c79c91662c8..e2cb1f4621b7 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -3878,6 +3878,16 @@ sub process { | |||
3878 | } | 3878 | } |
3879 | } | 3879 | } |
3880 | 3880 | ||
3881 | # check for new externs in .h files. | ||
3882 | if ($realfile =~ /\.h$/ && | ||
3883 | $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) { | ||
3884 | if (WARN("AVOID_EXTERNS", | ||
3885 | "extern prototypes should be avoided in .h files\n" . $herecurr) && | ||
3886 | $fix) { | ||
3887 | $fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/; | ||
3888 | } | ||
3889 | } | ||
3890 | |||
3881 | # check for new externs in .c files. | 3891 | # check for new externs in .c files. |
3882 | if ($realfile =~ /\.c$/ && defined $stat && | 3892 | if ($realfile =~ /\.c$/ && defined $stat && |
3883 | $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) | 3893 | $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s) |