From de0fc4170f30e21fddd029189a97230c55b1585a Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Thu, 17 Mar 2022 14:01:56 -0700 Subject: [PATCH] Reenable 4611 and 4703 --- eng/native/configurecompiler.cmake | 2 -- src/coreclr/vm/fcall.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 469eb5f59b4eb..60d2b2b80296f 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -604,9 +604,7 @@ if (MSVC) add_compile_options($<$:/wd4459>) # declaration of 'identifier' hides global declaration add_compile_options($<$:/wd4463>) # overflow; assigning value to bit-field that can only hold values from low_value to high_value add_compile_options($<$:/wd4505>) # unreferenced function with internal linkage has been removed - add_compile_options($<$:/wd4611>) # interaction between 'function' and C++ object destruction is non-portable add_compile_options($<$:/wd4702>) # unreachable code - add_compile_options($<$:/wd4703>) # potentially uninitialized local pointer variable 'var' used add_compile_options($<$:/wd4706>) # assignment within conditional expression add_compile_options($<$:/wd4733>) # Inline asm assigning to 'FS:0' : handler not registered as safe handler add_compile_options($<$:/wd4815>) # 'var': zero-sized array in stack object will have no elements (unless the object is an aggregate that has been aggregate initialized) diff --git a/src/coreclr/vm/fcall.h b/src/coreclr/vm/fcall.h index 8bed3fbe26db2..0c65542f2e446 100644 --- a/src/coreclr/vm/fcall.h +++ b/src/coreclr/vm/fcall.h @@ -308,6 +308,21 @@ class CompletedFCallTransitionState #endif // _DEBUG }; +// These macros are used to narrowly suppress +// warning 4611 - interaction between 'function' and C++ object destruction is non-portable +// See usage of setjmp() and inclusion of setjmp.h for reasoning behind usage. +#ifdef _MSC_VER +#define DISABLE_4611() \ + _Pragma("warning(push)") \ + _Pragma("warning(disable:4611)") + +#define RESET_4611() \ + _Pragma("warning(pop)") +#else +#define DISABLE_4611() +#define RESET_4611() +#endif // _MSC_VER + #define PERMIT_HELPER_METHOD_FRAME_BEGIN() \ if (1) \ { \ @@ -318,7 +333,9 @@ class CompletedFCallTransitionState else \ { \ jmp_buf ___jmpbuf; \ + DISABLE_4611() \ setjmp(___jmpbuf); \ + RESET_4611() \ __assume(0); \ }