All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] qemu 1.7.0 does not build on NetBSD (patch)
@ 2013-12-17  8:55 Martin Husemann
  2013-12-17 10:15 ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Husemann @ 2013-12-17  8:55 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

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

[-- Attachment #2: patch-include_exec_softmmu__template.h --]
[-- Type: text/plain, Size: 1170 bytes --]

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.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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu 1.7.0 does not build on NetBSD (patch)
  2013-12-17  8:55 [Qemu-devel] qemu 1.7.0 does not build on NetBSD (patch) Martin Husemann
@ 2013-12-17 10:15 ` Paolo Bonzini
  2014-01-15 12:33   ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2013-12-17 10:15 UTC (permalink / raw)
  To: Martin Husemann; +Cc: qemu-devel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] qemu 1.7.0 does not build on NetBSD (patch)
  2013-12-17 10:15 ` Paolo Bonzini
@ 2014-01-15 12:33   ` Paolo Bonzini
  2014-01-18 13:47     ` [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD Martin Husemann
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2014-01-15 12:33 UTC (permalink / raw)
  Cc: qemu-devel, Martin Husemann

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
  2014-01-15 12:33   ` Paolo Bonzini
@ 2014-01-18 13:47     ` Martin Husemann
  2014-01-18 13:59       ` Peter Maydell
                         ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Martin Husemann @ 2014-01-18 13:47 UTC (permalink / raw)
  To: qemu-devel

 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.

Signed-off-by: Martin Husemann <martin@NetBSD.org>
---
 include/exec/softmmu_template.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/exec/softmmu_template.h b/include/exec/softmmu_template.h
index c6a5440..8712dcd 100644
--- a/include/exec/softmmu_template.h
+++ b/include/exec/softmmu_template.h
@@ -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
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
  2014-01-18 13:47     ` [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD Martin Husemann
@ 2014-01-18 13:59       ` Peter Maydell
  2014-01-21 15:38         ` Richard Henderson
  2014-01-21 15:42       ` Andreas Färber
  2014-01-21 18:11       ` Michael Tokarev
  2 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2014-01-18 13:59 UTC (permalink / raw)
  To: Martin Husemann; +Cc: QEMU Developers, Richard Henderson

On 18 January 2014 13:47, Martin Husemann <martin@duskware.de> wrote:
>  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.
>
> Signed-off-by: Martin Husemann <martin@NetBSD.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

This was introduced in commit c8f94df593.
Richard, do you want to take this fix via the tcg tree, or should it
go via trivial?

> ---
>  include/exec/softmmu_template.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/include/exec/softmmu_template.h b/include/exec/softmmu_template.h
> index c6a5440..8712dcd 100644
> --- a/include/exec/softmmu_template.h
> +++ b/include/exec/softmmu_template.h
> @@ -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
> --
> 1.8.5.3

thanks
-- PMM

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
  2014-01-18 13:59       ` Peter Maydell
@ 2014-01-21 15:38         ` Richard Henderson
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2014-01-21 15:38 UTC (permalink / raw)
  To: Peter Maydell, Martin Husemann; +Cc: QEMU Developers

On 01/18/2014 05:59 AM, Peter Maydell wrote:
> On 18 January 2014 13:47, Martin Husemann <martin@duskware.de> wrote:
>>  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.
>>
>> Signed-off-by: Martin Husemann <martin@NetBSD.org>
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> 
> 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~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
  2014-01-18 13:47     ` [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD Martin Husemann
  2014-01-18 13:59       ` Peter Maydell
@ 2014-01-21 15:42       ` Andreas Färber
  2014-01-21 18:11       ` Michael Tokarev
  2 siblings, 0 replies; 8+ messages in thread
From: Andreas Färber @ 2014-01-21 15:42 UTC (permalink / raw)
  To: Martin Husemann, qemu-devel; +Cc: qemu-trivial

Am 18.01.2014 14:47, schrieb Martin Husemann:
>  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.
> 
> Signed-off-by: Martin Husemann <martin@NetBSD.org>

Reviewed-by: Andreas Färber <afaerber@suse.de>

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD
  2014-01-18 13:47     ` [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD Martin Husemann
  2014-01-18 13:59       ` Peter Maydell
  2014-01-21 15:42       ` Andreas Färber
@ 2014-01-21 18:11       ` Michael Tokarev
  2 siblings, 0 replies; 8+ messages in thread
From: Michael Tokarev @ 2014-01-21 18:11 UTC (permalink / raw)
  To: Martin Husemann; +Cc: qemu-trivial, qemu-devel

18.01.2014 17:47, Martin Husemann wrote:
>  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.

Thanks, applied to the trivial-patches queue.

/mjt

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-21 18:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-17  8:55 [Qemu-devel] qemu 1.7.0 does not build on NetBSD (patch) Martin Husemann
2013-12-17 10:15 ` Paolo Bonzini
2014-01-15 12:33   ` Paolo Bonzini
2014-01-18 13:47     ` [Qemu-devel] [PATCH v2] qemu 1.7.0 does not build on NetBSD Martin Husemann
2014-01-18 13:59       ` Peter Maydell
2014-01-21 15:38         ` Richard Henderson
2014-01-21 15:42       ` Andreas Färber
2014-01-21 18:11       ` Michael Tokarev

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.