This change allows building with compiler exception support enabled (`-DUSE_COMPILER_EXCEPTIONS`) on non-i386 targets.
On i386, `_except_handler3` needs to be available. While we provide it as an import from the msvcrt DLLs, that's not sufficient for modules like kernel32. Making this work would likely require moving `_except_handler3` to `winecrt0`.
In practice, this fixes the build with Clang, although the resulting binaries do not appear to be fully correct yet. Further investigation is needed, likely on the LLVM side.
From: Jacek Caban jacek@codeweavers.com
This fixes invalid syntax when compiler exceptions are enabled. --- dlls/msvcrt/cpp.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c index 84959f1a05c..b8242c06e17 100644 --- a/dlls/msvcrt/cpp.c +++ b/dlls/msvcrt/cpp.c @@ -937,6 +937,8 @@ int __cdecl _is_exception_typeof(const type_info *ti, EXCEPTION_POINTERS *ep) } } __EXCEPT_PAGE_FAULT + { + } __ENDTRY
if(ret == -1)
From: Jacek Caban jacek@codeweavers.com
Fixes format warnings when compiler exception support is enabled. --- dlls/rpcrt4/tests/server.c | 2 +- include/rpc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index baf00aee744..07926ee9a36 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -2834,7 +2834,7 @@ START_TEST(server) } RpcExcept(TRUE) { - trace("Exception %d\n", RpcExceptionCode()); + trace("Exception %ld\n", RpcExceptionCode()); } RpcEndExcept } diff --git a/include/rpc.h b/include/rpc.h index 2d4323428c4..88bd51e94bf 100644 --- a/include/rpc.h +++ b/include/rpc.h @@ -79,7 +79,7 @@ typedef void* I_RPC_HANDLE; #define RpcTryFinally #define RpcFinally #define RpcEndFinally -#define RpcExceptionCode() 0 +#define RpcExceptionCode() ((ULONG)0) /* #define RpcAbnormalTermination() abort() */
#endif /* USE_COMPILER_EXCEPTIONS */
From: Jacek Caban jacek@codeweavers.com
--- dlls/winecrt0/exception.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winecrt0/exception.c b/dlls/winecrt0/exception.c index 58cf91172ac..80c13eb9a68 100644 --- a/dlls/winecrt0/exception.c +++ b/dlls/winecrt0/exception.c @@ -23,7 +23,7 @@ #include "wine/exception.h" #include "wine/asm.h"
-#if defined(__GNUC__) || defined(__clang__) +#if (defined(__GNUC__) || defined(__clang__)) && !defined(USE_COMPILER_EXCEPTIONS)
#if defined(__i386__)
@@ -190,4 +190,4 @@ DWORD __cdecl __wine_finally_ctx_handler( EXCEPTION_RECORD *record, return ExceptionContinueSearch; }
-#endif /* __GNUC__ || __clang__ */ +#endif /* (__GNUC__ || __clang__) && !USE_COMPILER_EXCEPTIONS */
Alexandre Julliard (@julliard) commented about dlls/winecrt0/exception.c:
#include "wine/exception.h" #include "wine/asm.h"
-#if defined(__GNUC__) || defined(__clang__) +#if (defined(__GNUC__) || defined(__clang__)) && !defined(USE_COMPILER_EXCEPTIONS)
This would break Winelib if an app is built without -DUSE_COMPILER_EXCEPTIONS.