aboutsummaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJoe Perches2013-09-11 14:23:55 -0700
committerLinus Torvalds2013-09-11 15:58:40 -0700
commit7e781f67df436b67753a65436c0fef0a0ebf5043 (patch)
tree3fd10d6d6bb55e684adb77f9958d9db269aa9272 /scripts/checkpatch.pl
parentd5e616fc1c1dd673c53b682877e2d35a2862263c (diff)
checkpatch: check CamelCase by word, not by $Lval
$Lval is a test for complete name (ie: foo->bar.Baz[1]) If any of this is CamelCase, then the current test uses the entire $Lval. This isn't optimal because it can emit messages with foo->bar.Baz and bar.Baz when Baz is a variable specified in an include file. So instead, break the $Lval into words and check each word for CamelCase uses. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9163651edc50..6b409b0ad457 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3302,11 +3302,15 @@ sub process {
$var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show)
$var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) {
- seed_camelcase_includes() if ($check);
- if (!defined $camelcase{$var}) {
- $camelcase{$var} = 1;
- CHK("CAMELCASE",
- "Avoid CamelCase: <$var>\n" . $herecurr);
+ while ($var =~ m{($Ident)}g) {
+ my $word = $1;
+ next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
+ seed_camelcase_includes() if ($check);
+ if (!defined $camelcase{$word}) {
+ $camelcase{$word} = 1;
+ CHK("CAMELCASE",
+ "Avoid CamelCase: <$word>\n" . $herecurr);
+ }
}
}
}