about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-05-21 18:40:10 +0000
committerUlrich Drepper <drepper@redhat.com>2005-05-21 18:40:10 +0000
commit363dd976272ecf5975c1996c829e614d452a8f8d (patch)
tree583056a34cffab4ce27ecdb2c64325749eabb6fc
parent572215377f0220adef77eefccedc731cd4fb523a (diff)
downloadglibc-363dd976272ecf5975c1996c829e614d452a8f8d.tar.gz
glibc-363dd976272ecf5975c1996c829e614d452a8f8d.tar.xz
glibc-363dd976272ecf5975c1996c829e614d452a8f8d.zip
[BZ #955]
2005-05-19  Richard Henderson  <rth@redhat.com>
	* sysdeps/unix/clock_gettime.c (clock_gettime): Fix typo around
	CLOCK_REALTIME.

	* sysdeps/ia64/bits/atomic.h (__arch_compare_and_exchange_bool_32_acq,
	__arch_compare_and_exchange_bool_64_acq,
	__arch_compare_and_exchange_val_32_acq,
	__arch_compare_and_exchange_val_64_acq, atomic_exchange_and_add):
	Use __sync builtin without _si or _di suffix.

2005-05-19  Jakub Jelinek  <jakub@redhat.com>

	[BZ #955]
	* iconvdata/ibm939.c (BODY): Avoid segfaults with input characters
	<UFFFF> and above.

2005-05-17  Andreas Schwab  <schwab@suse.de>

	* sysdeps/unix/sysv/linux/clock_getcpuclockid.c
	(clock_getcpuclockid): Always return a defined value.
-rw-r--r--ChangeLog22
-rw-r--r--iconvdata/ibm939.c18
-rw-r--r--linuxthreads/sysdeps/ia64/pspinlock.c4
-rw-r--r--nptl/ChangeLog6
-rw-r--r--nptl/sysdeps/ia64/pthread_spin_lock.c2
-rw-r--r--nptl/sysdeps/ia64/pthread_spin_trylock.c2
-rw-r--r--sysdeps/ia64/bits/atomic.h23
-rw-r--r--sysdeps/unix/clock_gettime.c4
8 files changed, 50 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 06988871c0..ae5480f007 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2005-05-19  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/unix/clock_gettime.c (clock_gettime): Fix typo around
+	CLOCK_REALTIME.
+
+	* sysdeps/ia64/bits/atomic.h (__arch_compare_and_exchange_bool_32_acq,
+	__arch_compare_and_exchange_bool_64_acq,
+	__arch_compare_and_exchange_val_32_acq,
+	__arch_compare_and_exchange_val_64_acq, atomic_exchange_and_add):
+	Use __sync builtin without _si or _di suffix.
+
+2005-05-19  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #955]
+	* iconvdata/ibm939.c (BODY): Avoid segfaults with input characters
+	<UFFFF> and above.
+
+2005-05-17  Andreas Schwab  <schwab@suse.de>
+
+	* sysdeps/unix/sysv/linux/clock_getcpuclockid.c
+	(clock_getcpuclockid): Always return a defined value.
+
 2005-05-17  Neal H. Walfield  <neal@gnu.org>
 
 	* sysdeps/posix/getaddrinfo.c (gaih_local): Check [_HAVE_SA_LEN]
diff --git a/iconvdata/ibm939.c b/iconvdata/ibm939.c
index aae08ba3d1..50b083f492 100644
--- a/iconvdata/ibm939.c
+++ b/iconvdata/ibm939.c
@@ -1,5 +1,5 @@
 /* Conversion to and from IBM939.
-   Copyright (C) 2000-2002 Free Software Foundation, Inc.
+   Copyright (C) 2000-2002, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
 
@@ -200,16 +200,14 @@ enum
     if (__builtin_expect (ch >= 0xffff, 0))				      \
       {									      \
 	UNICODE_TAG_HANDLER (ch, 4);					      \
-	rp1 = NULL;							      \
-	rp2 = NULL;							      \
+	goto ibm939_invalid_char;					      \
       }									      \
-    else								      \
-      while (ch > rp1->end)						      \
-	++rp1;								      \
+									      \
+    while (ch > rp1->end)						      \
+      ++rp1;								      \
 									      \
     /* Use the UCS4 table for single byte.  */				      \
-    if (__builtin_expect (rp1 == NULL, 0)				      \
-	|| __builtin_expect (ch < rp1->start, 0)			      \
+    if (__builtin_expect (ch < rp1->start, 0)				      \
 	|| (cp = __ucs4_to_ibm939sb[ch + rp1->idx],			      \
 	    __builtin_expect (cp[0], L'\1') == L'\0' && ch != '\0'))	      \
       {									      \
@@ -217,12 +215,12 @@ enum
 	while (ch > rp2->end)						      \
 	  ++rp2;							      \
 									      \
-	if (__builtin_expect (rp2 == NULL, 0)				      \
-	    || __builtin_expect (ch < rp2->start, 0)			      \
+	if (__builtin_expect (ch < rp2->start, 0)			      \
 	    || (cp = __ucs4_to_ibm939db[ch + rp2->idx],			      \
 		__builtin_expect (cp[0], L'\1')==L'\0' && ch != '\0'))	      \
 	  {								      \
 	    /* This is an illegal character.  */			      \
+	  ibm939_invalid_char:						      \
 	    STANDARD_TO_LOOP_ERR_HANDLER (4);				      \
 	  }								      \
 	else								      \
diff --git a/linuxthreads/sysdeps/ia64/pspinlock.c b/linuxthreads/sysdeps/ia64/pspinlock.c
index 14c7f3a181..d61aa3f434 100644
--- a/linuxthreads/sysdeps/ia64/pspinlock.c
+++ b/linuxthreads/sysdeps/ia64/pspinlock.c
@@ -31,7 +31,7 @@ __pthread_spin_lock (pthread_spinlock_t *lock)
 {
   int *p = (int *) lock;
   
-  while (__builtin_expect (__sync_val_compare_and_swap_si (p, 0, 1), 0))
+  while (__builtin_expect (__sync_val_compare_and_swap (p, 0, 1), 0))
     {
       /* Spin without using the atomic instruction.  */
       do
@@ -46,7 +46,7 @@ weak_alias (__pthread_spin_lock, pthread_spin_lock)
 int
 __pthread_spin_trylock (pthread_spinlock_t *lock)
 {
-  return __sync_val_compare_and_swap_si ((int *) lock, 0, 1) == 0 ? 0 : EBUSY;
+  return __sync_val_compare_and_swap ((int *) lock, 0, 1) == 0 ? 0 : EBUSY;
 }
 weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
 
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 6fb56a93f8..f8a2ac1a50 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,9 @@
+2005-05-19  Richard Henderson  <rth@redhat.com>
+
+	* sysdeps/ia64/pthread_spin_lock.c (pthread_spin_lock): Use
+	__sync_val_compare_and_swap, not explicit _si variant.
+	* sysdeps/ia64/pthread_spin_trylock.c (pthread_spin_trylock): Likewise.
+
 2005-05-03  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #915]
diff --git a/nptl/sysdeps/ia64/pthread_spin_lock.c b/nptl/sysdeps/ia64/pthread_spin_lock.c
index 71aaef9451..7d25af7c4b 100644
--- a/nptl/sysdeps/ia64/pthread_spin_lock.c
+++ b/nptl/sysdeps/ia64/pthread_spin_lock.c
@@ -25,7 +25,7 @@ pthread_spin_lock (lock)
 {
   int *p = (int *) lock;
 
-  while (__builtin_expect (__sync_val_compare_and_swap_si (p, 0, 1), 0))
+  while (__builtin_expect (__sync_val_compare_and_swap (p, 0, 1), 0))
     {
       /* Spin without using the atomic instruction.  */
       do
diff --git a/nptl/sysdeps/ia64/pthread_spin_trylock.c b/nptl/sysdeps/ia64/pthread_spin_trylock.c
index b7cbf14782..0fd8b99b7a 100644
--- a/nptl/sysdeps/ia64/pthread_spin_trylock.c
+++ b/nptl/sysdeps/ia64/pthread_spin_trylock.c
@@ -24,5 +24,5 @@ int
 pthread_spin_trylock (lock)
      pthread_spinlock_t *lock;
 {
-  return __sync_val_compare_and_swap_si ((int *) lock, 0, 1) == 0 ? 0 : EBUSY;
+  return __sync_val_compare_and_swap ((int *) lock, 0, 1) == 0 ? 0 : EBUSY;
 }
diff --git a/sysdeps/ia64/bits/atomic.h b/sysdeps/ia64/bits/atomic.h
index e7d312c539..1020c2f229 100644
--- a/sysdeps/ia64/bits/atomic.h
+++ b/sysdeps/ia64/bits/atomic.h
@@ -52,12 +52,12 @@ typedef uintmax_t uatomic_max_t;
   (abort (), 0)
 
 #define __arch_compare_and_exchange_bool_32_acq(mem, newval, oldval) \
-  (!__sync_bool_compare_and_swap_si ((void *) (mem), (int) (long) (oldval), \
-				     (int) (long) (newval)))
+  (!__sync_bool_compare_and_swap ((mem), (int) (long) (oldval), \
+				  (int) (long) (newval)))
 
 #define __arch_compare_and_exchange_bool_64_acq(mem, newval, oldval) \
-  (!__sync_bool_compare_and_swap_di ((void *) (mem), (long) (oldval), \
-				     (long) (newval)))
+  (!__sync_bool_compare_and_swap ((mem), (long) (oldval), \
+				  (long) (newval)))
 
 #define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
   (abort (), (__typeof (*mem)) 0)
@@ -66,12 +66,11 @@ typedef uintmax_t uatomic_max_t;
   (abort (), (__typeof (*mem)) 0)
 
 #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
-  __sync_val_compare_and_swap_si ((void *) (mem), (int) (long) (oldval), \
-				  (int) (long) (newval))
+  __sync_val_compare_and_swap ((mem), (int) (long) (oldval), \
+			       (int) (long) (newval))
 
 #define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
-  __sync_val_compare_and_swap_di ((void *) (mem), (long) (oldval), \
-				  (long) (newval))
+  __sync_val_compare_and_swap ((mem), (long) (oldval), (long) (newval))
 
 /* Atomically store newval and return the old value.  */
 #define atomic_exchange_acq(mem, value) \
@@ -80,15 +79,9 @@ typedef uintmax_t uatomic_max_t;
 #define atomic_exchange_rel(mem, value) \
   (__sync_synchronize (), __sync_lock_test_and_set (mem, value))
 
-
 #define atomic_exchange_and_add(mem, value) \
   ({ __typeof (*mem) __result;						      \
-     if (sizeof (*mem) == 4)						      \
-       __result = __sync_fetch_and_add_si ((void *) (mem), (int) (value));    \
-     else if (sizeof (*mem) == 8)					      \
-       __result = __sync_fetch_and_add_di ((void *) (mem), (long) (value));   \
-     else								      \
-       abort ();							      \
+     __result = __sync_fetch_and_add ((mem), (int) (value));		      \
      __result; })
 
 #define atomic_decrement_if_positive(mem) \
diff --git a/sysdeps/unix/clock_gettime.c b/sysdeps/unix/clock_gettime.c
index b7b0428e0b..c8cef55fac 100644
--- a/sysdeps/unix/clock_gettime.c
+++ b/sysdeps/unix/clock_gettime.c
@@ -1,5 +1,5 @@
 /* clock_gettime -- Get the current time from a POSIX clockid_t.  Unix version.
-   Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
+   Copyright (C) 1999-2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -100,7 +100,7 @@ clock_gettime (clockid_t clock_id, struct timespec *tp)
       SYSDEP_GETTIME;
 #endif
 
-#ifndef HANDLED_REALTIME
+#ifdef HANDLED_REALTIME
     case CLOCK_REALTIME:
       HANDLE_REALTIME;
       break;