qapi: Fix compilation failure on sparc
PATCH 1/1 qapi: Fix compilation failure on sparc
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.
---
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(-)
scripts/qapi.py +1 -1
@@ -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):
cpus.c +3 -3
@@ -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 );
hmp.c +4 -2
@@ -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);
Signature · 1 line
2.5.0
Quoted 11 lines · Eric Blake
Commit
86f4b687broke 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 <[email protected]>Signed-off-by Eric Blake <[email protected]>---
Done as a followup to the same style of patch for MIPS; or we could squash this into one patch.
Applied to qapi-next squashed:
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 space 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' spelling.
Quoted 14 lines · Markus Armbruster
Quoted 11 lines · Eric Blake
Commit
86f4b687broke 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 <[email protected]>Signed-off-by Eric Blake <[email protected]>---
Done as a followup to the same style of patch for MIPS; or we could squash this into one patch.
Quoted 6 lines
Applied to qapi-next squashed:
qapi: Fix compilation failure on MIPS and SPARC
Commit
86f4b687broke compilation on MIPS and SPARC, which have a preprocessor pollution of '#define mips 1' and '#define space 1',
s/space/sparc/
Quoted 10 lines
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' spelling.CC James Hogan <[email protected]>CC Peter Maydell <[email protected]>Signed-off-by Eric Blake <[email protected]>Tested-by James Hogan <[email protected]>Signed-off-by Markus Armbruster <[email protected]>
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 15 lines · Eric Blake
Quoted 14 lines · Markus Armbruster
Quoted 11 lines · Eric Blake
Commit
86f4b687broke 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 <[email protected]>Signed-off-by Eric Blake <[email protected]>---
Done as a followup to the same style of patch for MIPS; or we could squash this into one patch.
Quoted 19 lines
Quoted 6 lines
Applied to qapi-next squashed:
qapi: Fix compilation failure on MIPS and SPARC
Commit
86f4b687broke compilation on MIPS and SPARC, which have a preprocessor pollution of '#define mips 1' and '#define space 1',s/space/sparc/
Quoted 10 lines
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' spelling.CC James Hogan <[email protected]>CC Peter Maydell <[email protected]>Signed-off-by Eric Blake <[email protected]>Tested-by James Hogan <[email protected]>Signed-off-by Markus Armbruster <[email protected]>
Fixed up and pushed again. Thanks!