[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v12 24/36] cpu: Convert CpuInfo into flat union
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH v12 24/36] cpu: Convert CpuInfo into flat union |
Date: |
Tue, 02 Feb 2016 14:49:49 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
James Hogan <address@hidden> writes:
> Hi Eric,
>
> On 18 November 2015 at 08:52, Eric Blake <address@hidden> wrote:
>> +# An enumeration of cpu types that enable additional information during
>> +# @query-cpus.
>> +#
>> +# Since: 2.6
>> +##
>> +{ 'enum': 'CpuInfoArch',
>> + 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 'other' ] }
>> +
>
> ...
>
>> +##
>> +# @CpuInfo:
>> +#
>> +# Information about a virtual CPU
>> +#
>> +# Since: 0.14.0
>> +##
>> +{ 'union': 'CpuInfo', 'base': 'CpuInfoBase', 'discriminator': 'arch',
>> + 'data': { 'x86': 'CpuInfoX86',
>> + 'sparc': 'CpuInfoSparc',
>> + 'ppc': 'CpuInfoPpc',
>> + 'mips': 'CpuInfoMips',
>
> This is causing compilation issues on MIPS, because gcc bizarrely
> defines mips=1:
>
> $ mips-img-linux-gnu-gcc -dM -E - </dev/null | grep '\bmips\b'
> #define mips 1
Bizarre indeed.
See also
https://gcc.gnu.org/onlinedocs/gcc-5.3.0/cpp/System-specific-Predefined-Macros.html#System-specific-Predefined-Macros
> For example:
> CC qga/commands.o
> In file included from /work/mips/qemu/msa/include/qapi/qmp/qobject.h:37:0,
> from /work/mips/qemu/msa/include/qapi/qmp/dispatch.h:17,
> from ./qga/guest-agent-core.h:13,
> from qga/commands.c:14:
> ./qapi-types.h:2568:22: error: expected identifier or ‘(’ before
> numeric constant
> CpuInfoMIPS *mips;
> ^
> /work/mips/qemu/msa/rules.mak:57: recipe for target 'qga/commands.o' failed
> make: *** [qga/commands.o] Error 1
>
>
> Any suggestions for a fix that is less ugly than this:
#undef mips with a suitable comment?
[...]