Fix pointer-to-non-volatile cast in thread_win.c.

Casting a pointer-to-non-volatile to pointer-to-volatile can be a no-op
as the compiler only requires volatile semantics when the pointed-to
object is a volatile object and there are no pointers-to-non-volatile
involved. This probably doesn't matter unless building with the MSVC
-volatile:iso flag, and maybe not even then, but it is good practice
anyway.

Change-Id: I94900d3dc61de3b8ce2ddecab2811907a9a7adbf
Reviewed-on: https://boringssl-review.googlesource.com/6973
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
Brian Smith 2016-01-26 14:29:55 -10:00 committed by David Benjamin
parent 54a8d7c14f
commit f5f4be8fac
2 changed files with 2 additions and 4 deletions

View File

@ -334,7 +334,7 @@ static inline int constant_time_select_int(unsigned int mask, int a, int b) {
typedef uint32_t CRYPTO_once_t;
#define CRYPTO_ONCE_INIT 0
#elif defined(OPENSSL_WINDOWS)
typedef LONG CRYPTO_once_t;
typedef volatile LONG CRYPTO_once_t;
#define CRYPTO_ONCE_INIT 0
#else
typedef pthread_once_t CRYPTO_once_t;

View File

@ -31,9 +31,7 @@
OPENSSL_COMPILE_ASSERT(sizeof(CRYPTO_MUTEX) >= sizeof(CRITICAL_SECTION),
CRYPTO_MUTEX_too_small);
static void run_once(CRYPTO_once_t *in_once, void (*init)(void *), void *arg) {
volatile LONG *once = in_once;
static void run_once(CRYPTO_once_t *once, void (*init)(void *), void *arg) {
/* Values must be aligned. */
assert((((uintptr_t) once) & 3) == 0);