diff mbox

Fix warnings in MIPS build

Message ID 580be99c-9b37-4ed2-b08b-b3d9f0374040@BAMAIL02.ba.imgtec.org
State Accepted
Commit ffffd5e2c29ec418aa0c9ba7bed4c0d2d46a3296
Headers show

Commit Message

Steve Ellcey Feb. 4, 2014, 10:20 p.m. UTC
This patch fixes the rest of the set-but-not-used warnings in the MIPS
code by using attribute_unused and also fixes some conversion warnings
by changing __arch_compare_and_exchange_xxx_[8|16]_int.  Assigning __cmp
(int type) to __prev (pointer type) generates a warning.  Assigning zero
to each separately avoids this warning without having to add a cast.

Signed-off-by: Steve Ellcey <sellcey@mips.com>
---
 libc/sysdeps/linux/mips/bits/atomic.h              |   14 +++++++-------
 .../sysdeps/unix/sysv/linux/mips/lowlevellock.h    |    8 ++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

Comments

Bernhard Reutner-Fischer April 1, 2014, 11:37 a.m. UTC | #1
On 4 February 2014 23:20, Steve Ellcey <sellcey@mips.com> wrote:
> This patch fixes the rest of the set-but-not-used warnings in the MIPS
> code by using attribute_unused and also fixes some conversion warnings
> by changing __arch_compare_and_exchange_xxx_[8|16]_int.  Assigning __cmp
> (int type) to __prev (pointer type) generates a warning.  Assigning zero
> to each separately avoids this warning without having to add a cast.
>
> Signed-off-by: Steve Ellcey <sellcey@mips.com>

Applied, thanks!
diff mbox

Patch

diff --git a/libc/sysdeps/linux/mips/bits/atomic.h b/libc/sysdeps/linux/mips/bits/atomic.h
index 60ee0a6..e4f9e3b 100644
--- a/libc/sysdeps/linux/mips/bits/atomic.h
+++ b/libc/sysdeps/linux/mips/bits/atomic.h
@@ -83,10 +83,10 @@  typedef uintmax_t uatomic_max_t;
    in which values are returned.  */
 
 #define __arch_compare_and_exchange_xxx_8_int(mem, newval, oldval, rel, acq) \
-  (abort (), __prev = __cmp = 0)
+  (abort (), __prev = 0, __cmp = 0)
 
 #define __arch_compare_and_exchange_xxx_16_int(mem, newval, oldval, rel, acq) \
-  (abort (), __prev = __cmp = 0)
+  (abort (), __prev = 0, __cmp = 0)
 
 #define __arch_compare_and_exchange_xxx_32_int(mem, newval, oldval, rel, acq) \
      __asm__ __volatile__ (						      \
@@ -110,7 +110,7 @@  typedef uintmax_t uatomic_max_t;
 #if _MIPS_SIM == _ABIO32
 /* We can't do an atomic 64-bit operation in O32.  */
 #define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
-  (abort (), __prev = __cmp = 0)
+  (abort (), __prev = 0, __cmp = 0)
 #else
 #define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
      __asm__ __volatile__ ("\n"						      \
@@ -158,22 +158,22 @@  typedef uintmax_t uatomic_max_t;
    successful or not.  */
 
 #define __arch_compare_and_exchange_val_8_int(mem, new, old, rel, acq)	\
-({ __typeof (*mem) __prev attribute_unused; int __cmp;		\
+({ __typeof (*mem) __prev attribute_unused; int __cmp attribute_unused;	\
    __arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq);	\
    (__typeof (*mem))__prev; })
 
 #define __arch_compare_and_exchange_val_16_int(mem, new, old, rel, acq) \
-({ __typeof (*mem) __prev attribute_unused; int __cmp;		\
+({ __typeof (*mem) __prev attribute_unused; int __cmp attribute_unused;	\
    __arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq);	\
    (__typeof (*mem))__prev; })
 
 #define __arch_compare_and_exchange_val_32_int(mem, new, old, rel, acq) \
-({ __typeof (*mem) __prev attribute_unused; int __cmp;		\
+({ __typeof (*mem) __prev attribute_unused; int __cmp attribute_unused;	\
    __arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq);	\
    (__typeof (*mem))__prev; })
 
 #define __arch_compare_and_exchange_val_64_int(mem, new, old, rel, acq) \
-({ __typeof (*mem) __prev attribute_unused; int __cmp;		\
+({ __typeof (*mem) __prev attribute_unused; int __cmp attribute_unused;	\
    __arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq);	\
    (__typeof (*mem))__prev; })
 
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h
index f3246ca..450a286 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/lowlevellock.h
@@ -80,7 +80,7 @@ 
 #define lll_futex_timed_wait(futexp, val, timespec, private) \
   ({									      \
     INTERNAL_SYSCALL_DECL (__err);					      \
-    long int __ret;							      \
+    long int __ret attribute_unused;					      \
     __ret = INTERNAL_SYSCALL (futex, __err, 4, (long) (futexp),		      \
 			      __lll_private_flag (FUTEX_WAIT, private),	      \
 			      (val), (timespec));			      \
@@ -90,7 +90,7 @@ 
 #define lll_futex_wake(futexp, nr, private) \
   ({									      \
     INTERNAL_SYSCALL_DECL (__err);					      \
-    long int __ret;							      \
+    long int __ret attribute_unused;					      \
     __ret = INTERNAL_SYSCALL (futex, __err, 4, (long) (futexp),		      \
 			      __lll_private_flag (FUTEX_WAKE, private),	      \
 			      (nr), 0);	      \
@@ -110,7 +110,7 @@ 
 #define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
   ({									      \
     INTERNAL_SYSCALL_DECL (__err);					      \
-    long int __ret;							      \
+    long int __ret attribute_unused;					      \
     __ret = INTERNAL_SYSCALL (futex, __err, 6, (long) (futexp),		      \
 			      __lll_private_flag (FUTEX_CMP_REQUEUE, private),\
 			      (nr_wake), (nr_move), (mutex), (val));	      \
@@ -121,7 +121,7 @@ 
 #define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
   ({									      \
     INTERNAL_SYSCALL_DECL (__err);					      \
-    long int __ret;							      \
+    long int __ret attribute_unused;					      \
 									      \
     __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp),		      \
 			      __lll_private_flag (FUTEX_WAKE_OP, private),    \