about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog11
-rw-r--r--nptl/Makefile1
-rw-r--r--nptl/cond-perf.c7
-rw-r--r--nptl/pthread_attr_init.c6
-rw-r--r--nptl/tst-align.c20
5 files changed, 21 insertions, 24 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 2491cd990e..0983e0be21 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,14 @@
+2003-09-17  Jakub Jelinek  <jakub@redhat.com>
+
+	* Makefile (CFLAGS-tst-align.c): Add $(stack-align-test-flags).
+	* tst-align.c: Include tst-stack-align.h.
+	(tf, do_test): Use TEST_STACK_ALIGN macro.
+
+2003-09-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* pthread_attr_init.c (__pthread_attr_init_2_0): Remove unused
+	variable.
+
 2003-09-16  Ulrich Drepper  <drepper@redhat.com>
 
 	* pthread_getattr_np.c (pthread_getattr_np): Correctly fill in the
diff --git a/nptl/Makefile b/nptl/Makefile
index fb0f0a6b59..7876331e52 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -393,6 +393,7 @@ CFLAGS-tst-cleanupx2.c += -fexceptions
 CFLAGS-tst-cleanupx3.c += -fexceptions
 CFLAGS-tst-oncex3.c += -fexceptions
 CFLAGS-tst-oncex4.c += -fexceptions
+CFLAGS-tst-align.c += $(stack-align-test-flags)
 
 tst-cancel7-ARGS = --command "$(built-program-cmd)"
 tst-umask1-ARGS = $(objpfx)tst-umask1.temp
diff --git a/nptl/cond-perf.c b/nptl/cond-perf.c
index 53d85637b8..e37914e6b7 100644
--- a/nptl/cond-perf.c
+++ b/nptl/cond-perf.c
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <atomic.h>
 
 static pthread_cond_t cond1 = PTHREAD_COND_INITIALIZER;
 static pthread_mutex_t mut1 = PTHREAD_MUTEX_INITIALIZER;
@@ -23,7 +24,7 @@ cons (void *arg)
 
   do
     {
-      if (--ntogo == 0)
+      if (atomic_decrement_and_test (&ntogo))
 	{
 	  pthread_mutex_lock (&mut2);
 	  alldone = true;
@@ -68,11 +69,11 @@ main (int argc, char *argv[])
 
   pthread_t th[nthreads];
   int i;
-  for (i = 0; i < nthreads; ++i)
+  for (i = 0; __builtin_expect (i < nthreads, 1); ++i)
     if (__builtin_expect ((err = pthread_create (&th[i], NULL, cons, (void *) (long) i)) != 0, 0))
       printf ("pthread_create: %s\n", strerror (err));
 
-  for (i = 0; i < nrounds; ++i)
+  for (i = 0; __builtin_expect (i < nrounds, 1); ++i)
     {
       pthread_mutex_lock (&mut2);
       while (! alldone)
diff --git a/nptl/pthread_attr_init.c b/nptl/pthread_attr_init.c
index 90c8dc2ede..b202d46bd3 100644
--- a/nptl/pthread_attr_init.c
+++ b/nptl/pthread_attr_init.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -79,15 +79,13 @@ __pthread_attr_init_2_0 (attr)
     struct sched_param schedparam;
     int inheritsched;
     int scope;
-  } *iattr;
+  };
 
   /* Many elements are initialized to zero so let us do it all at
      once.  This also takes care of clearing the bytes which are not
      internally used.  */
   memset (attr, '\0', sizeof (struct old_attr));
 
-  iattr = (struct old_attr *) attr;
-
   /* We cannot enqueue the attribute because that member is not in the
      old attribute structure.  */
   return 0;
diff --git a/nptl/tst-align.c b/nptl/tst-align.c
index 902a1c772a..2de9d7a107 100644
--- a/nptl/tst-align.c
+++ b/nptl/tst-align.c
@@ -21,7 +21,7 @@
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
-
+#include <tst-stack-align.h>
 
 static void *
 tf (void *arg)
@@ -30,14 +30,7 @@ tf (void *arg)
 
   puts ("in thread");
 
-  double d = 2.0;
-  printf ("double:  %g %p %zu\n", d, &d, __alignof (double));
-  if ((((uintptr_t) &d) & (__alignof (double) - 1)) != 0)
-    ok = false;
-
-  long double ld = 3.0;
-  printf ("ldouble: %Lg %p %zu\n", ld, &ld, __alignof (long double));
-  if ((((uintptr_t) &ld) & (__alignof (long double) - 1)) != 0)
+  if (TEST_STACK_ALIGN ())
     ok = false;
 
   return ok ? NULL : (void *) -1l;
@@ -50,14 +43,7 @@ do_test (void)
 
   puts ("in main");
 
-  double d = 0.0;
-  printf ("double:  %g %p %zu\n", d, &d, __alignof (double));
-  if ((((uintptr_t) &d) & (__alignof (double) - 1)) != 0)
-    ok = false;
-
-  long double ld = 1.0;
-  printf ("ldouble: %Lg %p %zu\n", ld, &ld, __alignof (long double));
-  if ((((uintptr_t) &ld) & (__alignof (long double) - 1)) != 0)
+  if (TEST_STACK_ALIGN ())
     ok = false;
 
   pthread_t th;