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)
271#define _SEH3$_DECLARE_EXCEPT_INTRINSICS() \
272 inline __attribute__((always_inline, gnu_inline)) \
273 unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; }
283#define _SEH3$_DECLARE_FILTER_FUNC(_Name) \
284 auto _SEH3$FILTER_RESULT __fastcall _Name(int Action)
286#define _SEH3$_NESTED_FUNC_OPEN(_Name) \
287 _SEH3$FILTER_RESULT __fastcall _Name(int Action) \
290 if (Action == 0) { _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = (int)&_SEH3$_TrylevelFrame; return seh3$result; }
292#define _SEH3$_DEFINE_FILTER_FUNC(_Name, expression) \
293 _SEH3$_NESTED_FUNC_OPEN(_Name) \
295_Pragma("GCC diagnostic push") \
296_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
297 inline __attribute__((always_inline, gnu_inline)) \
298 unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; } \
299 inline __attribute__((always_inline, gnu_inline)) \
300 void * _exception_info() { return _SEH3$_TrylevelFrame.ExceptionPointers; } \
301_Pragma("GCC diagnostic pop") \
304 { _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = (expression); return seh3$result; } \
307#define _SEH3$_FINALLY_FUNC_OPEN(_Name) \
308 _SEH3$_NESTED_FUNC_OPEN(_Name) \
310 inline __attribute__((always_inline, gnu_inline)) \
311 int _abnormal_termination() { return (_SEH3$_TrylevelFrame.ExceptionPointers != 0); } \
315 for (; ; (void)({ _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = 0; return seh3$result; 0;}))
317#define _SEH3$_FILTER(_Filter, _FilterExpression) \
318 (__builtin_constant_p(_FilterExpression) ? (void*)(unsigned long)(unsigned char)(unsigned long)(_FilterExpression) : _Filter)
320#define _SEH3$_FINALLY(_Finally) (_Finally)
322#define _SEH3$_DEFINE_DUMMY_FINALLY(_Name) \
323 auto inline __attribute__((always_inline,gnu_inline)) int _Name(int Action) { (void)Action; return 0; }
325#define _SEH3$_DECLARE_CLEANUP_FUNC(_Name) \
326 auto inline __attribute__((always_inline,gnu_inline)) void _Name(volatile SEH3$_REGISTRATION_FRAME *p)
328#define _SEH3$_DEFINE_CLEANUP_FUNC(_Name) \
329 _SEH3$_DECLARE_CLEANUP_FUNC(_Name) \
333 if (_SEH3$_TryLevel == 1) _SEH3$_UnregisterFrame(&_SEH3$_TrylevelFrame); \
334 else _SEH3$_UnregisterTryLevel(&_SEH3$_TrylevelFrame); \
337 _SEH3$_FinallyFunction(1); \
345 _SEH3$_PreventInlining(); \
349 __label__ _SEH3$_l_BeforeTry; \
350 __label__ _SEH3$_l_DoTry; \
351 __label__ _SEH3$_l_AfterTry; \
352 __label__ _SEH3$_l_EndTry; \
353 __label__ _SEH3$_l_HandlerTarget; \
354 __label__ _SEH3$_l_OnException; \
355 __label__ _SEH3$_l_BeforeFilterOrFinally; \
356 __label__ _SEH3$_l_FilterOrFinally; \
357 (void)&&_SEH3$_l_OnException; \
358 (void)&&_SEH3$_l_BeforeFilterOrFinally; \
359 (void)&&_SEH3$_l_FilterOrFinally; \
363 _SEH3$_PreviousTryLevel = _SEH3$_TryLevel, \
364 _SEH3$_TryLevel = _SEH3$_PreviousTryLevel + 1, \
368 _SEH3$_DECLARE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \
371 volatile SEH3$_REGISTRATION_FRAME _SEH3$_AUTO_CLEANUP _SEH3$_TrylevelFrame; \
373 goto _SEH3$_l_BeforeTry; \
374 goto _SEH3$_l_AfterTry; \
380#define _SEH3_EXCEPT(...) \
382 _SEH3$_l_AfterTry: (void)0; \
383 goto _SEH3$_l_EndTry; \
385 _SEH3$_l_BeforeTry: (void)0; \
386 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
389 _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FilterFunction); \
392 static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { &&_SEH3$_l_HandlerTarget, _SEH3$_FILTER(&_SEH3$_FilterFunction, (__VA_ARGS__)), _SEH3$_TryLevel, _SEH3$_HANDLER_TYPE }; \
395 if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
396 else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
399 _SEH3$_DEFINE_DUMMY_FINALLY(_SEH3$_FinallyFunction) \
402 _SEH3$_DECLARE_EXCEPT_INTRINSICS(); \
404 goto _SEH3$_l_DoTry; \
406 _SEH3$_l_BeforeFilterOrFinally: (void)0; \
408 _SEH3$_EnforceFramePointer(); \
410 _SEH3$_l_FilterOrFinally: (void)0; \
412 _SEH3$_DEFINE_FILTER_FUNC(_SEH3$_FilterFunction, (__VA_ARGS__)) \
414 _SEH3$_l_HandlerTarget: (void)0; \
415 _SEH3$_EnforceFramePointer(); \
420 asm volatile ("#\n"); \
424#define _SEH3_FINALLY \
426 _SEH3$_l_AfterTry: (void)0; \
428 _SEH3$_TrylevelFrame.ExceptionPointers = 0; \
430 goto _SEH3$_l_EndTry; \
432 _SEH3$_l_BeforeTry: (void)0; \
433 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
436 _SEH3$_DECLARE_FILTER_FUNC(_SEH3$_FinallyFunction); \
439 static const SEH3$_SCOPE_TABLE _SEH3$_ScopeTable = { 0, _SEH3$_FINALLY(&_SEH3$_FinallyFunction), _SEH3$_TryLevel, _SEH3$_HANDLER_TYPE }; \
442 if (_SEH3$_TryLevel == 1) _SEH3$_RegisterFrame_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
443 else _SEH3$_RegisterTryLevel_(&_SEH3$_TrylevelFrame, &_SEH3$_ScopeTable); \
444 _SEH3$_TrylevelFrame.ExceptionPointers = (PSEH3$_EXCEPTION_POINTERS)1; \
446 goto _SEH3$_l_DoTry; \
448 _SEH3$_l_HandlerTarget: (void)0; \
449 _SEH3$_EnforceFramePointer(); \
451 _SEH3$_l_BeforeFilterOrFinally: (void)0; \
452 _SEH3$_EnforceFramePointer(); \
453 _SEH3$_l_FilterOrFinally: (void)0; \
454 _SEH3$_FINALLY_FUNC_OPEN(_SEH3$_FinallyFunction)
459 goto _SEH3$_l_EndTry; \
461 _SEH3$_l_OnException: (void)0; \
463 _SEH3$_SCARE_GCC(); \
465 _SEH3$_l_EndTry:(void)0; \
466 _SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
469 _SEH3$_DEFINE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \
474#define _SEH3_LEAVE goto _SEH3$_l_AfterTry
476#define _SEH3_VOLATILE volatile
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
#define _abnormal_termination()
#define _exception_code()
#define _exception_info()
struct _SEH3$_SCOPE_TABLE SEH3$_SCOPE_TABLE
struct _SEH3$_EXCEPTION_POINTERS SEH3$_EXCEPTION_POINTERS
int const SEH3$_SCOPE_TABLE void * AllocaFrame
struct __SEH3$FILTER_RESULT _SEH3$FILTER_RESULT
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
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