qemu 1.7.0 does not build on NetBSD (patch)
On NetBSD int8_t and friends are preprocessor macros expanding to __int8_t (which is a typedef provided by machine dependent headers).
include/exec/softmmu_template.h tries to safe 3 lines of code by using preprosseor concatenation, which only will work if int8_t is not a define, or defined to int8_t.
The attached patch fixes this.
Martin
Do not rely on int8_t (and friends) not being preprocessor symbols (or symbols expanding to themselves). On NetBSD (for example) the glue(u, SDATA_TYPE) results in u__int8_t, which is undefined. There is no way to stop cpp expanding inner macros, so just add the few lines explicitly and get rid of the magic.
exec/softmmu_template.h renamed from exec/softmmu_template.h.orig +4 -1
@@ -30,23 +30,26 @@#define SUFFIX q#define LSUFFIX q#define SDATA_TYPE int64_t +#define DATA_TYPE uint64_t#elif DATA_SIZE ==4 #define SUFFIX l#define LSUFFIX l#define SDATA_TYPE int32_t +#define DATA_TYPE uint32_t#elif DATA_SIZE ==2 #define SUFFIX w#define LSUFFIX uw#define SDATA_TYPE int16_t +#define DATA_TYPE uint16_t#elif DATA_SIZE ==1 #define SUFFIX b#define LSUFFIX ub#define SDATA_TYPE int8_t +#define DATA_TYPE uint8_t#else #error unsupported data size#endif -#define DATA_TYPE glue(u, SDATA_TYPE)/* For the benefit of TCG generated code, we want to avoid the complication of ABI-specific return type promotion and always return a value extended
Il 17/12/2013 09:55, Martin Husemann ha scritto:
Quoted 8 lines
On NetBSD
int8_tand friends are preprocessor macros expanding to__int8_t(which is a typedef provided by machine dependent headers).
include/exec/softmmu_template.htries to safe 3 lines of code by using preprosseor concatenation, which only will work ifint8_tis not a define, or defined toint8_t.The attached patch fixes this.
Hi Martin, the patch looks good, but please resend it according to the rules in http://wiki.qemu.org/Contribute/SubmitAPatch - thanks!
Paolo
Il 17/12/2013 11:15, Paolo Bonzini ha scritto:
Quoted 4 lines
Il 17/12/2013 09:55, Martin Husemann ha scritto:
Quoted 3 lines
On NetBSD
int8_tand friends are preprocessor macros expanding to__int8_t(which is a typedef provided by machine dependent headers).
Quoted 8 lines
Quoted 5 lines
include/exec/softmmu_template.htries to safe 3 lines of code by using preprosseor concatenation, which only will work ifint8_tis not a define, or defined toint8_t.The attached patch fixes this.
Hi Martin, the patch looks good, but please resend it according to the rules in http://wiki.qemu.org/Contribute/SubmitAPatch - thanks!
Ping?
Paolo
PATCH v2 1/1 qemu 1.7.0 does not build on NetBSD
Do not rely on int8_t (and friends) not being preprocessor symbols (or symbols expanding to themselves). On NetBSD (for example) the glue(u, SDATA_TYPE) results in u__int8_t, which is undefined. There is no way to stop cpp expanding inner macros, so just add the few lines explicitly and get rid of the magic.
--- include/exec/softmmu_template.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/exec/softmmu_template.h +4 -1
@@ -30,23 +30,26 @@#define SUFFIX q#define LSUFFIX q#define SDATA_TYPE int64_t +#define DATA_TYPE uint64_t#elif DATA_SIZE ==4 #define SUFFIX l#define LSUFFIX l#define SDATA_TYPE int32_t +#define DATA_TYPE uint32_t#elif DATA_SIZE ==2 #define SUFFIX w#define LSUFFIX uw#define SDATA_TYPE int16_t +#define DATA_TYPE uint16_t#elif DATA_SIZE ==1 #define SUFFIX b#define LSUFFIX ub#define SDATA_TYPE int8_t +#define DATA_TYPE uint8_t#else #error unsupported data size#endif -#define DATA_TYPE glue(u, SDATA_TYPE)/* For the benefit of TCG generated code, we want to avoid the complication of ABI-specific return type promotion and always return a value extended
Signature · 1 line
1.8.5.3
Re: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
Quoted 7 lines · Martin Husemann
Do not rely on
int8_t(and friends) not being preprocessor symbols (or symbols expanding to themselves). On NetBSD (for example) theglue(u, SDATA_TYPE)results inu__int8_t, which is undefined. There is no way to stop cpp expanding inner macros, so just add the few lines explicitly and get rid of the magic.Signed-off-by Martin Husemann <[email protected]>
This was introduced in commit c8f94df593.
Richard, do you want to take this fix via the tcg tree, or should it go via trivial?
Quoted 37 lines
--- include/exec/softmmu_template.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)include/exec/softmmu_template.h +4
-2@@ -30,23 +30,26 @@#define SUFFIX q#define LSUFFIX q#define SDATA_TYPE int64_t +#define DATA_TYPE uint64_t#elif DATA_SIZE ==4 #define SUFFIX l#define LSUFFIX l#define SDATA_TYPE int32_t +#define DATA_TYPE uint32_t#elif DATA_SIZE ==2 #define SUFFIX w#define LSUFFIX uw#define SDATA_TYPE int16_t +#define DATA_TYPE uint16_t#elif DATA_SIZE ==1 #define SUFFIX b#define LSUFFIX ub#define SDATA_TYPE int8_t +#define DATA_TYPE uint8_t#else #error unsupported data size#endif -#define DATA_TYPE glue(u, SDATA_TYPE)/* For the benefit of TCG generated code, we want to avoid the complication of ABI-specific return type promotion and always return a value extended --
Quoted 1 line
1.8.5.3
thanks
-- PMM
Re: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
Quoted 7 lines · Peter Maydell
Quoted 6 lines · Martin Husemann
Do not rely on
int8_t(and friends) not being preprocessor symbols (or symbols expanding to themselves). On NetBSD (for example) theglue(u, SDATA_TYPE)results inu__int8_t, which is undefined. There is no way to stop cpp expanding inner macros, so just add the few lines explicitly and get rid of the magic.
Quoted 7 lines
Quoted 1 line
Signed-off-by Martin Husemann <[email protected]>Reviewed-by Peter Maydell <[email protected]>This was introduced in commit
c8f94df593.
Richard, do you want to take this fix via the tcg tree, or should it go via trivial?
Trivial is fine. Saves me the effort. ;-)
r~
Re: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
In reply to Martin HusemannAm 18.01.2014 14:47, schrieb Martin Husemann:
Quoted 7 lines
Do not rely on
int8_t(and friends) not being preprocessor symbols (or symbols expanding to themselves). On NetBSD (for example) theglue(u, SDATA_TYPE)results inu__int8_t, which is undefined. There is no way to stop cpp expanding inner macros, so just add the few lines explicitly and get rid of the magic.Signed-off-by Martin Husemann <[email protected]>
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Michael Tokarev
AppliedRe: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
In reply to Martin HusemannQuoted 5 lines · Martin Husemann
Do not rely on
int8_t(and friends) not being preprocessor symbols (or symbols expanding to themselves). On NetBSD (for example) theglue(u, SDATA_TYPE)results inu__int8_t, which is undefined. There is no way to stop cpp expanding inner macros, so just add the few lines explicitly and get rid of the magic.
Thanks, applied to the trivial-patches queue.
/mjt