about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-10-25 14:43:10 -0700
committerRoland McGrath <roland@hack.frob.com>2012-10-25 14:43:10 -0700
commitc0a1472e2272045d6520eb92f6a5438e2323b79b (patch)
tree705ac5ed525befa41be5af183cd1f51050632831
parentdf381762dc462d62b4a2994fa6399f5cfa8891a3 (diff)
downloadglibc-c0a1472e2272045d6520eb92f6a5438e2323b79b.tar.gz
glibc-c0a1472e2272045d6520eb92f6a5438e2323b79b.tar.xz
glibc-c0a1472e2272045d6520eb92f6a5438e2323b79b.zip
Fix compiler warnings in some NPTL tests.
-rw-r--r--nptl/ChangeLog11
-rw-r--r--nptl/tst-basic2.c4
-rw-r--r--nptl/tst-cond-except.c5
-rw-r--r--nptl/tst-cond25.c25
4 files changed, 30 insertions, 15 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 040b64c4ed..62771e3d20 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,14 @@
+2012-10-25  Roland McGrath  <roland@hack.frob.com>
+
+	* tst-basic2.c (do_test): Return RESULT, not always zero.
+
+	* tst-cond25.c: Include <stdint.h>
+	(waiter): Add casts to uintptr_t between casting integer<->pointer.
+	(timed_waiter): Likewise.
+	(do_test_wait): Likewise.
+	* tst-cond-except.c (thr): Likewise.
+	(do_test): Use prototype definition.
+
 2012-10-24  Joseph Myers  <joseph@codesourcery.com>
 	    Jim Blandy  <jimb@codesourcery.com>
 
diff --git a/nptl/tst-basic2.c b/nptl/tst-basic2.c
index 58ed6ac53b..0d3cc06da3 100644
--- a/nptl/tst-basic2.c
+++ b/nptl/tst-basic2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -112,7 +112,7 @@ do_test (void)
 	result = 1;
     }
 
-  return 0;
+  return result;
 }
 
 
diff --git a/nptl/tst-cond-except.c b/nptl/tst-cond-except.c
index b9871ba864..be9c4ef70a 100644
--- a/nptl/tst-cond-except.c
+++ b/nptl/tst-cond-except.c
@@ -18,6 +18,7 @@
 
 #include <pthread.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -72,11 +73,11 @@ thr (void *arg)
   pthread_cleanup_pop (1);
 
 out:
-  return (void *)ret;
+  return (void *) (uintptr_t) ret;
 }
 
 int
-do_test ()
+do_test (void)
 {
   pthread_t thread;
   int ret = 0;
diff --git a/nptl/tst-cond25.c b/nptl/tst-cond25.c
index 370cd67d1c..cdc129d5f3 100644
--- a/nptl/tst-cond25.c
+++ b/nptl/tst-cond25.c
@@ -20,6 +20,7 @@
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/types.h>
@@ -87,13 +88,13 @@ waiter (void *u)
 {
   int i, ret = 0;
   void *tret = NULL;
-  int seq = (int)u;
+  int seq = (uintptr_t) u;
 
   for (i = 0; i < ITERS / NUM; i++)
     {
       if ((ret = pthread_mutex_lock (&mutex)) != 0)
         {
-	  tret = (void *)1;
+	  tret = (void *) (uintptr_t) 1;
 	  printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
 	  goto out;
 	}
@@ -101,14 +102,14 @@ waiter (void *u)
 
       if ((ret = pthread_cond_wait (&cond, &mutex)) != 0)
         {
-	  tret = (void *)1;
+	  tret = (void *) (uintptr_t) 1;
 	  printf ("waiter[%u]:wait failed: %s\n", seq, strerror (ret));
 	  goto unlock_out;
 	}
 
       if ((ret = pthread_mutex_unlock (&mutex)) != 0)
         {
-	  tret = (void *)1;
+	  tret = (void *) (uintptr_t) 1;
 	  printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
 	  goto out;
 	}
@@ -130,7 +131,7 @@ timed_waiter (void *u)
 {
   int i, ret;
   void *tret = NULL;
-  int seq = (int)u;
+  int seq = (uintptr_t) u;
 
   for (i = 0; i < ITERS / NUM; i++)
     {
@@ -138,7 +139,7 @@ timed_waiter (void *u)
 
       if ((ret = clock_gettime(CLOCK_REALTIME, &ts)) != 0)
         {
-	  tret = (void *)1;
+	  tret = (void *) (uintptr_t) 1;
 	  printf ("%u:clock_gettime failed: %s\n", seq, strerror (errno));
 	  goto out;
 	}
@@ -146,7 +147,7 @@ timed_waiter (void *u)
 
       if ((ret = pthread_mutex_lock (&mutex)) != 0)
         {
-	  tret = (void *)1;
+	  tret = (void *) (uintptr_t) 1;
 	  printf ("waiter[%u]:mutex_lock failed: %s\n", seq, strerror (ret));
 	  goto out;
 	}
@@ -155,13 +156,13 @@ timed_waiter (void *u)
       /* We should not time out either.  */
       if ((ret = pthread_cond_timedwait (&cond, &mutex, &ts)) != 0)
         {
-	  tret = (void *)1;
+	  tret = (void *) (uintptr_t) 1;
 	  printf ("waiter[%u]:timedwait failed: %s\n", seq, strerror (ret));
 	  goto unlock_out;
 	}
       if ((ret = pthread_mutex_unlock (&mutex)) != 0)
         {
-	  tret = (void *)1;
+	  tret = (void *) (uintptr_t) 1;
 	  printf ("waiter[%u]:mutex_unlock failed: %s\n", seq, strerror (ret));
 	  goto out;
 	}
@@ -195,7 +196,8 @@ do_test_wait (thr_func f)
 	  goto out;
 	}
 
-      if ((ret = pthread_mutexattr_setprotocol (&attr, PTHREAD_PRIO_INHERIT)) != 0)
+      if ((ret = pthread_mutexattr_setprotocol (&attr,
+                                                PTHREAD_PRIO_INHERIT)) != 0)
         {
 	  printf ("mutexattr_setprotocol failed: %s\n", strerror (ret));
 	  goto out;
@@ -214,7 +216,8 @@ do_test_wait (thr_func f)
 	}
 
       for (j = 0; j < NUM; j++)
-        if ((ret = pthread_create (&w[j], NULL, f, (void *)j)) != 0)
+        if ((ret = pthread_create (&w[j], NULL,
+                                   f, (void *) (uintptr_t) j)) != 0)
 	  {
 	    printf ("waiter[%d]: create failed: %s\n", j, strerror (ret));
 	    goto out;