diff mbox

qemu 1.7.0 does not build on NetBSD (patch)

Message ID 20131217085540.GA7891@mail.duskware.de
State New
Headers show

Commit Message

Martin Husemann Dec. 17, 2013, 8:55 a.m. UTC
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.

Comments

Paolo Bonzini Dec. 17, 2013, 10:15 a.m. UTC | #1
Il 17/12/2013 09:55, Martin Husemann ha scritto:
> 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.

Hi Martin, the patch looks good, but please resend it according to the
rules in http://wiki.qemu.org/Contribute/SubmitAPatch - thanks!

Paolo
Paolo Bonzini Jan. 15, 2014, 12:33 p.m. UTC | #2
Il 17/12/2013 11:15, Paolo Bonzini ha scritto:
> Il 17/12/2013 09:55, Martin Husemann ha scritto:
>> 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.
> 
> Hi Martin, the patch looks good, but please resend it according to the
> rules in http://wiki.qemu.org/Contribute/SubmitAPatch - thanks!

Ping?

Paolo
diff mbox

Patch

--- include/exec/softmmu_template.h.orig	2013-11-27 23:15:55.000000000 +0100
+++ include/exec/softmmu_template.h	2013-12-16 20:57:50.000000000 +0100
@@ -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