From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQgGb-0004KB-LY for qemu-devel@nongnu.org; Tue, 02 Feb 2016 14:05:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQgGY-0004gU-DR for qemu-devel@nongnu.org; Tue, 02 Feb 2016 14:05:33 -0500 Received: from resqmta-po-02v.sys.comcast.net ([96.114.154.161]:60360) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQgGY-0004gQ-7F for qemu-devel@nongnu.org; Tue, 02 Feb 2016 14:05:30 -0500 From: Eric Blake Date: Tue, 2 Feb 2016 12:05:20 -0700 Message-Id: <1454439920-14661-1-git-send-email-eblake@redhat.com> Subject: [Qemu-devel] [PATCH] qapi: Fix compilation failure on sparc List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Michael Roth , Peter Crosthwaite , armbru@redhat.com, Luiz Capitulino , Paolo Bonzini , Richard Henderson Commit 86f4b687 broke compilation on sparc, which has a preprocessor pollution of '#define sparc 1'. Treat it the same way as we do for the pollution with 'unix', so that QMP remains backwards compatible and only the C code needs to use the alternative 'q_sparc' spelling. CC: Peter Maydell Signed-off-by: Eric Blake --- Done as a followup to the same style of patch for MIPS; or we could squash this into one patch. scripts/qapi.py | 2 +- cpus.c | 6 +++--- hmp.c | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 7f114c4..965b157 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -1482,7 +1482,7 @@ def c_name(name, protect=True): 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not', 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq']) # namespace pollution: - polluted_words = set(['unix', 'errno', 'mips']) + polluted_words = set(['unix', 'errno', 'mips', 'sparc']) name = name.translate(c_name_trans) if protect and (name in c89_words | c99_words | c11_words | gcc_words | cpp_words | polluted_words): diff --git a/cpus.c b/cpus.c index c8a2317..898426c 100644 --- a/cpus.c +++ b/cpus.c @@ -1576,9 +1576,9 @@ CpuInfoList *qmp_query_cpus(Error **errp) info->value->u.ppc->nip = env->nip; #elif defined(TARGET_SPARC) info->value->arch = CPU_INFO_ARCH_SPARC; - info->value->u.sparc = g_new0(CpuInfoSPARC, 1); - info->value->u.sparc->pc = env->pc; - info->value->u.sparc->npc = env->npc; + info->value->u.q_sparc = g_new0(CpuInfoSPARC, 1); + info->value->u.q_sparc->pc = env->pc; + info->value->u.q_sparc->npc = env->npc; #elif defined(TARGET_MIPS) info->value->arch = CPU_INFO_ARCH_MIPS; info->value->u.q_mips = g_new0(CpuInfoMIPS, 1); diff --git a/hmp.c b/hmp.c index ef98344..cbf6d61 100644 --- a/hmp.c +++ b/hmp.c @@ -318,8 +318,10 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict) monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->u.ppc->nip); break; case CPU_INFO_ARCH_SPARC: - monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->u.sparc->pc); - monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->u.sparc->npc); + monitor_printf(mon, " pc=0x%016" PRIx64, + cpu->value->u.q_sparc->pc); + monitor_printf(mon, " npc=0x%016" PRIx64, + cpu->value->u.q_sparc->npc); break; case CPU_INFO_ARCH_MIPS: monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.q_mips->PC); -- 2.5.0