Skip to contentSkip to conversation

audio: fix bug in mixeng_template.h build on NetBSD

PATCH In review Roger Pau Monne 2 participants 4 messages May 11, 2012 – May 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audio: fix bug in mixeng_template.h build on NetBSD

This is a bug fix for rc1, although I think this bug has been present for a long time.

NetBSD has typedefs and defines of types, so all the types specified in mixeng.c IN_T define (int8_t, uint8_t...) got expanded to __int8_t, __uint8_t, and the construction of types in mixeng_template.h failed.

audio/mixeng.c:150:17: error: 'conv_natural_uint8_t_to_mono' undeclared here (not in a function)
[...]
audio/mixeng_template.h:114:1: warning:
'conv_natural___uint8_t_to_mono' defined but not used [...]

Undef those types, so we can safely compile. This is safe even if the types are not defined.

Cc Vassili Karpov (malc) <[email protected]>
---
 audio/mixeng_template.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
audio/mixeng_template.h +12 -0
index e644c23..33e6b61 100644
@@ -27,6 +27,18 @@
  * dec++'ified by Dscho
  */
 
+/*
+ * Remove definitions of types, to prevent expansion in "glue" macro.
+ * This is needed at least for NetBSD, but any operating system that
+ * has those defines will probably cause trouble.
+ */
+#undef int8_t
+#undef uint8_t
+#undef int16_t
+#undef uint16_t
+#undef int32_t
+#undef uint32_t
+
 #ifndef SIGNED
 #define HALF (IN_MAX >> 1)
 #endif
Signature · 1 line
1.7.7.5 (Apple Git-26)
#1 lore raw
Quoted 2 lines · Roger Pau Monne

This is a bug fix for rc1, although I think this bug has been present for a long time.

If there's a bug than it's within NetBSD itself, this issue has been discussed few times (at least twice it hink) in the past, please search the ML archives.

[..snip..]

Signature · 1 line
mailto:[email protected]
#2 lore raw
Quoted 11 lines · malc
Quoted 2 lines · Roger Pau Monne

This is a bug fix for rc1, although I think this bug has been present for a long time.

If there's a bug than it's within NetBSD itself, this issue has been discussed few times (at least twice it hink) in the past, please search the ML archives.

[..snip..]

Hello,

I've found

http://copilotco.com/mail-archives/qemu.2008/msg11157.html

and

http://lists.gnu.org/archive/html/qemu-devel/2009-09/msg00255.html

But none of them seems to reach a conclusion about how to solve this. The standard regarding stdint.h doesn't forbid having this types defined as both typedefs and preprocessor macros, so I don't think this is a NetBSD bug. As far as I can see, we have at least three ways of solving this:

- Undef the macros.
- Use something like concat(conv_natural_, uint8_t, _to_mono) (as done
on the second thread I've posted).
- Pass two separate arguments; instead of using:

#define IN_T uint8_t

use something like:

#define BSIZE 8
#define ITYPE uint

But this will probably introduce quite some modifications.

Anyway, how do you think it's best to solve this?

Regards, Roger.

#3 lore raw
Quoted 19 lines · Roger Pau Monne

malc escribi?:

Quoted 11 lines · Roger Pau Monne
Quoted 3 lines

This is a bug fix for rc1, although I think this bug has been present for a long time.

If there's a bug than it's within NetBSD itself, this issue has been discussed few times (at least twice it hink) in the past, please search the ML archives.

[..snip..]

Hello,

I've found

http://copilotco.com/mail-archives/qemu.2008/msg11157.html

Quoted 8 lines

and

http://lists.gnu.org/archive/html/qemu-devel/2009-09/msg00255.html

But none of them seems to reach a conclusion about how to solve this. The standard regarding stdint.h doesn't forbid having this types defined as both typedefs and preprocessor macros, so I don't think this is a NetBSD bug. As far as I can see, we have at least three ways of solving this:

7.20.1.1#1 (and similarly #2)

The typedef name intN_t designates a signed integer type with width N, no padding bits, and a two's complement representation. Thus, int8_t denotes such a signed integer type with a width of exactly 8 bit

Quoted 8 lines

- Undef the macros.
- Use something like concat(conv_natural_, uint8_t, _to_mono) (as done on the
second thread I've posted).
- Pass two separate arguments; instead of using:

#define IN_T uint8_t

Quoted 9 lines

use something like:

#define BSIZE 8
#define ITYPE uint

But this will probably introduce quite some modifications.

Anyway, how do you think it's best to solve this?

To be honest, i think if NetBSD breaks the standard then it can also carry QEMU patches in its ports collection. Regardless, from my point of view the last option is the only one viable (not that i will commit the patch once presented, but i might consider it)

Signature · 1 line
mailto:[email protected]