Use one C99-style for loop.
Switch one for loop to the new spelling as a canary. All our compilers seem to support it fine, except GCC needs to be told to build with -std=c99. (And, upon doing so, it'll require _XOPEN_SOURCE=700 for pthread_rwlock_t.) We'll let this sit for a bit until it's gotten into downstreams without issue and then open the floodgates. BUG=47 Change-Id: I1c69d4b2df8206e0b55f30aa59b5874d82fca893 Reviewed-on: https://boringssl-review.googlesource.com/8235 Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
parent
95d7a498cc
commit
2e8ba2d25d
@ -98,9 +98,18 @@ if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.7.9
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((CMAKE_COMPILER_IS_GNUCXX AND CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.8.99") OR
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if ((CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.8.99") OR
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_XOPEN_SOURCE=700")
|
CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
|
||||||
|
else()
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# pthread_rwlock_t requires a feature flag.
|
||||||
|
if(NOT WIN32)
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FUZZ)
|
if(FUZZ)
|
||||||
|
@ -118,12 +118,11 @@ void OPENSSL_cleanse(void *ptr, size_t len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) {
|
int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) {
|
||||||
size_t i;
|
|
||||||
const uint8_t *a = in_a;
|
const uint8_t *a = in_a;
|
||||||
const uint8_t *b = in_b;
|
const uint8_t *b = in_b;
|
||||||
uint8_t x = 0;
|
uint8_t x = 0;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
x |= a[i] ^ b[i];
|
x |= a[i] ^ b[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user