From 0c11e18a241291e77c694ae4d7a6295b7f1be497 Mon Sep 17 00:00:00 2001 From: Vladimir Morozov Date: Tue, 4 Nov 2025 16:11:13 -0800 Subject: [PATCH] Fix BinSkim issues --- API/hermes_node_api/node_api/README.md | 10 +++++++++- cmake/modules/Hermes.cmake | 13 ++++++++++--- cmake/modules/HermesWindows.cmake | 6 +----- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/API/hermes_node_api/node_api/README.md b/API/hermes_node_api/node_api/README.md index f60c454a253..1ac9ced3ad3 100644 --- a/API/hermes_node_api/node_api/README.md +++ b/API/hermes_node_api/node_api/README.md @@ -3,4 +3,12 @@ Files in this folder are the Node-API from Node.js project. https://github.com/nodejs/node-api-headers/tree/main/include -See the copy of the license file in this folder. \ No newline at end of file +They are augmented with the experiemental APIs from the Node.js project +https://github.com/nodejs/node + +See the copy of the license file in this folder. + +# Additional files + +The js_runtime_api.h file is part of this project and +licensed under Microsoft MIT license. \ No newline at end of file diff --git a/cmake/modules/Hermes.cmake b/cmake/modules/Hermes.cmake index 57e6a3bded9..f8b61e7d33c 100644 --- a/cmake/modules/Hermes.cmake +++ b/cmake/modules/Hermes.cmake @@ -97,6 +97,12 @@ function(hermes_update_compile_flags name) set_property(TARGET ${name} APPEND_STRING PROPERTY COMPILE_FLAGS "${flags}") endif () + + if (MSVC) + # Temporary avoid the auto-vectorization optimization since VS 17.14.0 produces incorrect code. + # Set /O1 only for Release configs using modern CMake target_compile_options. + target_compile_options(${name} PRIVATE $<$:/O1>) + endif () endfunction() function(add_hermes_library name) @@ -258,13 +264,14 @@ if (MSVC) if (NOT CLANG_CL) set(msvc_warning_flags + # SDL requires these 3 checks enabled: 4146, 4244, 4267 # Disabled warnings. -wd4141 # Suppress ''modifier' : used more than once' (because of __forceinline combined with inline) - -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned' + # -wd4146 # Suppress 'unary minus operator applied to unsigned type, result still unsigned' -wd4180 # Suppress 'qualifier applied to function type has no meaning; ignored' - -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data' + # -wd4244 # Suppress ''argument' : conversion from 'type1' to 'type2', possible loss of data' -wd4258 # Suppress ''var' : definition from the for loop is ignored; the definition from the enclosing scope is used' - -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data' + # -wd4267 # Suppress ''var' : conversion from 'size_t' to 'type', possible loss of data' -wd4291 # Suppress ''declaration' : no matching operator delete found; memory will not be freed if initialization throws an exception' -wd4345 # Suppress 'behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized' -wd4351 # Suppress 'new behavior: elements of array 'array' will be default initialized' diff --git a/cmake/modules/HermesWindows.cmake b/cmake/modules/HermesWindows.cmake index ed632e79ee8..20189b7d236 100644 --- a/cmake/modules/HermesWindows.cmake +++ b/cmake/modules/HermesWindows.cmake @@ -112,11 +112,7 @@ function(hermes_windows_configure_msvc_flags) # C4146: Re-enable 'unary minus operator applied to unsigned type, result still unsigned' # Downgrade from error to warning level 3 (promoted to error by /sdl) set(MSVC_CXX_FLAGS "${MSVC_CXX_FLAGS} /w34146") - # C4244: Re-enable 'conversion from type1 to type2, possible loss of data' - set(MSVC_CXX_FLAGS "${MSVC_CXX_FLAGS} /w44244") - # C4267: Re-enable 'conversion from size_t to type, possible loss of data' - set(MSVC_CXX_FLAGS "${MSVC_CXX_FLAGS} /w44267") - + # Windows-specific warning suppressions for DLL builds # C4251: class X needs to have dll-interface to be used by clients of class Y