* [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS
@ 2016-02-02 14:51 Eric Blake
2016-02-02 15:06 ` James Hogan
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Eric Blake @ 2016-02-02 14:51 UTC (permalink / raw)
To: qemu-devel
Cc: James Hogan, Michael Roth, Peter Crosthwaite, armbru,
Luiz Capitulino, Paolo Bonzini, Richard Henderson
Commit 86f4b687 broke compilation on MIPS, which has a preprocessor
pollution of '#define mips 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_mips' spelling.
CC: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
scripts/qapi.py | 2 +-
cpus.c | 4 ++--
hmp.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/qapi.py b/scripts/qapi.py
index d199222..7f114c4 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'])
+ polluted_words = set(['unix', 'errno', 'mips'])
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 882b618..c8a2317 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1581,8 +1581,8 @@ CpuInfoList *qmp_query_cpus(Error **errp)
info->value->u.sparc->npc = env->npc;
#elif defined(TARGET_MIPS)
info->value->arch = CPU_INFO_ARCH_MIPS;
- info->value->u.mips = g_new0(CpuInfoMIPS, 1);
- info->value->u.mips->PC = env->active_tc.PC;
+ info->value->u.q_mips = g_new0(CpuInfoMIPS, 1);
+ info->value->u.q_mips->PC = env->active_tc.PC;
#elif defined(TARGET_TRICORE)
info->value->arch = CPU_INFO_ARCH_TRICORE;
info->value->u.tricore = g_new0(CpuInfoTricore, 1);
diff --git a/hmp.c b/hmp.c
index a4b74df..ef98344 100644
--- a/hmp.c
+++ b/hmp.c
@@ -322,7 +322,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->u.sparc->npc);
break;
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;
case CPU_INFO_ARCH_TRICORE:
monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.tricore->PC);
--
2.5.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS
2016-02-02 14:51 [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS Eric Blake
@ 2016-02-02 15:06 ` James Hogan
2016-02-02 16:14 ` Markus Armbruster
2016-02-02 17:26 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: James Hogan @ 2016-02-02 15:06 UTC (permalink / raw)
To: Eric Blake
Cc: Michael Roth, Peter Crosthwaite, armbru, qemu-devel,
Luiz Capitulino, Paolo Bonzini, Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 2677 bytes --]
On Tue, Feb 02, 2016 at 07:51:41AM -0700, Eric Blake wrote:
> Commit 86f4b687 broke compilation on MIPS, which has a preprocessor
> pollution of '#define mips 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_mips' spelling.
>
> CC: James Hogan <james.hogan@imgtec.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
Thanks, that fixes the build for me.
Tested-by: James Hogan <james.hogan@imgtec.com>
Cheers
James
> ---
> scripts/qapi.py | 2 +-
> cpus.c | 4 ++--
> hmp.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index d199222..7f114c4 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'])
> + polluted_words = set(['unix', 'errno', 'mips'])
> 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 882b618..c8a2317 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -1581,8 +1581,8 @@ CpuInfoList *qmp_query_cpus(Error **errp)
> info->value->u.sparc->npc = env->npc;
> #elif defined(TARGET_MIPS)
> info->value->arch = CPU_INFO_ARCH_MIPS;
> - info->value->u.mips = g_new0(CpuInfoMIPS, 1);
> - info->value->u.mips->PC = env->active_tc.PC;
> + info->value->u.q_mips = g_new0(CpuInfoMIPS, 1);
> + info->value->u.q_mips->PC = env->active_tc.PC;
> #elif defined(TARGET_TRICORE)
> info->value->arch = CPU_INFO_ARCH_TRICORE;
> info->value->u.tricore = g_new0(CpuInfoTricore, 1);
> diff --git a/hmp.c b/hmp.c
> index a4b74df..ef98344 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -322,7 +322,7 @@ void hmp_info_cpus(Monitor *mon, const QDict *qdict)
> monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->u.sparc->npc);
> break;
> 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;
> case CPU_INFO_ARCH_TRICORE:
> monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.tricore->PC);
> --
> 2.5.0
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS
2016-02-02 14:51 [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS Eric Blake
2016-02-02 15:06 ` James Hogan
@ 2016-02-02 16:14 ` Markus Armbruster
2016-02-02 17:26 ` Peter Maydell
2 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2016-02-02 16:14 UTC (permalink / raw)
To: Eric Blake
Cc: James Hogan, Michael Roth, Peter Crosthwaite, qemu-devel,
Luiz Capitulino, Paolo Bonzini, Richard Henderson
Eric Blake <eblake@redhat.com> writes:
> Commit 86f4b687 broke compilation on MIPS, which has a preprocessor
> pollution of '#define mips 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_mips' spelling.
>
> CC: James Hogan <james.hogan@imgtec.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
Applied to qapi-next, thanks!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS
2016-02-02 14:51 [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS Eric Blake
2016-02-02 15:06 ` James Hogan
2016-02-02 16:14 ` Markus Armbruster
@ 2016-02-02 17:26 ` Peter Maydell
2016-02-02 17:45 ` Eric Blake
2 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2016-02-02 17:26 UTC (permalink / raw)
To: Eric Blake
Cc: James Hogan, Michael Roth, Peter Crosthwaite, QEMU Developers,
Markus Armbruster, Luiz Capitulino, Paolo Bonzini,
Richard Henderson
On 2 February 2016 at 14:51, Eric Blake <eblake@redhat.com> wrote:
> Commit 86f4b687 broke compilation on MIPS, which has a preprocessor
> pollution of '#define mips 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_mips' spelling.
>
> CC: James Hogan <james.hogan@imgtec.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> scripts/qapi.py | 2 +-
> cpus.c | 4 ++--
> hmp.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index d199222..7f114c4 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'])
> + polluted_words = set(['unix', 'errno', 'mips'])
> name = name.translate(c_name_trans)
> if protect and (name in c89_words | c99_words | c11_words | gcc_words
> | cpp_words | polluted_words):
Looking at commit 86f4b687 I think we also need to add 'sparc' to the
polluted_words list (Solaris defines that). I would also be unsurprised
to find that some PPC platforms define 'ppc'. (Tricore is probably
new enough to have escaped this namespace pollution and we don't
support it as a host CPU anyway.)
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS
2016-02-02 17:26 ` Peter Maydell
@ 2016-02-02 17:45 ` Eric Blake
2016-02-02 18:16 ` Peter Maydell
0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2016-02-02 17:45 UTC (permalink / raw)
To: Peter Maydell
Cc: James Hogan, Michael Roth, Peter Crosthwaite, QEMU Developers,
Markus Armbruster, Luiz Capitulino, Paolo Bonzini,
Richard Henderson
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
On 02/02/2016 10:26 AM, Peter Maydell wrote:
> On 2 February 2016 at 14:51, Eric Blake <eblake@redhat.com> wrote:
>> Commit 86f4b687 broke compilation on MIPS, which has a preprocessor
>> pollution of '#define mips 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_mips' spelling.
>>
>> CC: James Hogan <james.hogan@imgtec.com>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>> ---
>> # namespace pollution:
>> - polluted_words = set(['unix', 'errno'])
>> + polluted_words = set(['unix', 'errno', 'mips'])
>> name = name.translate(c_name_trans)
>> if protect and (name in c89_words | c99_words | c11_words | gcc_words
>> | cpp_words | polluted_words):
>
> Looking at commit 86f4b687 I think we also need to add 'sparc' to the
> polluted_words list (Solaris defines that). I would also be unsurprised
> to find that some PPC platforms define 'ppc'. (Tricore is probably
> new enough to have escaped this namespace pollution and we don't
> support it as a host CPU anyway.)
Do we have anyone that can confirm on these platforms? Obviously, I
proved that it's fairly easy to work around, and I don't mind doing the
followup patch(es), but only if we have concrete cases where we know it
is needed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS
2016-02-02 17:45 ` Eric Blake
@ 2016-02-02 18:16 ` Peter Maydell
0 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2016-02-02 18:16 UTC (permalink / raw)
To: Eric Blake
Cc: James Hogan, Michael Roth, Peter Crosthwaite, QEMU Developers,
Markus Armbruster, Luiz Capitulino, Paolo Bonzini,
Richard Henderson
On 2 February 2016 at 17:45, Eric Blake <eblake@redhat.com> wrote:
> On 02/02/2016 10:26 AM, Peter Maydell wrote:
>> On 2 February 2016 at 14:51, Eric Blake <eblake@redhat.com> wrote:
>>> Commit 86f4b687 broke compilation on MIPS, which has a preprocessor
>>> pollution of '#define mips 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_mips' spelling.
>>>
>>> CC: James Hogan <james.hogan@imgtec.com>
>>> Signed-off-by: Eric Blake <eblake@redhat.com>
>>> ---
>
>>> # namespace pollution:
>>> - polluted_words = set(['unix', 'errno'])
>>> + polluted_words = set(['unix', 'errno', 'mips'])
>>> name = name.translate(c_name_trans)
>>> if protect and (name in c89_words | c99_words | c11_words | gcc_words
>>> | cpp_words | polluted_words):
>>
>> Looking at commit 86f4b687 I think we also need to add 'sparc' to the
>> polluted_words list (Solaris defines that). I would also be unsurprised
>> to find that some PPC platforms define 'ppc'. (Tricore is probably
>> new enough to have escaped this namespace pollution and we don't
>> support it as a host CPU anyway.)
>
> Do we have anyone that can confirm on these platforms? Obviously, I
> proved that it's fairly easy to work around, and I don't mind doing the
> followup patch(es), but only if we have concrete cases where we know it
> is needed.
I just started up the elderly debian sparc VM image I have lying
around and installed the compiler, which is enough to confirm that
it does "#define sparc 1".
We know PPC Linux doesn't define 'ppc' because the ppc64be build
I do as part of pull request processing worked OK.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=728710#25
suggests it uses "powerpc" and "PPC" so we're OK there.
thanks
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-02 18:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-02 14:51 [Qemu-devel] [PATCH] qapi: Fix compilation failure on MIPS Eric Blake
2016-02-02 15:06 ` James Hogan
2016-02-02 16:14 ` Markus Armbruster
2016-02-02 17:26 ` Peter Maydell
2016-02-02 17:45 ` Eric Blake
2016-02-02 18:16 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.