Skip to content

Commit

Permalink
Reenable 4611 and 4703 (dotnet#66792)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronRobinsonMSFT authored and radekdoulik committed Mar 30, 2022
1 parent 26d1fd4 commit 0c4b9cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 0 additions & 2 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,7 @@ if (MSVC)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4459>) # declaration of 'identifier' hides global declaration
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
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4505>) # unreferenced function with internal linkage has been removed
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4611>) # interaction between 'function' and C++ object destruction is non-portable
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4702>) # unreachable code
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4703>) # potentially uninitialized local pointer variable 'var' used
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4706>) # assignment within conditional expression
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4733>) # Inline asm assigning to 'FS:0' : handler not registered as safe handler
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)
Expand Down
17 changes: 17 additions & 0 deletions src/coreclr/vm/fcall.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
{ \
Expand All @@ -318,7 +333,9 @@ class CompletedFCallTransitionState
else \
{ \
jmp_buf ___jmpbuf; \
DISABLE_4611() \
setjmp(___jmpbuf); \
RESET_4611() \
__assume(0); \
}

Expand Down

0 comments on commit 0c4b9cc

Please sign in to comment.