qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 6/6] qemu fixes
@ 2008-11-28 10:42 Christoph Egger
  2008-11-29 18:19 ` malc
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Egger @ 2008-11-28 10:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl

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


Hi,

This is a series of four patches which improve support
for qemu on NetBSD.

This patch touches the audio part.
On NetBSD, the ANSI C99 integer types are defined via CPP macros.
The CPP must evaluate the conv_natural_<type>_to_mono twice
to compile on NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

-- 
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy

[-- Attachment #2: audio_qemu.diff --]
[-- Type: text/x-diff, Size: 6402 bytes --]

Index: audio/mixeng.c
===================================================================
--- audio/mixeng.c	(revision 5805)
+++ audio/mixeng.c	(working copy)
@@ -143,56 +143,64 @@
 #undef IN_T
 #undef SHIFT
 
+/*
+ * Work around ugly XX_t #defines in NetBSD 2.x,
+ * fixed as typedefs in NetBSD 3.x. Two macros needed to
+ * get CPP defines expanded properly.
+ */
+#define _NBglue(x,y,z) x ## y ## z
+#define NBglue(x,y,z) _NBglue(x,y,z)
+
 t_sample *mixeng_conv[2][2][2][3] = {
     {
         {
             {
-                conv_natural_uint8_t_to_mono,
-                conv_natural_uint16_t_to_mono,
-                conv_natural_uint32_t_to_mono
+                NBglue(conv_natural_, uint8_t, _to_mono),
+                NBglue(conv_natural_, uint16_t, _to_mono),
+                NBglue(conv_natural_, uint32_t, _to_mono),
             },
             {
-                conv_natural_uint8_t_to_mono,
-                conv_swap_uint16_t_to_mono,
-                conv_swap_uint32_t_to_mono,
+                NBglue(conv_natural_, uint8_t, _to_mono),
+                NBglue(conv_swap_, uint16_t, _to_mono),
+                NBglue(conv_swap_, uint32_t, _to_mono),
             }
         },
         {
             {
-                conv_natural_int8_t_to_mono,
-                conv_natural_int16_t_to_mono,
-                conv_natural_int32_t_to_mono
+                NBglue(conv_natural_, int8_t, _to_mono),
+                NBglue(conv_natural_, int16_t, _to_mono),
+                NBglue(conv_natural_, int32_t, _to_mono)
             },
             {
-                conv_natural_int8_t_to_mono,
-                conv_swap_int16_t_to_mono,
-                conv_swap_int32_t_to_mono
+                NBglue(conv_natural_, int8_t, _to_mono),
+                NBglue(conv_swap_, int16_t, _to_mono),
+                NBglue(conv_swap_, int32_t, _to_mono)
             }
         }
     },
     {
         {
             {
-                conv_natural_uint8_t_to_stereo,
-                conv_natural_uint16_t_to_stereo,
-                conv_natural_uint32_t_to_stereo
+                NBglue(conv_natural_, uint8_t, _to_stereo),
+                NBglue(conv_natural_, uint16_t, _to_stereo),
+                NBglue(conv_natural_, uint32_t, _to_stereo)
             },
             {
-                conv_natural_uint8_t_to_stereo,
-                conv_swap_uint16_t_to_stereo,
-                conv_swap_uint32_t_to_stereo
+                NBglue(conv_natural_, uint8_t, _to_stereo),
+                NBglue(conv_swap_, uint16_t, _to_stereo),
+                NBglue(conv_swap_, uint32_t, _to_stereo)
             }
         },
         {
             {
-                conv_natural_int8_t_to_stereo,
-                conv_natural_int16_t_to_stereo,
-                conv_natural_int32_t_to_stereo
+                NBglue(conv_natural_, int8_t, _to_stereo),
+                NBglue(conv_natural_, int16_t, _to_stereo),
+                NBglue(conv_natural_, int32_t, _to_stereo)
             },
             {
-                conv_natural_int8_t_to_stereo,
-                conv_swap_int16_t_to_stereo,
-                conv_swap_int32_t_to_stereo,
+                NBglue(conv_natural_, int8_t, _to_stereo),
+                NBglue(conv_swap_, int16_t, _to_stereo),
+                NBglue(conv_swap_, int32_t, _to_stereo),
             }
         }
     }
@@ -202,52 +210,52 @@
     {
         {
             {
-                clip_natural_uint8_t_from_mono,
-                clip_natural_uint16_t_from_mono,
-                clip_natural_uint32_t_from_mono
+                NBglue(clip_natural_, uint8_t, _from_mono),
+                NBglue(clip_natural_, uint16_t, _from_mono),
+                NBglue(clip_natural_, uint32_t, _from_mono)
             },
             {
-                clip_natural_uint8_t_from_mono,
-                clip_swap_uint16_t_from_mono,
-                clip_swap_uint32_t_from_mono
+                NBglue(clip_natural_, uint8_t, _from_mono),
+                NBglue(clip_swap_, uint16_t, _from_mono),
+                NBglue(clip_swap_, uint32_t, _from_mono)
             }
         },
         {
             {
-                clip_natural_int8_t_from_mono,
-                clip_natural_int16_t_from_mono,
-                clip_natural_int32_t_from_mono
+                NBglue(clip_natural_, int8_t, _from_mono),
+                NBglue(clip_natural_, int16_t, _from_mono),
+                NBglue(clip_natural_, int32_t, _from_mono)
             },
             {
-                clip_natural_int8_t_from_mono,
-                clip_swap_int16_t_from_mono,
-                clip_swap_int32_t_from_mono
+                NBglue(clip_natural_, int8_t, _from_mono),
+                NBglue(clip_swap_, int16_t, _from_mono),
+                NBglue(clip_swap_, int32_t, _from_mono)
             }
         }
     },
     {
         {
             {
-                clip_natural_uint8_t_from_stereo,
-                clip_natural_uint16_t_from_stereo,
-                clip_natural_uint32_t_from_stereo
+                NBglue(clip_natural_, uint8_t, _from_stereo),
+                NBglue(clip_natural_, uint16_t, _from_stereo),
+                NBglue(clip_natural_, uint32_t, _from_stereo)
             },
             {
-                clip_natural_uint8_t_from_stereo,
-                clip_swap_uint16_t_from_stereo,
-                clip_swap_uint32_t_from_stereo
+                NBglue(clip_natural_, uint8_t, _from_stereo),
+                NBglue(clip_swap_, uint16_t, _from_stereo),
+                NBglue(clip_swap_, uint32_t, _from_stereo)
             }
         },
         {
             {
-                clip_natural_int8_t_from_stereo,
-                clip_natural_int16_t_from_stereo,
-                clip_natural_int32_t_from_stereo
+                NBglue(clip_natural_, int8_t, _from_stereo),
+                NBglue(clip_natural_, int16_t, _from_stereo),
+                NBglue(clip_natural_, int32_t, _from_stereo)
             },
             {
-                clip_natural_int8_t_from_stereo,
-                clip_swap_int16_t_from_stereo,
-                clip_swap_int32_t_from_stereo
+                NBglue(clip_natural_, int8_t, _from_stereo),
+                NBglue(clip_swap_, int16_t, _from_stereo),
+                NBglue(clip_swap_, int32_t, _from_stereo)
             }
         }
     }

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

* Re: [Qemu-devel] [PATCH 6/6] qemu fixes
  2008-11-28 10:42 [Qemu-devel] [PATCH 6/6] qemu fixes Christoph Egger
@ 2008-11-29 18:19 ` malc
  2008-11-29 18:25   ` Blue Swirl
  0 siblings, 1 reply; 4+ messages in thread
From: malc @ 2008-11-29 18:19 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl

On Fri, 28 Nov 2008, Christoph Egger wrote:

>
> Hi,
>
> This is a series of four patches which improve support
> for qemu on NetBSD.
>
> This patch touches the audio part.
> On NetBSD, the ANSI C99 integer types are defined via CPP macros.
> The CPP must evaluate the conv_natural_<type>_to_mono twice
> to compile on NetBSD.

The cure in this case is almost as bad as the disease, since it
introduces a macro with _[[:upper:]] name.

Is NetBSD 2.x still in a wide circulation to warant this horror?

-- 
mailto:av1474@comtv.ru

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

* Re: [Qemu-devel] [PATCH 6/6] qemu fixes
  2008-11-29 18:19 ` malc
