From patchwork Wed Jun 29 06:09:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 102756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 00CCDB6EE9 for ; Thu, 30 Jun 2011 22:55:37 +1000 (EST) Received: from localhost ([::1]:52118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcGmL-0001vB-I5 for incoming@patchwork.ozlabs.org; Thu, 30 Jun 2011 08:55:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:47803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcGQr-0005ZZ-6Q for qemu-devel@nongnu.org; Thu, 30 Jun 2011 08:33:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QcGQo-00062A-GU for qemu-devel@nongnu.org; Thu, 30 Jun 2011 08:33:20 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42925 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QcGQo-00061x-3Q for qemu-devel@nongnu.org; Thu, 30 Jun 2011 08:33:18 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 0192B8AC33; Thu, 30 Jun 2011 14:33:17 +0200 (CEST) From: Alexander Graf To: "qemu-devel@nongnu.org Developers" Date: Wed, 29 Jun 2011 08:09:33 +0200 Message-Id: <1309327773-18966-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Kevin Wolf Subject: [Qemu-devel] [PATCH] checkpatch: don't error out on },{ lines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Signed-off-by: Alexander Graf --- 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); }