Commit d1d85780dd30e137d8ff505c1c2e79eaf729853d

Authored by Joe Perches
Committed by Linus Torvalds
1 parent 58f09e00ae

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: Joe Perches <joe@perches.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

scripts/checkpatch.pl
... ... @@ -3975,8 +3975,8 @@
3975 3975 # check for new externs in .h files.
3976 3976 if ($realfile =~ /\.h$/ &&
3977 3977 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
3978   - if (WARN("AVOID_EXTERNS",
3979   - "extern prototypes should be avoided in .h files\n" . $herecurr) &&
  3978 + if (CHK("AVOID_EXTERNS",
  3979 + "extern prototypes should be avoided in .h files\n" . $herecurr) &&
3980 3980 $fix) {
3981 3981 $fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
3982 3982 }