[PATCH] include: Make break out of __TRY blocks work with compiler exceptions.

Stefan Dösinger stefandoesinger at gmx.at
Sun Feb 12 08:27:12 CST 2017


ddraw.dll uses this. I am using compiler exceptions for my Visual Studio
build setup. A ddraw.dll compiled with this passes the test added by
commit d9f2b4627. I manually tested the functionality of __TRY-__FINALLY,
__EXCEPT_ALL and __EXCEPT(func).

Signed-off-by: Stefan Dösinger <stefandoesinger at gmx.at>
---
 include/wine/exception.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/wine/exception.h b/include/wine/exception.h
index f275568..a74db9a 100644
--- a/include/wine/exception.h
+++ b/include/wine/exception.h
@@ -79,12 +79,12 @@ extern "C" {
  */
 #ifdef USE_COMPILER_EXCEPTIONS
 
-#define __TRY __try
-#define __EXCEPT(func) __except((func)(GetExceptionInformation()))
-#define __FINALLY(func) __finally { (func)(!AbnormalTermination()); }
-#define __ENDTRY /*nothing*/
-#define __EXCEPT_PAGE_FAULT __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
-#define __EXCEPT_ALL __except(EXCEPTION_EXECUTE_HANDLER)
+#define __TRY __try { do
+#define __EXCEPT(func) while(0); } __except((func)(GetExceptionInformation())) { do
+#define __FINALLY(func) while(0); } __finally { (func)(!AbnormalTermination()); }
+#define __ENDTRY while(0); }
+#define __EXCEPT_PAGE_FAULT while(0); } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION) { do
+#define __EXCEPT_ALL while(0); } __except(EXCEPTION_EXECUTE_HANDLER) { do
 
 #else  /* USE_COMPILER_EXCEPTIONS */
 
-- 
2.10.2




More information about the wine-patches mailing list