mirror of
https://github.com/reactos/reactos.git
synced 2025-05-23 11:04:52 +00:00
[PSEH] Fix SEH compatibility macros for dummy PSEH
This is used with Clang, which does have native SEH, but it's broken and can cause the compiler to crash. Previously some code was not handling this and instead used native SEH for clang. Fix this by always using _SEH2_* macros instead of relying on __USE_PSEH2__ to be defined.
This commit is contained in:
parent
ca0fa4af1e
commit
f1b60c66f0
3 changed files with 8 additions and 49 deletions
|
@ -12,7 +12,6 @@
|
||||||
#define InvalidPointer ((PVOID)0x5555555555555555ULL)
|
#define InvalidPointer ((PVOID)0x5555555555555555ULL)
|
||||||
// #define InvalidPointer ((PVOID)0x0123456789ABCDEFULL)
|
// #define InvalidPointer ((PVOID)0x0123456789ABCDEFULL)
|
||||||
|
|
||||||
#ifdef __USE_PSEH2__
|
|
||||||
#include <pseh/pseh2.h>
|
#include <pseh/pseh2.h>
|
||||||
|
|
||||||
#define StartSeh() \
|
#define StartSeh() \
|
||||||
|
@ -32,24 +31,6 @@
|
||||||
"Exception 0x%08lx, expected 0x%08lx\n", \
|
"Exception 0x%08lx, expected 0x%08lx\n", \
|
||||||
ExceptionStatus, (ExpectedStatus)); \
|
ExceptionStatus, (ExpectedStatus)); \
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define StartSeh() \
|
|
||||||
{ \
|
|
||||||
NTSTATUS ExceptionStatus = STATUS_SUCCESS; \
|
|
||||||
__try \
|
|
||||||
{
|
|
||||||
|
|
||||||
#define EndSeh(ExpectedStatus) \
|
|
||||||
} \
|
|
||||||
__except(EXCEPTION_EXECUTE_HANDLER) \
|
|
||||||
{ \
|
|
||||||
ExceptionStatus = GetExceptionCode(); \
|
|
||||||
} \
|
|
||||||
ok(ExceptionStatus == (ExpectedStatus), \
|
|
||||||
"Exception 0x%08lx, expected 0x%08lx\n", \
|
|
||||||
ExceptionStatus, (ExpectedStatus)); \
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ok_hr(status, expected) ok_hex(status, expected)
|
#define ok_hr(status, expected) ok_hex(status, expected)
|
||||||
#define ok_hr_(file, line, status, expected) ok_hex_(file, line, status, expected)
|
#define ok_hr_(file, line, status, expected) ok_hex_(file, line, status, expected)
|
||||||
|
|
|
@ -118,25 +118,14 @@ typedef int RPC_STATUS;
|
||||||
#include <excpt.h>
|
#include <excpt.h>
|
||||||
#include <winerror.h>
|
#include <winerror.h>
|
||||||
|
|
||||||
#ifndef __USE_PSEH2__
|
#define RpcTryExcept _SEH2_TRY
|
||||||
#define RpcTryExcept __try {
|
#define RpcExcept(expr) _SEH2_EXCEPT((expr))
|
||||||
#define RpcExcept(expr) } __except (expr) {
|
#define RpcEndExcept _SEH2_END;
|
||||||
#define RpcEndExcept }
|
#define RpcTryFinally _SEH2_TRY
|
||||||
#define RpcTryFinally __try {
|
#define RpcFinally _SEH2_FINALLY
|
||||||
#define RpcFinally } __finally {
|
#define RpcEndFinally _SEH2_END;
|
||||||
#define RpcEndFinally }
|
#define RpcExceptionCode() _SEH2_GetExceptionCode()
|
||||||
#define RpcExceptionCode() GetExceptionCode()
|
#define RpcAbnormalTermination() (_SEH2_GetExceptionCode() != 0)
|
||||||
#define RpcAbnormalTermination() AbnormalTermination()
|
|
||||||
#else
|
|
||||||
#define RpcTryExcept _SEH2_TRY
|
|
||||||
#define RpcExcept(expr) _SEH2_EXCEPT((expr))
|
|
||||||
#define RpcEndExcept _SEH2_END;
|
|
||||||
#define RpcTryFinally _SEH2_TRY
|
|
||||||
#define RpcFinally _SEH2_FINALLY
|
|
||||||
#define RpcEndFinally _SEH2_END;
|
|
||||||
#define RpcExceptionCode() _SEH2_GetExceptionCode()
|
|
||||||
#define RpcAbnormalTermination() (_SEH2_GetExceptionCode() != 0)
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__RPC_WIN64__)
|
#if defined(__RPC_WIN64__)
|
||||||
|
|
|
@ -55,7 +55,6 @@ typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD
|
||||||
#define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD
|
#define PEXCEPTION_REGISTRATION_RECORD PWINE_EXCEPTION_REGISTRATION_RECORD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __USE_PSEH2__
|
|
||||||
#define __TRY _SEH2_TRY
|
#define __TRY _SEH2_TRY
|
||||||
#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
|
#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
|
||||||
#define __EXCEPT_CTX(func, ctx) _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx))
|
#define __EXCEPT_CTX(func, ctx) _SEH2_EXCEPT((func)(GetExceptionInformation(), ctx))
|
||||||
|
@ -76,16 +75,6 @@ typedef struct _WINE_EXCEPTION_REGISTRATION_RECORD
|
||||||
#ifndef AbnormalTermination
|
#ifndef AbnormalTermination
|
||||||
#define AbnormalTermination() _SEH2_AbnormalTermination()
|
#define AbnormalTermination() _SEH2_AbnormalTermination()
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
#define __TRY __try
|
|
||||||
#define __EXCEPT(func) __except(func(GetExceptionInformation()))
|
|
||||||
#define __EXCEPT_CTX(func, ctx) __except((func)(GetExceptionInformation(), ctx))
|
|
||||||
#define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == STATUS_ACCESS_VIOLATION)
|
|
||||||
#define __EXCEPT_ALL __except(1)
|
|
||||||
#define __ENDTRY
|
|
||||||
#define __FINALLY(func) __finally { func(!AbnormalTermination()); }
|
|
||||||
#define __FINALLY_CTX(func, ctx) __finally { func(!AbnormalTermination(), ctx); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
#if defined(__MINGW32__) || defined(__CYGWIN__)
|
||||||
#define sigjmp_buf jmp_buf
|
#define sigjmp_buf jmp_buf
|
||||||
|
|
Loading…
Reference in a new issue