From 1996dbc07d129cf2b1d32be384a131b9e6fa5373 Mon Sep 17 00:00:00 2001 From: Don Olmstead Date: Wed, 13 Nov 2024 12:05:09 -0800 Subject: Disable additional MSVC warnings Append additional MSVC warnings to `MSVC_DISABLED_WARNINGS_LIST`. Disable warnings for specific files using `COMPILE_OPTIONS`. --- CMakeLists.txt | 6 +++++- crypto/CMakeLists.txt | 12 +++++++++++- ssl/CMakeLists.txt | 8 +++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0173bf8..ebd8260 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,17 +162,21 @@ if(MSVC) set(MSVC_DISABLED_WARNINGS_LIST "C4018" # 'expression' : signed/unsigned mismatch "C4057" # 'operator' : 'identifier1' indirection to - # slightly different base types from 'identifier2' + # slightly different base types from 'identifier2' "C4100" # 'identifier' : unreferenced formal parameter "C4127" # conditional expression is constant + "C4132" # 'object' : const object should be initialized "C4146" # unary minus operator applied to unsigned type, # result still unsigned + "C4206" # nonstandard extension used : translation unit is empty "C4244" # 'argument' : conversion from 'type1' to 'type2', # possible loss of data "C4245" # 'conversion' : conversion from 'type1' to 'type2', # signed/unsigned mismatch "C4267" # 'var' : conversion from 'size_t' to 'type', # possible loss of data + "C4295" # 'array' : array is too small to include a terminating + # null character "C4389" # 'operator' : signed/unsigned mismatch "C4706" # assignment within conditional expression "C4996" # The POSIX name for this item is deprecated. diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index acb5a71..6c26528 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -814,6 +814,17 @@ elseif(HOST_X86_64) target_include_directories(crypto_obj PRIVATE bn/arch/amd64) endif() +if(MSVC) + # "C4701" - Potentially uninitialized local variable 'name' used + set_source_files_properties(bn/bn_convert.c pem/pem_lib.c PROPERTIES + COMPILE_OPTIONS /wd4701 + ) + # "C4702" - unreachable code + set_source_files_properties(pkcs7/pk7_doit.c PROPERTIES + COMPILE_OPTIONS /wd4702 + ) +endif() + add_library(crypto $ $ empty.c) export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym) @@ -867,4 +878,3 @@ if(BUILD_SHARED_LIBS) add_library(crypto-static STATIC $) target_link_libraries(crypto-static ${PLATFORM_LIBS}) endif() - diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index cf62ff4..bdcfbb2 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -72,6 +72,13 @@ target_include_directories(ssl_obj ../include ${CMAKE_BINARY_DIR}/include) +if(MSVC) + # "C4702" - unreachable code + set_source_files_properties(d1_pkt.c s3_cbc.c PROPERTIES + COMPILE_OPTIONS /wd4702 + ) +endif() + add_library(bs_obj OBJECT ${BS_SRC}) target_include_directories(bs_obj PRIVATE @@ -157,4 +164,3 @@ if(BUILD_SHARED_LIBS) add_library(ssl-static STATIC $) target_link_libraries(ssl-static crypto-static ${PLATFORM_LIBS}) endif() - -- cgit v1.2.3-55-g6feb