Skip to content

Commit

Permalink
Land #1124 - silence some MSVC warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
botovq committed Nov 13, 2024
2 parents a59cc93 + 1996dbc commit b5beb0d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 11 additions & 1 deletion crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<TARGET_OBJECTS:crypto_obj> $<TARGET_OBJECTS:compat_obj> empty.c)

export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym)
Expand Down Expand Up @@ -867,4 +878,3 @@ if(BUILD_SHARED_LIBS)
add_library(crypto-static STATIC $<TARGET_OBJECTS:crypto_obj>)
target_link_libraries(crypto-static ${PLATFORM_LIBS})
endif()

8 changes: 7 additions & 1 deletion ssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -157,4 +164,3 @@ if(BUILD_SHARED_LIBS)
add_library(ssl-static STATIC $<TARGET_OBJECTS:ssl_obj>)
target_link_libraries(ssl-static crypto-static ${PLATFORM_LIBS})
endif()

0 comments on commit b5beb0d

Please sign in to comment.