Bug#475839: libc6-dev: pthread_mutex_t definition contains a nameless union
Package: libc6-dev
Version: 2.7-10
Severity: normal
Tags: patch
The pthread_mutex_t in /usr/include/bits/pthreadtypes.h contains a
nameless union. This makes it impossible to use with compilers that
don't support nameless unions. Gcc 2.95 for instance. In
particular this breaks compilation of Wine with gcc 2.95 (see
loader/kthread.c in the Wine source).
Avoiding nameless unions is trivial so there's no reason not to do it.
Here's a patch to fix this (finding a better name for the union is left
as an exercise for the reader):
--- pthreadtypes.h.orig 2007-11-29 22:32:47.000000000 +0100
+++ pthreadtypes.h 2007-12-08 09:12:50.000000000 +0100
@@ -96,7 +96,7 @@
{
int __spins;
__pthread_slist_t __list;
- };
+ } u;
#endif
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
(hopefully this won't get too mangled by vi)
Here is a test program:
--- pthread_mutex_t.c ---
#include <pthread.h>
pthread_mutex_t mutex;
--- pthread_mutex_t.c ---
Compiling it with gcc 2.95 gives the following error:
$ gcc-2.95 -c pthread_mutex_t.c
In file included from /usr/include/pthread.h:30,
from pthread_mutex_t.c:1:
/usr/include/bits/pthreadtypes.h:99: warning: unnamed struct/union that defines no instances
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22.9fg2 (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libc6-dev depends on:
ii libc6 2.7-10 GNU C Library: Shared libraries
ii linux-libc-dev 2.6.24-5 Linux Kernel Headers for developme
Versions of packages libc6-dev recommends:
ii gcc [c-compiler] 4:4.2.2-2 The GNU C compiler
ii gcc-2.95 [c-compiler] 1:2.95.4-27 The GNU C compiler
ii gcc-4.1 [c-compiler] 4.1.2-19 The GNU C compiler
ii gcc-4.2 [c-compiler] 4.2.3-3 The GNU C compiler
ii gcc-4.3 [c-compiler] 4.3.0-1 The GNU C compiler
-- no debconf information
Reply to: