From patchwork Mon Jul 15 16:20:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomoki Sekiyama X-Patchwork-Id: 259113 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 70F912C0095 for ; Tue, 16 Jul 2013 02:21:32 +1000 (EST) Received: from localhost ([::1]:55666 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UylWk-0006Gb-8W for incoming@patchwork.ozlabs.org; Mon, 15 Jul 2013 12:21:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UylWC-0006AZ-Dz for qemu-devel@nongnu.org; Mon, 15 Jul 2013 12:20:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UylW8-0003xQ-Tn for qemu-devel@nongnu.org; Mon, 15 Jul 2013 12:20:56 -0400 Received: from usindpps06.hds.com ([207.126.252.19]:33018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UylW8-0003xM-LF for qemu-devel@nongnu.org; Mon, 15 Jul 2013 12:20: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=GszuY69j5/e6Hvgq5TLpmfJboR+i5Tp3tZ1ZWUOMxb4=; b=JKR4uIvTwwWuPMHMHGjhVPFwn2cZIHIOurDhxN5ZlQil1Dcn27JAmNCFR9g2zuTUJR66 3grE7lwJ1o4HKGI3f7x4Y7Rt01zP1FUGvEFqC6KvL7tS7OGMZb6Y07bZXBBGRbplksyt U49seOnpaHb0ogdWQiaRwS5Cr62ceZIDhwfdeKmhJB407cyNyMhjhlNeyliz5h7MfNWD E81JhuZzq9JrisC847fIoulKKQD1OF9KljSsg2HRHzwa4ocYY4YkdKjV7MfpGcQDcliN 6V6KDFcyMVVGW9cFT4x4wXDyr7NybZnGLK26DFUFqiFmpdNNu1spExIuBwqechlTja9E nA== Received: from usindmail01.hds.com (usindmail03 [207.126.252.22]) by usindpps06.hds.com (8.14.5/8.14.5) with ESMTP id r6FGKZ49028207; Mon, 15 Jul 2013 09:20:35 -0700 Received: from [10.18.17.86] (usindnetf5d-vlan47float.corp.hds.com [10.74.73.11]) by usindmail01.hds.com (8.14.1/8.14.1) with ESMTP id r6FGKXMP006729; Mon, 15 Jul 2013 12:20:34 -0400 (EDT) To: qemu-devel@nongnu.org From: Tomoki Sekiyama Date: Mon, 15 Jul 2013 12:20:33 -0400 Message-ID: <20130715162033.16676.48300.stgit@outback> In-Reply-To: <20130715162023.16676.87828.stgit@outback> References: <20130715162023.16676.87828.stgit@outback> 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-15_04:2013-07-15, 2013-07-15, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=outbound_policy score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.207753575997753 urlsuspect_oldscore=0.997706394249456 suspectscore=1 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=349 rbsscore=0.207753575997753 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1307150134 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 207.126.252.19 Cc: libaiqing@huawei.com, ghammer@redhat.com, stefanha@gmail.com, mdroth@linux.vnet.ibm.com, lcapitulino@redhat.com, vrozenfe@redhat.com, pbonzini@redhat.com, seiji.aguchi@hds.com, Laszlo Ersek , areis@redhat.com Subject: [Qemu-devel] [PATCH v7 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 2daed43..69b1506 100644 --- a/hmp.c +++ b/hmp.c @@ -524,7 +524,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 dcc85ef..5369996 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1461,7 +1461,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 baf1321..942bcc2 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -169,9 +169,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("*")