@@ -968,6 +968,8 @@ Exception *ExThrowWithInnerHelper(Exception *inner);
968
968
969
969
#define EX_TRY EX_TRY_CUSTOM (Exception::HandlerState, , DelegatingException /* was SEHException*/ )
970
970
971
+ #define EX_TRY_CPP_ONLY EX_TRY_CUSTOM_CPP_ONLY (Exception::HandlerState, , DelegatingException /* was SEHException*/ )
972
+
971
973
#ifndef INCONTRACT
972
974
#ifdef ENABLE_CONTRACTS
973
975
#define INCONTRACT (x ) x
@@ -1031,40 +1033,44 @@ Exception *ExThrowWithInnerHelper(Exception *inner);
1031
1033
1032
1034
#define EX_CATCH_IMPL EX_CATCH_IMPL_EX (Exception)
1033
1035
1034
- //
1035
- // What we really need a different version of EX_TRY with one less try scope, but this
1036
- // gets us what we need for now...
1037
- //
1038
- #define EX_CATCH_IMPL_CPP_ONLY \
1039
- DEBUG_ASSURE_NO_RETURN_END (EX_TRY) \
1040
- } \
1041
- SCAN_EHMARKER_END_TRY (); \
1042
- } \
1043
- PAL_CPP_CATCH_DERIVED (Exception, __pExceptionRaw) \
1044
- { \
1045
- SCAN_EHMARKER_CATCH (); \
1046
- __state.SetCaughtCxx (); \
1047
- __state.m_pExceptionPtr = __pExceptionRaw; \
1048
- SCAN_EHMARKER_END_CATCH (); \
1049
- SCAN_IGNORE_THROW_MARKER; \
1050
- PAL_CPP_RETHROW; \
1051
- } \
1052
- PAL_CPP_ENDTRY \
1053
- SCAN_EHMARKER_END_TRY (); \
1054
- } \
1055
- PAL_CPP_CATCH_EXCEPTION_NOARG \
1056
- { \
1057
- SCAN_EHMARKER_CATCH (); \
1058
- VALIDATE_BACKOUT_STACK_CONSUMPTION; \
1059
- __defaultException_t __defaultException; \
1060
- CHECK::ResetAssert (); \
1061
- ExceptionHolder __pException (__state.m_pExceptionPtr ); \
1062
- /* work around unreachable code warning */ \
1063
- if (true ) { \
1064
- DEBUG_ASSURE_NO_RETURN_BEGIN (EX_CATCH) \
1065
- /* don't embed file names in retail to save space and avoid IP */ \
1066
- /* a findstr /n will allow you to locate it in a pinch */ \
1067
- __state.SetupCatch (INDEBUG_COMMA (__FILE__) __LINE__); \
1036
+ #define EX_TRY_CUSTOM_CPP_ONLY (STATETYPE, STATEARG, DEFAULT_EXCEPTION_TYPE ) \
1037
+ { \
1038
+ STATETYPE __state STATEARG; \
1039
+ typedef DEFAULT_EXCEPTION_TYPE __defaultException_t; \
1040
+ SCAN_EHMARKER (); \
1041
+ PAL_CPP_TRY \
1042
+ { \
1043
+ SCAN_EHMARKER_TRY (); \
1044
+ CAutoTryCleanup<STATETYPE> __autoCleanupTry (__state); \
1045
+ /* prevent annotations from being dropped by optimizations in debug */ \
1046
+ INDEBUG (static bool __alwayszero;) \
1047
+ INDEBUG (VolatileLoad (&__alwayszero);) \
1048
+ { \
1049
+ /* this is necessary for Rotor exception handling to work */ \
1050
+ DEBUG_ASSURE_NO_RETURN_BEGIN (EX_TRY) \
1051
+
1052
+ #define EX_CATCH_IMPL_CPP_ONLY \
1053
+ DEBUG_ASSURE_NO_RETURN_END (EX_TRY) \
1054
+ } \
1055
+ SCAN_EHMARKER_END_TRY (); \
1056
+ } \
1057
+ PAL_CPP_CATCH_DERIVED (Exception, __pExceptionRaw) \
1058
+ { \
1059
+ SCAN_EHMARKER_CATCH (); \
1060
+ __state.SetCaughtCxx (); \
1061
+ __state.m_pExceptionPtr = __pExceptionRaw; \
1062
+ SCAN_EHMARKER_END_CATCH (); \
1063
+ SCAN_IGNORE_THROW_MARKER; \
1064
+ VALIDATE_BACKOUT_STACK_CONSUMPTION; \
1065
+ __defaultException_t __defaultException; \
1066
+ CHECK::ResetAssert (); \
1067
+ ExceptionHolder __pException (__state.m_pExceptionPtr ); \
1068
+ /* work around unreachable code warning */ \
1069
+ if (true ) { \
1070
+ DEBUG_ASSURE_NO_RETURN_BEGIN (EX_CATCH) \
1071
+ /* don't embed file names in retail to save space and avoid IP */ \
1072
+ /* a findstr /n will allow you to locate it in a pinch */ \
1073
+ __state.SetupCatch (INDEBUG_COMMA (__FILE__) __LINE__); \
1068
1074
1069
1075
1070
1076
// Here we finally define the EX_CATCH* macros that will be used throughout the system.
0 commit comments