]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
tilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h
authorChris Metcalf <cmetcalf@ezchip.com>
Tue, 4 Aug 2015 16:02:10 +0000 (12:02 -0400)
committerChris Metcalf <cmetcalf@ezchip.com>
Tue, 4 Aug 2015 16:07:53 +0000 (12:07 -0400)
Using a ({ }) structure avoids the "value computed is not used"
that a simple () structure causes.

ChangeLog
sysdeps/tile/tilepro/bits/atomic.h

index 3cf69712ade769ff094acf18b0e0694c33c7d8c2..17caaf3e910cfc13cac88215edc57951cd52b13f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-08-04  Chris Metcalf  <cmetcalf@ezchip.com>
+
+       * sysdeps/tile/tilepro/bits/atomic.h (__atomic_update):
+       Restructure macro to avoid "value computed is not used" warning.
+       (atomic_compare_and_exchange_val_acq): Likewise.
+
 2015-08-04  Andreas Schwab  <schwab@suse.de>
 
        [BZ #18635]
index 491e586ceea16342e2d533faeeeba592f63f30d9..e0ef9fb5e73eb45e9297debadfd840e33dfc585f 100644 (file)
@@ -39,10 +39,12 @@ int __atomic_cmpxchg_32 (volatile int *mem, int newval, int oldval)
 }
 
 #define atomic_compare_and_exchange_val_acq(mem, n, o)                  \
-  ((__typeof (*(mem)))                                                  \
-   ((sizeof (*(mem)) == 4) ?                                            \
-    __atomic_cmpxchg_32 ((int *) (mem), (int) (n), (int) (o)) :         \
-    __atomic_error_bad_argument_size()))
+  ({                                                                    \
+    if (sizeof (*(mem)) != 4)                                           \
+      __atomic_error_bad_argument_size ();                              \
+    (__typeof (*(mem)))                                                 \
+      __atomic_cmpxchg_32 ((int *) (mem), (int) (n), (int) (o));        \
+  })
 
 /* Atomically compute:
      int old = *ptr;
@@ -64,10 +66,12 @@ int __atomic_update_32 (volatile int *mem, int mask, int addend)
 
 /* Size-checked verson of __atomic_update_32. */
 #define __atomic_update(mem, mask, addend)                              \
-  ((__typeof (*(mem)))                                                  \
-   ((sizeof (*(mem)) == 4) ?                                            \
-    __atomic_update_32 ((int *) (mem), (int) (mask), (int) (addend)) :  \
-    __atomic_error_bad_argument_size ()))
+  ({                                                                    \
+    if (sizeof (*(mem)) != 4)                                           \
+      __atomic_error_bad_argument_size ();                              \
+    (__typeof (*(mem)))                                                 \
+      __atomic_update_32 ((int *) (mem), (int) (mask), (int) (addend)); \
+  })
 
 #define atomic_exchange_acq(mem, newvalue)              \
   __atomic_update ((mem), 0, (newvalue))