Skip to content

Mono build disables required warning C4244 under MSVC #91249

@GrabYourPitchforks

Description

@GrabYourPitchforks

In cmakelists.txt, we have:

# Decide if we need zlib, and if so whether we want the system zlib or the in-tree copy.
if(NOT DISABLE_EMBEDDED_PDB OR NOT DISABLE_LOG_PROFILER_GZ)
if(INTERNAL_ZLIB)
# defines ZLIB_SOURCES
include(${CLR_SRC_NATIVE_DIR}/external/zlib.cmake)
else()
# if we're not on a platform where we use the in-tree zlib, require system zlib
include(${CLR_SRC_NATIVE_DIR}/libs/System.IO.Compression.Native/extra_libs.cmake)
set(Z_LIBS)
append_extra_compression_libs(Z_LIBS)
endif()
endif()

And in zlib.cmake, we have:

if(MSVC)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4244>) # conversion from 'type1' to 'type2', possible loss of data
else(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:-Wno-implicit-int-conversion>)
endif()

The end result is that all of the mono native libs - not just the zlib components - are being built with C4244 disabled, which is causing binskim violations in the official build.

The mono sources should re-enable C4244 as error per SDL and binskim requirements.

See also #91245.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions