[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#194339: libc6-dev: __thread is a reserved keyword in gcc-3.3



Package: libc6-dev
Version: 2.2.5-11.5
Severity: normal
Tags: woody

/u/i/pthread.h and /u/i/bits/sigthread.h contain 3 function declartions
that use __thread as argument names. This breaks compilation of almost
any C++ program on a woody system with g++-3.3 since __thread is a
reserved keyword in this version (and pthread.h is pulled in any time
you include iostream).
A two line fix (attached) resolves this. It'd be really nice to see this
fixed in case there is another security upload for stable since I'm
sure this will annoy many people running woody when gcc-3.3 is used more
widely.
Regards,
 -- Guido

cc'ing joey since he has the final word when it comes to updates in
stable
#! /bin/sh -e

# DP: rename __thread to __thrd in header files since __thread is
# DP: reserved in gcc-3.3

if [ $# -ne 2 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch -d "$2" -f --no-backup-if-mismatch -p0 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p0 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

--- linuxthreads/sysdeps/pthread/pthread.h.orig	Thu May 22 18:01:17 2003
+++ linuxthreads/sysdeps/pthread/pthread.h	Thu May 22 18:01:31 2003
@@ -160,7 +160,7 @@
 /* Create a thread with given attributes ATTR (or default attributes
    if ATTR is NULL), and call function START_ROUTINE with given
    arguments ARG.  */
-extern int pthread_create (pthread_t *__restrict __thread,
+extern int pthread_create (pthread_t *__restrict __thrd,
 			   __const pthread_attr_t *__restrict __attr,
 			   void *(*__start_routine) (void *),
 			   void *__restrict __arg) __THROW;
@@ -588,7 +588,7 @@
 extern int pthread_setcanceltype (int __type, int *__oldtype) __THROW;
 
 /* Cancel THREAD immediately or at the next possibility.  */
-extern int pthread_cancel (pthread_t __thread) __THROW;
+extern int pthread_cancel (pthread_t __thrd) __THROW;
 
 /* Test for pending cancellation for the current thread and terminate
    the thread as per pthread_exit(PTHREAD_CANCELED) if it has been
--- linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h.orig	Thu May 22 18:02:14 2003
+++ linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h	Thu May 22 18:02:16 2003
@@ -33,6 +33,6 @@
 			    __sigset_t *__restrict __oldmask)__THROW;
 
 /* Send signal SIGNO to the given thread. */
-extern int pthread_kill (pthread_t __thread, int __signo) __THROW;
+extern int pthread_kill (pthread_t __thrd, int __signo) __THROW;
 
 #endif	/* bits/sigthread.h */

Reply to: