Commit ffbce897 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

checkpatch: improve SPDX license checking

Use perl's m@<match>@ match and not /<match>/ comparisons to avoid
an error using c90's // comment style.

Miscellanea:

o Use normal tab indentation and alignment

Link: http://lkml.kernel.org/r/5e4a8fa7901148fbcd77ab391e6dd0e6bf95777f.camel@perches.com

Link: http://lkml.kernel.org/r/f08eb62458407a145cfedf959d1091af151cd665.1563575364.git.joe@perches.comSigned-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 634cffcc
...@@ -3071,21 +3071,21 @@ sub process { ...@@ -3071,21 +3071,21 @@ sub process {
# check SPDX comment style for .[chsS] files # check SPDX comment style for .[chsS] files
if ($realfile =~ /\.[chsS]$/ && if ($realfile =~ /\.[chsS]$/ &&
$rawline =~ /SPDX-License-Identifier:/ && $rawline =~ /SPDX-License-Identifier:/ &&
$rawline !~ /^\+\s*\Q$comment\E\s*/) { $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
WARN("SPDX_LICENSE_TAG", WARN("SPDX_LICENSE_TAG",
"Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr); "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
} }
if ($comment !~ /^$/ && if ($comment !~ /^$/ &&
$rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) { $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
WARN("SPDX_LICENSE_TAG", WARN("SPDX_LICENSE_TAG",
"Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr); "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
} elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) { } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
my $spdx_license = $1; my $spdx_license = $1;
if (!is_SPDX_License_valid($spdx_license)) { if (!is_SPDX_License_valid($spdx_license)) {
WARN("SPDX_LICENSE_TAG", WARN("SPDX_LICENSE_TAG",
"'$spdx_license' is not supported in LICENSES/...\n" . $herecurr); "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
} }
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment