Skip to content

Commit

Permalink
impatomic: silence more clang warnings
Browse files Browse the repository at this point in the history
These 'return' values produce unused value warnings when the value
returned by _ATOMIC_STORE_, _ATOMIC_INIT_, and _ATOMIC_MODIFY_ aren't
used. Silence these warnings (but leave the ones for _ATOMIC_LOAD_)
because we expect that the result of RMW's or stores may rightly be
discarded in many cases.
  • Loading branch information
Brian Norris committed Aug 14, 2013
1 parent 8251cec commit 130a351
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions include/impatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@ inline void atomic_flag::clear( memory_order __x__ ) volatile
({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__); \
__typeof__(__m__) __v__ = (__m__); \
model_write_action((void *) __p__, __x__, (uint64_t) __v__); \
__v__; })
__v__ = __v__; /* Silence clang (-Wunused-value) */ \
})


#define _ATOMIC_INIT_( __a__, __m__ ) \
({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__); \
__typeof__(__m__) __v__ = (__m__); \
model_init_action((void *) __p__, (uint64_t) __v__); \
__v__; })
__v__ = __v__; /* Silence clang (-Wunused-value) */ \
})

#define _ATOMIC_MODIFY_( __a__, __o__, __m__, __x__ ) \
({ volatile __typeof__((__a__)->__f__)* __p__ = & ((__a__)->__f__); \
Expand All @@ -104,7 +106,8 @@ inline void atomic_flag::clear( memory_order __x__ ) volatile
__typeof__((__a__)->__f__) __copy__= __old__; \
__copy__ __o__ __v__; \
model_rmw_action((void *)__p__, __x__, (uint64_t) __copy__); \
__old__; })
__old__ = __old__; /* Silence clang (-Wunused-value) */ \
})

/* No spurious failure for now */
#define _ATOMIC_CMPSWP_WEAK_ _ATOMIC_CMPSWP_
Expand Down

0 comments on commit 130a351

Please sign in to comment.