From patchwork Mon Sep 9 19:41:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 273662 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 7A1462C00E7 for ; Tue, 10 Sep 2013 05:43:06 +1000 (EST) Received: from localhost ([::1]:53429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJ7MW-00088D-CM for incoming@patchwork.ozlabs.org; Mon, 09 Sep 2013 15:43:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJ7Lp-0007za-IJ for qemu-devel@nongnu.org; Mon, 09 Sep 2013 15:42:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJ7Ll-0005WU-7v for qemu-devel@nongnu.org; Mon, 09 Sep 2013 15:42:21 -0400 Received: from mail-oa0-x229.google.com ([2607:f8b0:4003:c02::229]:62201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJ7Ll-0005WM-3C for qemu-devel@nongnu.org; Mon, 09 Sep 2013 15:42:17 -0400 Received: by mail-oa0-f41.google.com with SMTP id j6so7022612oag.28 for ; Mon, 09 Sep 2013 12:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=droiqtHUeAFgwNK4Xrn0n/6L9QuWopuibGA8DNpAg78=; b=cGcjSgU+zmP8tR41fq887MTHNQnAXyW2x2Hn18dXNTaNS33Ta+DdNcx2D05xkx4xQW Tfa948WspctcpRcE/ZB+2rRDp1OVdxg7pPZirD+aL7ZcXspOEXFBgP9Y/VxNlk/JiiHz JmwTylWvDyAwWTYCALAZ8y5sJBNkVrcBlVPgtESIa+urnLQQ1qZkYcu9ead4pVBTEEZ8 po+5R2HenlEdDfYF9nBN+4c/1FFfmT+I1TQvmGHNdK8KascQwKIqX9ffAB1vM5Wa590E CZZPPE9DZW48hqh8+H3pueZO9DVdgWsewrV9phBaCntlIN4o3Uvubi5HEfXtVxUeY5HT 5OPA== X-Received: by 10.182.113.195 with SMTP id ja3mr12526637obb.46.1378755736518; Mon, 09 Sep 2013 12:42:16 -0700 (PDT) Received: from loki.austin.ibm.com ([32.97.110.51]) by mx.google.com with ESMTPSA id hl3sm14443740obb.0.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Sep 2013 12:42:16 -0700 (PDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Mon, 9 Sep 2013 14:41:33 -0500 Message-Id: <1378755701-2051-3-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1378755701-2051-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1378755701-2051-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c02::229 Cc: peter.maydell@linaro.org, tomoki.sekiyama@hds.com Subject: [Qemu-devel] [PATCH 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 From: Tomoki Sekiyama 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 Signed-off-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 fcca6ae..baadbc0 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 d00682e..ad1c1ca 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 1069310..750e9fb 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("*")