Skip to content

Commit 2e16816

Browse files
committed
Fix FP REPEATED_WORD error for variable declarations
Don't complain about variable declarations in C/C++ and protobuf files: Foo foo; Bar bar = 123; required Buzz buzz; Closes #45
1 parent ec1de49 commit 2e16816

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

checkpatch.pl

+5-1
Original file line numberDiff line numberDiff line change
@@ -2693,7 +2693,7 @@ sub process {
26932693
my $second = $2;
26942694
my $start_pos = $-[1];
26952695
my $end_pos = $+[2];
2696-
if ($first =~ /(?:struct|union|enum)/) {
2696+
if ($first =~ /(?:class|struct|union|enum)/) {
26972697
pos($rawline) += length($first) + length($second) + 1;
26982698
next;
26992699
}
@@ -2705,6 +2705,10 @@ sub process {
27052705
# @param request Request to process
27062706
next if $rawline =~ /^\+\s\*\s+[\@\\]param(?:\[[a-z,]*\])*\s+$first $second/;
27072707

2708+
# Ignore variable declarations.
2709+
next if $realfile =~ /.h|c|cc|proto$/ &&
2710+
$rawline =~ /^\+\s*(?:(?:$Storage|$Modifier|optional|required|repeated)\s+)*$first\s+$second\s*[=;]/;
2711+
27082712
# check for character before and after the word matches
27092713
my $start_char = '';
27102714
my $end_char = '';

0 commit comments

Comments
 (0)