WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 10/12] checkpatch: don't error out on },{ lines

To: "qemu-devel@xxxxxxxxxx Developers" <qemu-devel@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH 10/12] checkpatch: don't error out on },{ lines
From: Alexander Graf <agraf@xxxxxxx>
Date: Tue, 5 Jul 2011 18:51:11 +0200
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx Devel" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Anthony Liguori <anthony@xxxxxxxxxxxxx>
Delivery-date: Tue, 05 Jul 2011 10:04:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1309884673-18965-1-git-send-email-agraf@xxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1309884673-18965-1-git-send-email-agraf@xxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
When having code like this:

    static PCIDeviceInfo piix_ide_info[] = {
        {
            .qdev.name    = "piix3-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371SB_1,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            .qdev.name    = "piix4-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371AB,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            /* end of list */
        }
    };

checkpatch currently errors out, claiming that spaces need to follow
commas. However, this particular style of defining structs is pretty
common in qemu code and very readable. So let's declare it as supported
for the above case.

Reported-by: Kevin Wolf <kwolf@xxxxxxxxxx>
Signed-off-by: Alexander Graf <agraf@xxxxxxx>
---
 scripts/checkpatch.pl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 075b614..70a2111 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2068,8 +2068,10 @@ sub process {
                                        }
 
                                # , must have a space on the right.
+                                # not required when having a single },{ on one 
line
                                } elsif ($op eq ',') {
-                                       if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) {
+                                       if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/ &&
+                                            ($elements[$n] . $elements[$n + 
2]) !~ " *}{") {
                                                ERROR("space required after 
that '$op' $at\n" . $hereptr);
                                        }
 
-- 
1.6.0.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel