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

Dmitry Timoshkov dmitry at baikal.ru
Sun Feb 12 09:08:56 CST 2017


Stefan Dösinger <stefandoesinger at gmx.at> wrote:

> >> +#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
> > 
> > Perhaps add another '{' after 'do' and and '}' before 'while(0)' ?
> The code that uses these macros has to put a '{' after __TRY/__EXCEPT
> and '}' before __EXCEPT, __ENDTRY and __FINALLY, so I don't think it is
> needed. If you think it'll make the macros more readable I can add them
> though.

You are right, existing macros also don't have additional braces, so your
new macros stay in line with current ones.

-- 
Dmitry.



More information about the wine-devel mailing list