Procházet zdrojové kódy

Tidy up some Windows compiler assumptions.

Someone tried to build us with Ubuntu's MinGW. This is too old to be
supported (the tests rather badly fail to build), but some of the fixes
will likely be useful for eventually building Clang for Windows
standalone too.

Change-Id: I6d279a0da1346b4e0813de51df3373b7412de33a
Reviewed-on: https://boringssl-review.googlesource.com/19364
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
kris/onging/CECPQ3_patch15
David Benjamin před 7 roky
committed by CQ bot account: commit-bot@chromium.org
rodič
revize
e2568c41cb
6 změnil soubory, kde provedl 11 přidání a 6 odebrání
  1. +3
    -0
      CMakeLists.txt
  2. +1
    -1
      crypto/CMakeLists.txt
  3. +1
    -1
      crypto/bio/printf.c
  4. +3
    -3
      crypto/cpu-intel.c
  5. +1
    -1
      crypto/crypto.c
  6. +2
    -0
      crypto/rand_extra/forkunsafe.c

+ 3
- 0
CMakeLists.txt Zobrazit soubor

@@ -125,6 +125,9 @@ elseif(MSVC)
set(CMAKE_C_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
set(CMAKE_CXX_FLAGS "-Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
set(CMAKE_ASM_NASM_FLAGS "-g cv8")
endif()

if(WIN32)
add_definitions(-D_HAS_EXCEPTIONS=0)
add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-DNOMINMAX)


+ 1
- 1
crypto/CMakeLists.txt Zobrazit soubor

@@ -47,7 +47,7 @@ if(NOT OPENSSL_NO_ASM)
endforeach()
endif()
else()
if (CMAKE_CL_64)
if (${ARCH} STREQUAL "x86_64")
set(PERLASM_STYLE nasm)
else()
set(PERLASM_STYLE win32n)


+ 1
- 1
crypto/bio/printf.c Zobrazit soubor

@@ -83,7 +83,7 @@ int BIO_printf(BIO *bio, const char *format, ...) {
va_start(args, format);
out_len = _vscprintf(format, args);
va_end(args);
assert(out_len >= sizeof(buf));
assert(out_len >= (int)sizeof(buf));
}
#endif



+ 3
- 3
crypto/cpu-intel.c Zobrazit soubor

@@ -68,7 +68,7 @@
#include <stdlib.h>
#include <string.h>

#if defined(OPENSSL_WINDOWS)
#if defined(_MSC_VER)
OPENSSL_MSVC_PRAGMA(warning(push, 3))
#include <immintrin.h>
#include <intrin.h>
@@ -83,7 +83,7 @@ OPENSSL_MSVC_PRAGMA(warning(pop))
* |*out_edx|. */
static void OPENSSL_cpuid(uint32_t *out_eax, uint32_t *out_ebx,
uint32_t *out_ecx, uint32_t *out_edx, uint32_t leaf) {
#if defined(OPENSSL_WINDOWS)
#if defined(_MSC_VER)
int tmp[4];
__cpuid(tmp, (int)leaf);
*out_eax = (uint32_t)tmp[0];
@@ -114,7 +114,7 @@ static void OPENSSL_cpuid(uint32_t *out_eax, uint32_t *out_ebx,
/* OPENSSL_xgetbv returns the value of an Intel Extended Control Register (XCR).
* Currently only XCR0 is defined by Intel so |xcr| should always be zero. */
static uint64_t OPENSSL_xgetbv(uint32_t xcr) {
#if defined(OPENSSL_WINDOWS)
#if defined(_MSC_VER)
return (uint64_t)_xgetbv(xcr);
#else
uint32_t eax, edx;


+ 1
- 1
crypto/crypto.c Zobrazit soubor

@@ -107,7 +107,7 @@ uint32_t OPENSSL_armcap_P = 0;

#if defined(BORINGSSL_NO_STATIC_INITIALIZER)
static CRYPTO_once_t once = CRYPTO_ONCE_INIT;
#elif defined(OPENSSL_WINDOWS)
#elif defined(_MSC_VER)
#pragma section(".CRT$XCU", read)
static void __cdecl do_library_init(void);
__declspec(allocate(".CRT$XCU")) void(*library_init_constructor)(void) =


+ 2
- 0
crypto/rand_extra/forkunsafe.c Zobrazit soubor

@@ -25,6 +25,7 @@ static int g_buffering_enabled = 0;
/* g_lock protects |g_buffering_enabled|. */
static struct CRYPTO_STATIC_MUTEX g_lock = CRYPTO_STATIC_MUTEX_INIT;

#if !defined(OPENSSL_WINDOWS)
void RAND_enable_fork_unsafe_buffering(int fd) {
/* We no longer support setting the file-descriptor with this function. */
if (fd != -1) {
@@ -35,6 +36,7 @@ void RAND_enable_fork_unsafe_buffering(int fd) {
g_buffering_enabled = 1;
CRYPTO_STATIC_MUTEX_unlock_write(&g_lock);
}
#endif

int rand_fork_unsafe_buffering_enabled(void) {
CRYPTO_STATIC_MUTEX_lock_read(&g_lock);


Načítá se…
Zrušit
Uložit