提交 d1d85780 编写于 作者: J Joe Perches 提交者: Linus Torvalds

checkpatch: make extern in .h prototypes quieter

The use of extern in .h files is a bit contentious.

Make the warning be emitted only when --strict is used on the command
line.
Signed-off-by: NJoe Perches <joe@perches.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 58f09e00
...@@ -3975,8 +3975,8 @@ sub string_find_replace { ...@@ -3975,8 +3975,8 @@ sub string_find_replace {
# check for new externs in .h files. # check for new externs in .h files.
if ($realfile =~ /\.h$/ && if ($realfile =~ /\.h$/ &&
$line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) { $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
if (WARN("AVOID_EXTERNS", if (CHK("AVOID_EXTERNS",
"extern prototypes should be avoided in .h files\n" . $herecurr) && "extern prototypes should be avoided in .h files\n" . $herecurr) &&
$fix) { $fix) {
$fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/; $fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册