summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorElyes Haouas <ehaouas@noos.fr>2022-07-13 18:07:58 +0200
committerMartin L Roth <gaumless@tutanota.com>2022-07-19 01:48:35 +0000
commit50eef6566b223eb2a6c027e9a862bc279bd06ed7 (patch)
tree14a1d734cb3d47851448172d35b1d4b5cb85c60e /util
parentf9a3554a4afd88dd2a606cf97e315bcdbe1fe8a6 (diff)
downloadcoreboot-50eef6566b223eb2a6c027e9a862bc279bd06ed7.tar.gz
coreboot-50eef6566b223eb2a6c027e9a862bc279bd06ed7.tar.bz2
coreboot-50eef6566b223eb2a6c027e9a862bc279bd06ed7.zip
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>
Diffstat (limited to 'util')
-rwxr-xr-xutil/lint/checkpatch.pl11
1 files changed, 11 insertions, 0 deletions
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl
index 2fc3c14dec27..650ddffd98cb 100755
--- a/util/lint/checkpatch.pl
+++ b/util/lint/checkpatch.pl
@@ -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;