20#if defined(__clang__) && !defined(_SEH3$_FRAME_ALL_NONVOLATILES)
21#define _SEH3$_FRAME_ALL_NONVOLATILES 1
31#elif defined(__cplusplus)
75#ifdef _SEH3$_FRAME_ALL_NONVOLATILES
92 asm volatile (
"movl %k[NewHead], %%fs:0"
93 : : [NewHead]
"ir" (RegistrationFrame->
Next) :
"memory");
98void _SEH3$_UnregisterTryLevel(
102 asm volatile (
"movl %%fs:0, %k[RegistrationFrame]"
103 : [RegistrationFrame]
"=r" (RegistrationFrame) : );
120#define _SEH3$_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_AutoCleanup)))
125_SEH3$_RegisterFrameWithNonVolatiles(
133_SEH3$_RegisterTryLevelWithNonVolatiles(
142#define _SEH3$_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(4)) : "%esp", "memory")
145#define _SEH3$_ASM_GOTO(...)
147#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \
149 int result = _SEH3$_RegisterFrameWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \
150 if (__builtin_expect(result != 0, 0)) \
152 if (result == 1) goto _SEH3$_l_FilterOrFinally; \
153 if (result == 2) goto _SEH3$_l_HandlerTarget; \
154 goto _SEH3$_l_BeforeFilterOrFinally; \
158#define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \
160 int result = _SEH3$_RegisterTryLevelWithNonVolatiles(_TrylevelFrame, _DataTable, __builtin_alloca(0)); \
161 if (__builtin_expect(result != 0, 0)) \
163 if (result == 1) goto _SEH3$_l_FilterOrFinally; \
164 if (result == 2) goto _SEH3$_l_HandlerTarget; \
165 goto _SEH3$_l_BeforeFilterOrFinally; \
169#define _SEH3$_SCARE_GCC()
174#define _SEH3$_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(0)) : "%esp", "memory")
176#define _SEH3$_ASM_GOTO(...) asm goto ("#\n" : : : "memory" : __VA_ARGS__)
179#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \
180 asm goto ("leal %0, %%eax\n\t" \
181 "leal %1, %%edx\n\t" \
182 "call " #_Function "WithStackLayout" \
184 : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "c" (__builtin_alloca(0)), "p" (_SEH3$_RegisterFrameWithNonVolatiles) \
185 : "eax", "edx", "memory" \
186 : _SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally)
189#define _SEH3$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \
190 asm goto ("leal %0, %%eax\n\t" \
191 "leal %1, %%edx\n\t" \
194 : "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "p" (_SEH3$_RegisterFrameWithNonVolatiles) \
195 : "eax", "edx", "ecx", "memory" \
196 : _SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally)
200#define _SEH3$_RegisterFrame_(_TrylevelFrame, _DataTable) \
201 _SEH3$_CALL_WRAPPER(__SEH3$_RegisterFrame, _TrylevelFrame, _DataTable)
204#define _SEH3$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \
205 _SEH3$_CALL_WRAPPER(__SEH3$_RegisterTryLevel, _TrylevelFrame, _DataTable)
209#define _SEH3$_SCARE_GCC() \
211 _SEH3$_ASM_GOTO(_SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally); \
212 asm volatile ("#" : "=a"(plabel) : "p"(&&_SEH3$_l_BeforeTry), "p"(&&_SEH3$_l_HandlerTarget), "p"(&&_SEH3$_l_OnException), "p"(&&_SEH3$_l_FilterOrFinally) \
213 : "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" ); \
214 goto _SEH3$_l_OnException;
219#if defined(__cplusplus) || defined(__clang__)
228#define _SEH3$_DECLARE_CLEANUP_FUNC(_Name)
229#define _SEH3$_DEFINE_CLEANUP_FUNC(_Name)
230#define _SEH3$_DECLARE_FILTER_FUNC(_Name)
231#define _SEH3$_DEFINE_DUMMY_FINALLY(_Name)
234#define _SEH3$_NESTED_FUNC_RETURN(_Result) \
236 asm volatile ("movl %[FixedEsp], %%esp\n\tret" \
237 : : "a" (_Result), [FixedEsp] "m" (_SEH3$_TrylevelFrame.AllocaFrame) : "ebx", "ecx", "edx", "esi", "edi", "flags", "memory")
240#define _SEH3$_DEFINE_FILTER_FUNC(_Name, expression) \
243 asm volatile ("#\n" : : : "eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"); \
244 _SEH3$_NESTED_FUNC_RETURN((expression)); \
247#define _SEH3$_FINALLY_FUNC_OPEN(_Name) \
249 asm volatile ("#\n" : : : "eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"); \
252 for (; ; (void)({_SEH3$_NESTED_FUNC_RETURN(0); 0;}))
254#define _SEH3$_FILTER(_Filter, _FilterExpression) (&&_SEH3$_l_FilterOrFinally)
255#define _SEH3$_FINALLY(_Finally) (&&_SEH3$_l_FilterOrFinally)
257#define _SEH3$_DECLARE_EXCEPT_INTRINSICS()
260#define _abnormal_termination() (_SEH3$_TrylevelFrame.ExceptionPointers != 0)
261#define _exception_code() (_SEH3$_TrylevelFrame.ExceptionCode)
262#define _exception_info() (_SEH3$_TrylevelFrame.ExceptionPointers)
266#define _SEH3$_DECLARE_EXCEPT_INTRINSICS() \
267 inline __attribute__((always_inline, gnu_inline)) \
268 unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; }
278#define _SEH3$_DECLARE_FILTER_FUNC(_Name) \
279 auto int __fastcall _Name(int Action)
281#define _SEH3$_NESTED_FUNC_OPEN(_Name) \
282 int __fastcall _Name(int Action) \
285 if (Action == 0) return (int)&_SEH3$_TrylevelFrame;
287#define _SEH3$_DEFINE_FILTER_FUNC(_Name, expression) \
288 _SEH3$_NESTED_FUNC_OPEN(_Name) \
290_Pragma("GCC diagnostic push") \
291_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
292 inline __attribute__((always_inline, gnu_inline)) \
293 unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; } \
294 inline __attribute__((always_inline, gnu_inline)) \
295 void * _exception_info() { return _SEH3$_TrylevelFrame.ExceptionPointers; } \
296_Pragma("GCC diagnostic pop") \
299 return (expression); \
302#define _SEH3$_FINALLY_FUNC_OPEN(_Name) \
303 _SEH3$_NESTED_FUNC_OPEN(_Name) \
305 inline __attribute__((always_inline, gnu_inline)) \
306 int _abnormal_termination() { return (_SEH3$_TrylevelFrame.ExceptionPointers != 0); } \
310 for (; ; (void)({return 0; 0;}))
312#define _SEH3$_FILTER(_Filter, _FilterExpression) \
313 (__builtin_constant_p(_FilterExpression) ? (void*)(unsigned long)(unsigned char)(unsigned long)(_FilterExpression) : _Filter)
315#define _SEH3$_FINALLY(_Finally) (_Finally)
317#define _SEH3$_DEFINE_DUMMY_FINALLY(_Name) \
318 auto inline __attribute__((always_inline,gnu_inline)) int _Name(int Action) { (void)Action; return 0; }
320#define _SEH3$_DECLARE_CLEANUP_FUNC(_Name) \
321 auto inline __attribute__((always_inline,gnu_inline)) void _Name(volatile SEH3$_REGISTRATION_FRAME *p)
323#define _SEH3$_DEFINE_CLEANUP_FUNC(_Name) \
324 _SEH3$_DECLARE_CLEANUP_FUNC(_Name) \
328 if (_SEH3$_TryLevel == 1) _SEH3$_UnregisterFrame(&_SEH3$_TrylevelFrame); \
329 else _SEH3$_UnregisterTryLevel(&_SEH3$_TrylevelFrame); \
332 _SEH3$_FinallyFunction(1); \
340 _SEH3$_PreventInlining(); \
344 __label__ _SEH3$_l_BeforeTry; \
345 __label__ _SEH3$_l_DoTry; \
346 __label__ _SEH3$_l_AfterTry; \
347 __label__ _SEH3$_l_EndTry; \
348 __label__ _SEH3$_l_HandlerTarget; \
349 __label__ _SEH3$_l_OnException; \
350 __label__ _SEH3$_l_BeforeFilterOrFinally; \
351 __label__ _SEH3$_l_FilterOrFinally; \
352 (void)&&_SEH3$_l_OnException; \
353 (void)&&_SEH3$_l_BeforeFilterOrFinally; \
354 (void)&&_SEH3$_l_FilterOrFinally; \
358 _SEH3$_PreviousTryLevel = _SEH3$_TryLevel, \
359 _SEH3$_TryLevel = _SEH3$_PreviousTryLevel + 1, \
363 _SEH3$_DECLARE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \
366 volatile SEH3$_REGISTRATION_FRAME _SEH3$_AUTO_CLEANUP _SEH3$_TrylevelFrame; \
368 goto _SEH3$_l_BeforeTry; \
369 goto _SEH3$_l_AfterTry; \
375#define _SEH3_EXCEPT(...) \
377 _SEH3$_l_AfterTry: (void)0; \
378 goto _SEH3$_l_EndTry; \
380 _SEH3$_l_BeforeTry: (void)0; \
381 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
384 _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FilterFunction); \
387 static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { &&_SEH3$_l_HandlerTarget, _SEH3$_FILTER(&_SEH3$_FilterFunction, (__VA_ARGS__)), _SEH3$_TryLevel, _SEH3$_HANDLER_TYPE }; \
390 if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
391 else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
394 _SEH3$_DEFINE_DUMMY_FINALLY(_SEH3$_FinallyFunction) \
397 _SEH3$_DECLARE_EXCEPT_INTRINSICS(); \
399 goto _SEH3$_l_DoTry; \
401 _SEH3$_l_BeforeFilterOrFinally: (void)0; \
403 _SEH3$_EnforceFramePointer(); \
405 _SEH3$_l_FilterOrFinally: (void)0; \
407 _SEH3$_DEFINE_FILTER_FUNC(_SEH3$_FilterFunction, (__VA_ARGS__)) \
409 _SEH3$_l_HandlerTarget: (void)0; \
410 _SEH3$_EnforceFramePointer(); \
415 asm volatile ("#\n"); \
419#define _SEH3_FINALLY \
421 _SEH3$_l_AfterTry: (void)0; \
423 _SEH3$_TrylevelFrame.ExceptionPointers = 0; \
425 goto _SEH3$_l_EndTry; \
427 _SEH3$_l_BeforeTry: (void)0; \
428 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
431 _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FinallyFunction); \
434 static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { 0, _SEH3$_FINALLY(&_SEH3$_FinallyFunction), _SEH3$_TryLevel, _SEH3$_HANDLER_TYPE }; \
437 if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
438 else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
439 _SEH3$_TrylevelFrame.ExceptionPointers = (PSEH3$_EXCEPTION_POINTERS)1; \
441 goto _SEH3$_l_DoTry; \
443 _SEH3$_l_HandlerTarget: (void)0; \
444 _SEH3$_EnforceFramePointer(); \
446 _SEH3$_l_BeforeFilterOrFinally: (void)0; \
447 _SEH3$_EnforceFramePointer(); \
448 _SEH3$_l_FilterOrFinally: (void)0; \
449 _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction)
454 goto _SEH3$_l_EndTry; \
456 _SEH3$_l_OnException: (void)0; \
458 _SEH3$_SCARE_GCC(); \
460 _SEH3$_l_EndTry:(void)0; \
461 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
464 _SEH3$_DEFINE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \
469#define _SEH3_LEAVE goto _SEH3$_l_AfterTry
471#define _SEH3_VOLATILE volatile
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
struct _SEH3$_SCOPE_TABLE SEH3$_SCOPE_TABLE
struct _SEH3$_EXCEPTION_POINTERS SEH3$_EXCEPTION_POINTERS
int const SEH3$_SCOPE_TABLE void * AllocaFrame
struct _SEH3$_REGISTRATION_FRAME SEH3$_REGISTRATION_FRAME
int const SEH3$_SCOPE_TABLE * ScopeTable
struct _SEH3$_REGISTRATION_FRAME * PSEH3$_REGISTRATION_FRAME
struct _SEH3$_EXCEPTION_POINTERS * PSEH3$_EXCEPTION_POINTERS
struct _SEH3$_SCOPE_TABLE * PSEH3$_SCOPE_TABLE
int CDECL _abnormal_termination(void)
struct _CONTEXT * ContextRecord
struct _EXCEPTION_RECORD * ExceptionRecord
PSEH3$_EXCEPTION_POINTERS volatile ExceptionPointers
struct _SEH3$_REGISTRATION_FRAME * EndOfChain
PSEH3$_SCOPE_TABLE ScopeTable
unsigned long ExceptionCode
struct _SEH3$_REGISTRATION_FRAME * Next
unsigned char HandlerType
static unsigned int block