parlib/x86/atomic.h: (void) __sync_fetch_and_* calls
authorRonald G. Minnich <rminnich@gmail.com>
Mon, 18 Jul 2016 17:39:02 +0000 (10:39 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Mon, 18 Jul 2016 21:09:15 +0000 (17:09 -0400)
In several cases the return from __sync_fetch_and_* is ignored
and external builds were throwing errors when -Werror was used.

Indicate via the standard (void) cast that the
return from the call can be ignored.

Change-Id: I944cbaf25f5e7ecadf01d206fcc0c74935183780
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/include/parlib/x86/atomic.h

index da31c58..1ecd3e2 100644 (file)
@@ -41,12 +41,12 @@ static inline void atomic_set(atomic_t *number, long val)
 
 static inline void atomic_inc(atomic_t *number)
 {
-       __sync_fetch_and_add(number, 1);
+       (void)__sync_fetch_and_add(number, 1);
 }
 
 static inline void atomic_dec(atomic_t *number)
 {
-       __sync_fetch_and_sub(number, 1);
+       (void)__sync_fetch_and_sub(number, 1);
 }
 
 static inline long atomic_fetch_and_add(atomic_t *number, long val)
@@ -88,12 +88,12 @@ static inline bool atomic_cas_u32(uint32_t *addr, uint32_t exp_val,
 
 static inline void atomic_andb(volatile uint8_t *number, uint8_t mask)
 {
-       __sync_fetch_and_and(number, mask);
+       (void)__sync_fetch_and_and(number, mask);
 }
 
 static inline void atomic_orb(volatile uint8_t *number, uint8_t mask)
 {
-       __sync_fetch_and_or(number, mask);
+       (void)__sync_fetch_and_or(number, mask);
 }
 
 __END_DECLS