Try again to only test __STDC_VERSION__ when defined. 6e1f6456 tried to do this, but MSVC doesn't short-circuit #if statements. So this change tries having the test be in a different #if. Change-Id: Id0074770c166a2b7cd9ba2c8cd06245a68b77af8
diff --git a/crypto/internal.h b/crypto/internal.h index 8c38279..50b9a40 100644 --- a/crypto/internal.h +++ b/crypto/internal.h
@@ -356,14 +356,15 @@ /* Reference counting. */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && \ - !defined(__STDC_NO_ATOMICS__) +#if defined(__STDC_VERSION__) +#if __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_ATOMICS__) /* OSX's atomic support is broken: the compiler sets the right macros but * stdatomic.h is missing. */ #if !defined(OPENSSL_APPLE) #define OPENSSL_C11_ATOMIC #endif #endif +#endif /* CRYPTO_REFCOUNT_MAX is the value at which the reference count saturates. */ #define CRYPTO_REFCOUNT_MAX 0xffffffff
diff --git a/crypto/refcount_c11.c b/crypto/refcount_c11.c index a77473f..724db35 100644 --- a/crypto/refcount_c11.c +++ b/crypto/refcount_c11.c
@@ -35,7 +35,8 @@ "CRYPTO_REFCOUNT_MAX is incorrect"); void CRYPTO_refcount_inc(CRYPTO_refcount_t *count) { - uint32_t expected = atomic_load(count); + uint32_t expected = + atomic_load(static_cast<_Atomic CRYPTO_refcount_t>(count)); while (expected != CRYPTO_REFCOUNT_MAX) { uint32_t new_value = expected + 1;