summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael S. Tsirkin2022-11-07 15:52:16 +0100
committerMichael S. Tsirkin2022-11-07 20:25:51 +0100
commit1ef47f40dce3d5b176ddf76d57b5bfa2efb0b3c6 (patch)
tree56bc52f2372ed6486eddde03af53e40fa66cb2c1 /scripts
parenthw/virtio: introduce virtio_device_should_start (diff)
downloadqemu-1ef47f40dce3d5b176ddf76d57b5bfa2efb0b3c6.tar.gz
qemu-1ef47f40dce3d5b176ddf76d57b5bfa2efb0b3c6.tar.xz
qemu-1ef47f40dce3d5b176ddf76d57b5bfa2efb0b3c6.zip
checkpatch: better pattern for inline comments
checkpatch is unhappy about this line: WARNING: Block comments use a leading /* on a separate line #50: FILE: hw/acpi/nvdimm.c:1074: + aml_equal(aml_sizeof(pckg), aml_int(1)) /* 1 element? */)); but there's nothing wrong with it - the check is just too simplistic. It will also miss lines which mix inline and block comments. Instead, let's strip all inline comments from a line and then check for block comments. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3e3b43076..bc7d4780ec 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1681,8 +1681,10 @@ sub process {
# Block comment styles
# Block comments use /* on a line of its own
- if ($rawline !~ m@^\+.*/\*.*\*/[ \t)}]*$@ && #inline /*...*/
- $rawline =~ m@^\+.*/\*\*?+[ \t]*[^ \t]@) { # /* or /** non-blank
+ my $commentline = $rawline;
+ while ($commentline =~ s@^(\+.*)/\*.*\*/@$1@o) { # remove inline #inline /*...*/
+ }
+ if ($commentline =~ m@^\+.*/\*\*?+[ \t]*[^ \t]@) { # /* or /** non-blank
WARN("Block comments use a leading /* on a separate line\n" . $herecurr);
}