summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-26 17:02:55 +0000
committerUlrich Drepper <drepper@redhat.com>2008-05-26 17:02:55 +0000
commit4b2c85c0b9a04b0ca4e4d031a5b92b2160f17bc3 (patch)
tree4bb3a62e0be0f7dd6d48d51fa77ac537a0b0c654 /nptl
parentf63abf584cc5028c89edd2352e7abacdd223c114 (diff)
downloadglibc-4b2c85c0b9a04b0ca4e4d031a5b92b2160f17bc3.tar.gz
glibc-4b2c85c0b9a04b0ca4e4d031a5b92b2160f17bc3.tar.xz
glibc-4b2c85c0b9a04b0ca4e4d031a5b92b2160f17bc3.zip
* tst-typesizes.c: Explicitly check __SIZEOF_PTHREAD_* constants.
	David S. Miller  <davem@davemloft.net>
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog7
-rw-r--r--nptl/tst-typesizes.c29
2 files changed, 34 insertions, 2 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index a22016f417..0ca98b8c3d 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,10 @@
+2008-05-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* tst-typesizes.c: Explicitly check __SIZEOF_PTHREAD_* constants.
+
 2008-05-20  Jakub Jelinek  <jakub@redhat.com>
-	    David S. Miller  <davem@davemloft.net>
+
+	David S. Miller  <davem@davemloft.net>
 
 	* sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: New file.
 
diff --git a/nptl/tst-typesizes.c b/nptl/tst-typesizes.c
index 17a1e297d3..545cee6bd1 100644
--- a/nptl/tst-typesizes.c
+++ b/nptl/tst-typesizes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
 
@@ -21,6 +21,25 @@
 #include <pthreadP.h>
 #include <semaphore.h>
 
+static const struct
+{
+  const char *name;
+  size_t expected;
+  size_t is;
+} types[] =
+  {
+#define T(t, c) \
+    { #t, c, sizeof (t) }
+    T (pthread_attr_t, __SIZEOF_PTHREAD_ATTR_T),
+    T (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T),
+    T (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T),
+    T (pthread_cond_t, __SIZEOF_PTHREAD_COND_T),
+    T (pthread_condattr_t, __SIZEOF_PTHREAD_CONDATTR_T),
+    T (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T),
+    T (pthread_rwlockattr_t, __SIZEOF_PTHREAD_RWLOCKATTR_T),
+    T (pthread_barrier_t, __SIZEOF_PTHREAD_BARRIER_T),
+    T (pthread_barrierattr_t, __SIZEOF_PTHREAD_BARRIERATTR_T)
+  };
 
 static int
 do_test (void)
@@ -62,6 +81,14 @@ do_test (void)
   TEST_TYPE2 (sem_t, struct new_sem);
   TEST_TYPE2 (sem_t, struct old_sem);
 
+  for (size_t i = 0; i < sizeof (types) / sizeof (types[0]); ++i)
+    if (types[i].expected != types[i].is)
+      {
+	printf ("%s: expected %zu, is %zu\n",
+		types[i].name, types[i].expected, types[i].is);
+	result = 1;
+      }
+
   return result;
 }