@ 2008-11-29 18:25   ` Blue Swirl
  2008-11-30 16:51     ` malc
  0 siblings, 1 reply; 4+ messages in thread
From: Blue Swirl @ 2008-11-29 18:25 UTC (permalink / raw)
  To: malc; +Cc: qemu-devel

On 11/29/08, malc <av1474@comtv.ru> wrote:
> On Fri, 28 Nov 2008, Christoph Egger wrote:
>
>
> >
> > Hi,
> >
> > This is a series of four patches which improve support
> > for qemu on NetBSD.
> >
> > This patch touches the audio part.
> > On NetBSD, the ANSI C99 integer types are defined via CPP macros.
> > The CPP must evaluate the conv_natural_<type>_to_mono twice
> > to compile on NetBSD.
> >
>
>  The cure in this case is almost as bad as the disease, since it
>  introduces a macro with _[[:upper:]] name.

How about simply renaming so that there is no uintxx_t, for example
using ui8 etc?

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

* Re: [Qemu-devel] [PATCH 6/6] qemu fixes
  2008-11-29 18:25   ` Blue Swirl
@ 2008-11-30 16:51     ` malc
  0 siblings, 0 replies; 4+ messages in thread
From: malc @ 2008-11-30 16:51 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

On Sat, 29 Nov 2008, Blue Swirl wrote:

> On 11/29/08, malc <av1474@comtv.ru> wrote:
>> On Fri, 28 Nov 2008, Christoph Egger wrote:
>>
>>
>>>
>>> Hi,
>>>
>>> This is a series of four patches which improve support
>>> for qemu on NetBSD.
>>>
>>> This patch touches the audio part.
>>> On NetBSD, the ANSI C99 integer types are defined via CPP macros.
>>> The CPP must evaluate the conv_natural_<type>_to_mono twice
>>> to compile on NetBSD.
>>>
>>
>>  The cure in this case is almost as bad as the disease, since it
>>  introduces a macro with _[[:upper:]] name.
>
> How about simply renaming so that there is no uintxx_t, for example
> using ui8 etc?

It's not that simple names in template are derived from IN_T which is
defined to various [u]intNN_t types by glueing, one would have to
introduce yet another parameter.

-- 
mailto:av1474@comtv.ru

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

end of thread, other threads:[~2008-11-30 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-28 10:42 [Qemu-devel] [PATCH 6/6] qemu fixes Christoph Egger
2008-11-29 18:19 ` malc
2008-11-29 18:25   ` Blue Swirl
2008-11-30 16:51     ` malc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).