Skip to content

Commit 5371203

Browse files
Reenable 4611 and 4703 (#66792)
1 parent 110cb9f commit 5371203

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

eng/native/configurecompiler.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,7 @@ if (MSVC)
604604
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4459>) # declaration of 'identifier' hides global declaration
605605
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4463>) # overflow; assigning value to bit-field that can only hold values from low_value to high_value
606606
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4505>) # unreferenced function with internal linkage has been removed
607-
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4611>) # interaction between 'function' and C++ object destruction is non-portable
608607
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4702>) # unreachable code
609-
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4703>) # potentially uninitialized local pointer variable 'var' used
610608
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4706>) # assignment within conditional expression
611609
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4733>) # Inline asm assigning to 'FS:0' : handler not registered as safe handler
612610
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4815>) # 'var': zero-sized array in stack object will have no elements (unless the object is an aggregate that has been aggregate initialized)

src/coreclr/vm/fcall.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,21 @@ class CompletedFCallTransitionState
308308
#endif // _DEBUG
309309
};
310310

311+
// These macros are used to narrowly suppress
312+
// warning 4611 - interaction between 'function' and C++ object destruction is non-portable
313+
// See usage of setjmp() and inclusion of setjmp.h for reasoning behind usage.
314+
#ifdef _MSC_VER
315+
#define DISABLE_4611() \
316+
_Pragma("warning(push)") \
317+
_Pragma("warning(disable:4611)")
318+
319+
#define RESET_4611() \
320+
_Pragma("warning(pop)")
321+
#else
322+
#define DISABLE_4611()
323+
#define RESET_4611()
324+
#endif // _MSC_VER
325+
311326
#define PERMIT_HELPER_METHOD_FRAME_BEGIN() \
312327
if (1) \
313328
{ \
@@ -318,7 +333,9 @@ class CompletedFCallTransitionState
318333
else \
319334
{ \
320335
jmp_buf ___jmpbuf; \
336+
DISABLE_4611() \
321337
setjmp(___jmpbuf); \
338+
RESET_4611() \
322339
__assume(0); \
323340
}
324341

0 commit comments

Comments
 (0)