From 96a2b1890390d3c8451dff6eff64ac13d6124d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Wed, 21 Apr 2021 19:50:31 +0200 Subject: [PATCH] [PSEH] Make the dummy PSEH at least usable. Not screwing the code flow when no exception happens would be the least --- sdk/include/reactos/libs/pseh/pseh2.h | 31 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/sdk/include/reactos/libs/pseh/pseh2.h b/sdk/include/reactos/libs/pseh/pseh2.h index 8437bbe2f7a..45f872e7757 100644 --- a/sdk/include/reactos/libs/pseh/pseh2.h +++ b/sdk/include/reactos/libs/pseh/pseh2.h @@ -42,15 +42,36 @@ extern int _SEH2_Volatile0; extern int _SEH2_VolatileExceptionCode; -#define _SEH2_TRY { -#define _SEH2_FINALLY } { -#define _SEH2_EXCEPT(...) } if (_SEH2_Volatile0 || (0 && (__VA_ARGS__))) { -#define _SEH2_END } +#define _SEH2_TRY \ +_Pragma("GCC diagnostic push") \ +_Pragma("GCC diagnostic ignored \"-Wunused-label\"")\ +{ \ + __label__ __seh2_scope_end__; + +#define _SEH2_FINALLY \ + __seh2_scope_end__:; \ + } \ + if (1) \ + { \ + __label__ __seh2_scope_end__; + +#define _SEH2_EXCEPT(...) \ + __seh2_scope_end__:; \ + } \ + if (_SEH2_Volatile0 || (0 && (__VA_ARGS__))) \ + { \ + __label__ __seh2_scope_end__; + +#define _SEH2_END \ + __seh2_scope_end__:; \ + } \ +_Pragma("GCC diagnostic pop") + #define _SEH2_GetExceptionInformation() ((struct _EXCEPTION_POINTERS*)0) #define _SEH2_GetExceptionCode() _SEH2_VolatileExceptionCode #define _SEH2_AbnormalTermination() (0) #define _SEH2_YIELD(STMT_) STMT_ -#define _SEH2_LEAVE +#define _SEH2_LEAVE goto __seh2_scope_end__; #define _SEH2_VOLATILE volatile #elif defined(_USE_PSEH3)