lint/checkpatch: Add check for used comma where semicolon could be

This reduce the difference with linux v5.19-rc7.

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I6d3a49378008bad61b2a18bd8cb28be952a18006
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65837
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin L Roth <gaumless@tutanota.com>
This commit is contained in:
Elyes Haouas 2022-07-13 18:07:58 +02:00 committed by Martin L Roth
parent f9a3554a4a
commit 50eef6566b

View File

@ -5055,6 +5055,17 @@ sub process {
}
}
# check if a statement with a comma should be two statements like:
# foo = bar(), /* comma should be semicolon */
# bar = baz();
if (defined($stat) &&
$stat =~ /^\+\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*,\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*;\s*$/) {
my $cnt = statement_rawlines($stat);
my $herectx = get_stat_here($linenr, $cnt, $here);
WARN("SUSPECT_COMMA_SEMICOLON",
"Possible comma where semicolon could be used\n" . $herectx);
}
# return is not a function
if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
my $spacing = $1;