提交 86ae1911 编写于 作者: E Eric Blake 提交者: Markus Armbruster

qapi: Fix compilation failure on MIPS and SPARC

Commit 86f4b687 broke compilation on MIPS and SPARC, which have a
preprocessor pollution of '#define mips 1' and '#define sparc 1',
respectively.  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_mips', 'q_sparc' spelling.

CC: James Hogan <james.hogan@imgtec.com>
CC: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: NEric Blake <eblake@redhat.com>
Tested-by: NJames Hogan <james.hogan@imgtec.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 455ba08a
...@@ -1576,13 +1576,13 @@ CpuInfoList *qmp_query_cpus(Error **errp) ...@@ -1576,13 +1576,13 @@ CpuInfoList *qmp_query_cpus(Error **errp)
info->value->u.ppc->nip = env->nip; info->value->u.ppc->nip = env->nip;
#elif defined(TARGET_SPARC) #elif defined(TARGET_SPARC)
info->value->arch = CPU_INFO_ARCH_SPARC; info->value->arch = CPU_INFO_ARCH_SPARC;
info->value->u.sparc = g_new0(CpuInfoSPARC, 1); info->value->u.q_sparc = g_new0(CpuInfoSPARC, 1);
info->value->u.sparc->pc = env->pc; info->value->u.q_sparc->pc = env->pc;
info->value->u.sparc->npc = env->npc; info->value->u.q_sparc->npc = env->npc;
#elif defined(TARGET_MIPS) #elif defined(TARGET_MIPS)
info->value->arch = CPU_INFO_ARCH_MIPS; info->value->arch = CPU_INFO_ARCH_MIPS;
info->value->u.mips = g_new0(CpuInfoMIPS, 1); info->value->u.q_mips = g_new0(CpuInfoMIPS, 1);
info->value->u.mips->PC = env->active_tc.PC; info->value->u.q_mips->PC = env->active_tc.PC;
#elif defined(TARGET_TRICORE) #elif defined(TARGET_TRICORE)
info->value->arch = CPU_INFO_ARCH_TRICORE; info->value->arch = CPU_INFO_ARCH_TRICORE;
info->value->u.tricore = g_new0(CpuInfoTricore, 1); info->value->u.tricore = g_new0(CpuInfoTricore, 1);
......
...@@ -319,11 +319,13 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict) ...@@ -319,11 +319,13 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->u.ppc->nip); monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->u.ppc->nip);
break; break;
case CPU_INFO_ARCH_SPARC: case CPU_INFO_ARCH_SPARC:
monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->u.sparc->pc); monitor_printf(mon, " pc=0x%016" PRIx64,
monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->u.sparc->npc); cpu->value->u.q_sparc->pc);
monitor_printf(mon, " npc=0x%016" PRIx64,
cpu->value->u.q_sparc->npc);
break; break;
case CPU_INFO_ARCH_MIPS: case CPU_INFO_ARCH_MIPS:
monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.mips->PC); monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.q_mips->PC);
break; break;
case CPU_INFO_ARCH_TRICORE: case CPU_INFO_ARCH_TRICORE:
monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.tricore->PC); monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.tricore->PC);
......
...@@ -1482,7 +1482,7 @@ def c_name(name, protect=True): ...@@ -1482,7 +1482,7 @@ def c_name(name, protect=True):
'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not', 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
'not_eq', 'or', 'or_eq', 'xor', 'xor_eq']) 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'])
# namespace pollution: # namespace pollution:
polluted_words = set(['unix', 'errno']) polluted_words = set(['unix', 'errno', 'mips', 'sparc'])
name = name.translate(c_name_trans) name = name.translate(c_name_trans)
if protect and (name in c89_words | c99_words | c11_words | gcc_words if protect and (name in c89_words | c99_words | c11_words | gcc_words
| cpp_words | polluted_words): | cpp_words | polluted_words):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册