This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED] tilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h
- From: Chris Metcalf <cmetcalf at ezchip dot com>
- To: <libc-alpha at sourceware dot org>
- Cc: Chris Metcalf <cmetcalf at ezchip dot com>
- Date: Tue, 4 Aug 2015 12:06:28 -0400
- Subject: [COMMITTED] tilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none;
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
Using a ({ }) structure avoids the "value computed is not used"
that a simple () structure causes.
---
ChangeLog | 6 ++++++
sysdeps/tile/tilepro/bits/atomic.h | 20 ++++++++++++--------
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 846aad09bc33..a65f8e0a0007 100644
--- 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-01 Carlos O'Donell <carlos@redhat.com>
* po/pl.po: Updated translation.
diff --git a/sysdeps/tile/tilepro/bits/atomic.h b/sysdeps/tile/tilepro/bits/atomic.h
index 491e586ceea1..e0ef9fb5e73e 100644
--- a/sysdeps/tile/tilepro/bits/atomic.h
+++ b/sysdeps/tile/tilepro/bits/atomic.h
@@ -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))
--
2.1.2