[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v4 83/83] checkpatch: better pattern for inline comments
From: |
Michael S. Tsirkin |
Subject: |
[PULL v4 83/83] checkpatch: better pattern for inline comments |
Date: |
Mon, 7 Nov 2022 17:54:28 -0500 |
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>
---
scripts/checkpatch.pl | 6 ++++--
1 file 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);
}
--
MST
- [PULL v4 73/83] intel-iommu: convert VTD_PE_GET_FPD_ERR() to be a function, (continued)
- [PULL v4 73/83] intel-iommu: convert VTD_PE_GET_FPD_ERR() to be a function, Michael S. Tsirkin, 2022/11/07
- [PULL v4 74/83] intel-iommu: PASID support, Michael S. Tsirkin, 2022/11/07
- [PULL v4 75/83] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/07
- [PULL v4 76/83] vhost-user: Support vhost_dev_start, Michael S. Tsirkin, 2022/11/07
- [PULL v4 77/83] hw/smbios: add core_count2 to smbios table type 4, Michael S. Tsirkin, 2022/11/07
- [PULL v4 78/83] bios-tables-test: teach test to use smbios 3.0 tables, Michael S. Tsirkin, 2022/11/07
- [PULL v4 79/83] tests/acpi: allow changes for core_count2 test, Michael S. Tsirkin, 2022/11/07
- [PULL v4 80/83] bios-tables-test: add test for number of cores > 255, Michael S. Tsirkin, 2022/11/07
- [PULL v4 81/83] tests/acpi: update tables for new core count test, Michael S. Tsirkin, 2022/11/07
- [PULL v4 82/83] hw/virtio: introduce virtio_device_should_start, Michael S. Tsirkin, 2022/11/07
- [PULL v4 83/83] checkpatch: better pattern for inline comments,
Michael S. Tsirkin <=
- Re: [PULL v4 00/83] pci,pc,virtio: features, tests, fixes, cleanups, Michael S. Tsirkin, 2022/11/08
- Re: [PULL v4 00/83] pci,pc,virtio: features, tests, fixes, cleanups, Philippe Mathieu-Daudé, 2022/11/15