Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tilepro: fix warnings in sysdeps/tile/tilepro/bits/atomic.h
Using a ({ }) structure avoids the "value computed is not used"
that a simple () structure causes.
  • Loading branch information
Chris Metcalf committed Aug 4, 2015
1 parent bbab82c commit 0d261f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 6 additions & 0 deletions 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]
Expand Down
20 changes: 12 additions & 8 deletions sysdeps/tile/tilepro/bits/atomic.h
Expand Up @@ -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;
Expand All @@ -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))
Expand Down

0 comments on commit 0d261f4

Please sign in to comment.