From patchwork Wed Jul 31 22:24:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomoki Sekiyama X-Patchwork-Id: 263828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C21BF2C00A8 for ; Thu, 1 Aug 2013 09:06:57 +1000 (EST) Received: from localhost ([::1]:43179 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4fTq-0006K5-Nh for incoming@patchwork.ozlabs.org; Wed, 31 Jul 2013 19:06:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4fTW-0006JT-H8 for qemu-devel@nongnu.org; Wed, 31 Jul 2013 19:06:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4fTR-0001t0-Jc for qemu-devel@nongnu.org; Wed, 31 Jul 2013 19:06:34 -0400 Received: from usindpps03.hds.com ([207.126.252.16]:48706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4epA-0003op-LO for qemu-devel@nongnu.org; Wed, 31 Jul 2013 18:24:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hds.com; h=subject : to : from : cc : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=mail1; bh=bMyN6S67zdTq9Rx/2prduxpWbCgBzQNxiN4GndSqDIQ=; b=hb/1l1kieUpXA93+7+jP5oLmzEzfg0TO9ggEZHzB+wrIrUbwXL+FR0q0Z1t4g/MmD0cG 6yvH4GjE99CLGRn+T7ZYLe9Kgg4Y6oYcg0vRqftqjZLJkqAF3tG3iTNvghSxa5pKgkpk elt/r5YWOIM0aX7nBTw34zXoSXl1DvZIRQXw+7gbimncngixrSEVUcNpjA9EWoheOKRw FwDfOceZbIytTseCjOQkWSPRhRPAdpZECXl2rf8iDTmzyoK5d3P6lFFxE7TS8Ms1VCl3 pCzBl4hMJdGaCPcXckMu/VPHVKgrs7l+KA9tkkL71EQdkH+cadhtyInsRecVh0EEPrdt cw== Received: from usindmail01.hds.com (usindmail03 [207.126.252.22]) by usindpps03.hds.com (8.14.5/8.14.5) with ESMTP id r6VMOkm7002906; Wed, 31 Jul 2013 18:24:46 -0400 Received: from hds.com (usindnetf5d-vlan47float.corp.hds.com [10.74.73.11]) by usindmail01.hds.com (8.14.1/8.14.1) with ESMTP id r6VMOiXH011464; Wed, 31 Jul 2013 18:24:45 -0400 (EDT) To: qemu-devel@nongnu.org From: Tomoki Sekiyama Date: Wed, 31 Jul 2013 18:24:44 -0400 Message-ID: <20130731222444.13673.45518.stgit@hds.com> In-Reply-To: <20130731222435.13673.16685.stgit@hds.com> References: <20130731222435.13673.16685.stgit@hds.com> User-Agent: StGit/0.16 MIME-Version: 1.0 X-Proofpoint-SPF-Result: pass X-Proofpoint-SPF-Record: v=spf1 mx ip4:207.126.244.0/26 ip4:207.126.252.0/25 include:mktomail.com include:cloud.hds.com ~all X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794, 1.0.431, 0.0.0000 definitions=2013-07-31_09:2013-07-31, 2013-07-31, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=outbound_policy score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1307310193 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 207.126.252.16 Cc: libaiqing@huawei.com, ghammer@redhat.com, stefanha@gmail.com, Michael Roth , lcapitulino@redhat.com, vrozenfe@redhat.com, pbonzini@redhat.com, seiji.aguchi@hds.com, Laszlo Ersek , areis@redhat.com Subject: [Qemu-devel] [PATCH v9 02/10] Add c++ keywords to QAPI helper script 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 Add c++ keywords to avoid errors in compiling with c++ compiler. This also renames class member of PciDeviceInfo to q_class. Signed-off-by: Tomoki Sekiyama Reviewed-by: Laszlo Ersek Reviewed-by: Michael Roth --- hmp.c | 2 +- hw/pci/pci.c | 2 +- scripts/qapi.py | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hmp.c b/hmp.c index c45514b..79931d2 100644 --- a/hmp.c +++ b/hmp.c @@ -528,7 +528,7 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev) if (dev->class_info.has_desc) { monitor_printf(mon, "%s", dev->class_info.desc); } else { - monitor_printf(mon, "Class %04" PRId64, dev->class_info.class); + monitor_printf(mon, "Class %04" PRId64, dev->class_info.q_class); } monitor_printf(mon, ": PCI device %04" PRIx64 ":%04" PRIx64 "\n", diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 4c004f5..25d08eb 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1466,7 +1466,7 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus, info->function = PCI_FUNC(dev->devfn); class = pci_get_word(dev->config + PCI_CLASS_DEVICE); - info->class_info.class = class; + info->class_info.q_class = class; desc = get_class_desc(class); if (desc->desc) { info->class_info.has_desc = true; diff --git a/scripts/qapi.py b/scripts/qapi.py index 0ebea94..d0a92df 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -236,9 +236,19 @@ def c_var(name, protect=True): # GCC http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/C-Extensions.html # excluding _.* gcc_words = set(['asm', 'typeof']) + # C++ ISO/IEC 14882:2003 2.11 + cpp_words = set(['bool', 'catch', 'class', 'const_cast', 'delete', + 'dynamic_cast', 'explicit', 'false', 'friend', 'mutable', + 'namespace', 'new', 'operator', 'private', 'protected', + 'public', 'reinterpret_cast', 'static_cast', 'template', + 'this', 'throw', 'true', 'try', 'typeid', 'typename', + 'using', 'virtual', 'wchar_t', + # alternative representations + 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not', + 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq']) # namespace pollution: polluted_words = set(['unix']) - if protect and (name in c89_words | c99_words | c11_words | gcc_words | polluted_words): + if protect and (name in c89_words | c99_words | c11_words | gcc_words | cpp_words | polluted_words): return "q_" + name return name.replace('-', '_').lstrip("*")