Skip to contentSkip to conversation

qemu fixes

PATCH Applied Christoph Egger 3 participants 4 messages Nov 28, 2008 – Nov 30, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 qemu fixes

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.

Signature · 12 lines
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
mixeng.c +56 -48
Index: audio/mixeng.c
===================================================================
@@ -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)
             }
         }
     }
#1 lore raw
Quoted 10 lines · Christoph Egger

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?

Signature · 1 line
mailto:[email protected]
#2 lore raw
Quoted 9 lines · malc
Quoted 6 lines · Christoph Egger

Hi,

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

Quoted 8 lines
Quoted 5 lines

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?

#3 lore raw
Quoted 16 lines · Blue Swirl
Quoted 15 lines · malc
Quoted 11 lines · Christoph Egger

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.

Quoted 5 lines
Quoted 2 lines

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.

Signature · 1 line
mailto:[email protected]