Module Name:    src
Committed By:   joerg
Date:           Fri May  4 12:26:33 UTC 2012

Modified Files:
        src/lib/libpthread: pthread.c pthread_int.h

Log Message:
Simplify check for TLS definition to not hide code. Drop it in another
place as it is redundant.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.84 -r1.85 src/lib/libpthread/pthread_int.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.134 src/lib/libpthread/pthread.c:1.135
--- src/lib/libpthread/pthread.c:1.134	Thu Apr 26 00:21:44 2012
+++ src/lib/libpthread/pthread.c	Fri May  4 12:26:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.134 2012/04/26 00:21:44 enami Exp $	*/
+/*	$NetBSD: pthread.c,v 1.135 2012/05/04 12:26:33 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.134 2012/04/26 00:21:44 enami Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.135 2012/05/04 12:26:33 joerg Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -1301,14 +1301,12 @@ pthread__initmain(pthread_t *newt)
 		    4 * pthread__pagesize / 1024);
 
 	*newt = &pthread__main;
-#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
-#  ifdef __HAVE___LWP_GETTCB_FAST
+#ifdef __HAVE___LWP_GETTCB_FAST
 	pthread__main.pt_tls = __lwp_gettcb_fast();
-#  else
+#else
 	pthread__main.pt_tls = _lwp_getprivate();
-#  endif
-	pthread__main.pt_tls->tcb_pthread = &pthread__main;
 #endif
+	pthread__main.pt_tls->tcb_pthread = &pthread__main;
 }
 
 #ifndef lint

Index: src/lib/libpthread/pthread_int.h
diff -u src/lib/libpthread/pthread_int.h:1.84 src/lib/libpthread/pthread_int.h:1.85
--- src/lib/libpthread/pthread_int.h:1.84	Mon Mar 12 20:16:52 2012
+++ src/lib/libpthread/pthread_int.h	Fri May  4 12:26:33 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_int.h,v 1.84 2012/03/12 20:16:52 joerg Exp $	*/
+/*	$NetBSD: pthread_int.h,v 1.85 2012/05/04 12:26:33 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -256,7 +256,10 @@ int	pthread__find(pthread_t) PTHREAD_HID
 	} while (/*CONSTCOND*/0)
 
 
-#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
+#if !defined(__HAVE_TLS_VARIANT_I) && !defined(__HAVE_TLS_VARIANT_II)
+#error Either __HAVE_TLS_VARIANT_I or __HAVE_TLS_VARIANT_II must be defined
+#endif
+
 static inline pthread_t __constfunc
 pthread__self(void)
 {
@@ -267,9 +270,6 @@ pthread__self(void)
 #endif
 	return (pthread_t)tcb->tcb_pthread;
 }
-#else
-#error Either __HAVE_TLS_VARIANT_I or __HAVE_TLS_VARIANT_II must be defined
-#endif
 
 #define pthread__abort()						\
 	pthread__assertfunc(__FILE__, __LINE__, __func__, "unreachable")

Reply via email to