This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] PPC Linuxthreads, remove lvalue cast warnings
- From: Steve Munroe <sjmunroe at us dot ibm dot com>
- To: libc-alpha at sources dot redhat dot com, janis187 at us dot ibm dot com
- Date: Fri, 09 Apr 2004 11:37:53 -0500
- Subject: [PATCH] PPC Linuxthreads, remove lvalue cast warnings
- Organization: IBM LTC
- Reply-to: sjmunroe at vnet dot ibm dot com
The gcc-3.4 warns about lvalue casts being deprecated and gcc cvs head
will report an error. The following patch removes lvalue casts from
linuxthreads TLS_INIT_TP and INIT_THREAD_SELF for PPC.
2004-04-09 Steven Munroe <sjmunroe@us.ibm.com>
* sysdeps/powerpc/tls.h (TLS_INIT_TP): Eliminate lvalue cast from
__thread_self assignment.
(THREAD_DTV): Replace __thread_register with __thread_self.
(INIT_THREAD_SELF): Eliminate lvalue cast from __thread_self
assignment.
diff -urN libc23-cvstip-20040405/linuxthreads/sysdeps/powerpc/tls.h libc23/linuxthreads/sysdeps/powerpc/tls.h
--- libc23-cvstip-20040405/linuxthreads/sysdeps/powerpc/tls.h 2004-03-24 16:04:37.000000000 -0600
+++ libc23/linuxthreads/sysdeps/powerpc/tls.h 2004-04-08 14:07:39.000000000 -0500
@@ -92,19 +92,24 @@
/* Return dtv of given thread descriptor. */
# define GET_DTV(TCBP) (((tcbhead_t *) (TCBP))[-1].dtv)
-/* The global register variable is declared in pt-machine.h with
- the wrong type, but the compiler doesn't like us declaring another. */
+/* We still need this define so that tcb-offsets.sym can override it and
+ use THREAD_SELF to generate MULTIPLE_THREADS_OFFSET. */
# define __thread_register ((void *) __thread_self)
/* Code to initially initialize the thread pointer. This might need
special attention since 'errno' is not yet available and if the
- operation can cause a failure 'errno' must not be touched. */
+ operation can cause a failure 'errno' must not be touched.
+
+ The global register variable is declared in pt-machine.h with the
+ wrong type, so we need some extra casts to get the desired result.
+ This avoids a lvalue cast that gcc-3.4 does not like. */
# define TLS_INIT_TP(TCBP, SECONDCALL) \
- (__thread_register = (void *) (TCBP) + TLS_TCB_OFFSET, NULL)
+ (__thread_self = (struct _pthread_descr_struct *) \
+ ((void *) (TCBP) + TLS_TCB_OFFSET), NULL)
/* Return the address of the dtv for the current thread. */
# define THREAD_DTV() \
- (((tcbhead_t *) (__thread_register - TLS_TCB_OFFSET))[-1].dtv)
+ (((tcbhead_t *) ((void *) __thread_self - TLS_TCB_OFFSET))[-1].dtv)
/* Return the thread descriptor for the current thread. */
# undef THREAD_SELF
@@ -114,7 +119,7 @@
# undef INIT_THREAD_SELF
# define INIT_THREAD_SELF(DESCR, NR) \
- (__thread_register = ((void *) (DESCR) \
+ (__thread_self = (struct _pthread_descr_struct *)((void *) (DESCR) \
+ TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE))
/* Make sure we have the p_multiple_threads member in the thread structure.