Cast refcounts to _Atomic before use.

GCC doesn't care, but Clang is strict about this.

Change-Id: If34305303a87459985c98423a8283cad704ae984
This commit is contained in:
Adam Langley 2015-05-20 13:39:22 -07:00
parent 0d1d0d5c1f
commit cb56c2a137

View File

@ -34,9 +34,9 @@ static_assert(sizeof(CRYPTO_refcount_t) == sizeof(_Atomic CRYPTO_refcount_t),
static_assert((CRYPTO_refcount_t)-1 == CRYPTO_REFCOUNT_MAX, static_assert((CRYPTO_refcount_t)-1 == CRYPTO_REFCOUNT_MAX,
"CRYPTO_REFCOUNT_MAX is incorrect"); "CRYPTO_REFCOUNT_MAX is incorrect");
void CRYPTO_refcount_inc(CRYPTO_refcount_t *count) { void CRYPTO_refcount_inc(CRYPTO_refcount_t *in_count) {
uint32_t expected = _Atomic CRYPTO_refcount_t *count = (_Atomic CRYPTO_refcount_t *) in_count;
atomic_load(static_cast<_Atomic CRYPTO_refcount_t>(count)); uint32_t expected = atomic_load(count);
while (expected != CRYPTO_REFCOUNT_MAX) { while (expected != CRYPTO_REFCOUNT_MAX) {
uint32_t new_value = expected + 1; uint32_t new_value = expected + 1;
@ -46,7 +46,8 @@ void CRYPTO_refcount_inc(CRYPTO_refcount_t *count) {
} }
} }
int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *count) { int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *in_count) {
_Atomic CRYPTO_refcount_t *count = (_Atomic CRYPTO_refcount_t *)in_count;
uint32_t expected = atomic_load(count); uint32_t expected = atomic_load(count);
for (;;) { for (;;) {