aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Olmstead <don.j.olmstead@gmail.com>2024-11-13 12:05:09 -0800
committerDon Olmstead <don.j.olmstead@gmail.com>2024-11-13 14:15:53 -0800
commit1996dbc07d129cf2b1d32be384a131b9e6fa5373 (patch)
tree557cef828aaf5e12b1cfbda091cf1ee9ca6d6b5a
parenta59cc93264b67ebc786cf3985c55b640a7ab7fa4 (diff)
downloadportable-1996dbc07d129cf2b1d32be384a131b9e6fa5373.tar.gz
portable-1996dbc07d129cf2b1d32be384a131b9e6fa5373.tar.bz2
portable-1996dbc07d129cf2b1d32be384a131b9e6fa5373.zip
Disable additional MSVC warnings
Append additional MSVC warnings to `MSVC_DISABLED_WARNINGS_LIST`. Disable warnings for specific files using `COMPILE_OPTIONS`.
-rw-r--r--CMakeLists.txt6
-rw-r--r--crypto/CMakeLists.txt12
-rw-r--r--ssl/CMakeLists.txt8
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)
162 set(MSVC_DISABLED_WARNINGS_LIST 162 set(MSVC_DISABLED_WARNINGS_LIST
163 "C4018" # 'expression' : signed/unsigned mismatch 163 "C4018" # 'expression' : signed/unsigned mismatch
164 "C4057" # 'operator' : 'identifier1' indirection to 164 "C4057" # 'operator' : 'identifier1' indirection to
165 # slightly different base types from 'identifier2' 165 # slightly different base types from 'identifier2'
166 "C4100" # 'identifier' : unreferenced formal parameter 166 "C4100" # 'identifier' : unreferenced formal parameter
167 "C4127" # conditional expression is constant 167 "C4127" # conditional expression is constant
168 "C4132" # 'object' : const object should be initialized
168 "C4146" # unary minus operator applied to unsigned type, 169 "C4146" # unary minus operator applied to unsigned type,
169 # result still unsigned 170 # result still unsigned
171 "C4206" # nonstandard extension used : translation unit is empty
170 "C4244" # 'argument' : conversion from 'type1' to 'type2', 172 "C4244" # 'argument' : conversion from 'type1' to 'type2',
171 # possible loss of data 173 # possible loss of data
172 "C4245" # 'conversion' : conversion from 'type1' to 'type2', 174 "C4245" # 'conversion' : conversion from 'type1' to 'type2',
173 # signed/unsigned mismatch 175 # signed/unsigned mismatch
174 "C4267" # 'var' : conversion from 'size_t' to 'type', 176 "C4267" # 'var' : conversion from 'size_t' to 'type',
175 # possible loss of data 177 # possible loss of data
178 "C4295" # 'array' : array is too small to include a terminating
179 # null character
176 "C4389" # 'operator' : signed/unsigned mismatch 180 "C4389" # 'operator' : signed/unsigned mismatch
177 "C4706" # assignment within conditional expression 181 "C4706" # assignment within conditional expression
178 "C4996" # The POSIX name for this item is deprecated. 182 "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)
814 target_include_directories(crypto_obj PRIVATE bn/arch/amd64) 814 target_include_directories(crypto_obj PRIVATE bn/arch/amd64)
815endif() 815endif()
816 816
817if(MSVC)
818 # "C4701" - Potentially uninitialized local variable 'name' used
819 set_source_files_properties(bn/bn_convert.c pem/pem_lib.c PROPERTIES
820 COMPILE_OPTIONS /wd4701
821 )
822 # "C4702" - unreachable code
823 set_source_files_properties(pkcs7/pk7_doit.c PROPERTIES
824 COMPILE_OPTIONS /wd4702
825 )
826endif()
827
817add_library(crypto $<TARGET_OBJECTS:crypto_obj> $<TARGET_OBJECTS:compat_obj> empty.c) 828add_library(crypto $<TARGET_OBJECTS:crypto_obj> $<TARGET_OBJECTS:compat_obj> empty.c)
818 829
819export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym) 830export_symbol(crypto ${CMAKE_CURRENT_BINARY_DIR}/crypto_p.sym)
@@ -867,4 +878,3 @@ if(BUILD_SHARED_LIBS)
867 add_library(crypto-static STATIC $<TARGET_OBJECTS:crypto_obj>) 878 add_library(crypto-static STATIC $<TARGET_OBJECTS:crypto_obj>)
868 target_link_libraries(crypto-static ${PLATFORM_LIBS}) 879 target_link_libraries(crypto-static ${PLATFORM_LIBS})
869endif() 880endif()
870
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
72 ../include 72 ../include
73 ${CMAKE_BINARY_DIR}/include) 73 ${CMAKE_BINARY_DIR}/include)
74 74
75if(MSVC)
76 # "C4702" - unreachable code
77 set_source_files_properties(d1_pkt.c s3_cbc.c PROPERTIES
78 COMPILE_OPTIONS /wd4702
79 )
80endif()
81
75add_library(bs_obj OBJECT ${BS_SRC}) 82add_library(bs_obj OBJECT ${BS_SRC})
76target_include_directories(bs_obj 83target_include_directories(bs_obj
77 PRIVATE 84 PRIVATE
@@ -157,4 +164,3 @@ if(BUILD_SHARED_LIBS)
157 add_library(ssl-static STATIC $<TARGET_OBJECTS:ssl_obj>) 164 add_library(ssl-static STATIC $<TARGET_OBJECTS:ssl_obj>)
158 target_link_libraries(ssl-static crypto-static ${PLATFORM_LIBS}) 165 target_link_libraries(ssl-static crypto-static ${PLATFORM_LIBS})
159endif() 166endif()
160