97extern _Thread_local _pblock_jmp_buf_node* _ptry_top;
109#if defined(__GNUC__) && __GNUC__ >= 12
110#define ptDisablePtrWarning \
111 _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdangling-pointer\"")
112#define ptReenableWarnings _Pragma("GCC diagnostic pop")
114#define ptDisablePtrWarning
115#define ptReenableWarnings
147_meta_inline
void _ptry_clear(
void)
149 _ptry_exc = _ptry_exc_empty;
152_meta_inline
void _ptry_push(_pblock_jmp_buf_node* node)
154 node->next = _ptry_top;
160_meta_inline _pblock_jmp_buf_node* _ptry_pop(
void)
162 _pblock_jmp_buf_node* ret = _ptry_top;
166 _ptry_top = ret->next;
171_meta_inline
void _ptry_pop_until(_pblock_jmp_buf_node* node)
173 _pblock_jmp_buf_node* last;
177 }
while (last && last != node);
181_meta_inline
void _ptry_throw(
int code,
const char* msg,
const char* file,
int ln)
183_meta_inline
void _ptry_throw(
int code,
const char* msg)
187 _ptry_exc.
code = code;
190 _ptry_exc.file = file;
196 _pbLongjmp(_ptry_top, -1);
199 _ptry_handle_unhandled(&_ptry_exc);
237#define ptThrow(code, msg) _ptry_throw(code, msg, __FILE__, __LINE__)
239#define ptThrow(code, msg) _ptry_throw(code, msg)
273#define ptRethrow _ptry_throw(_ptry_exc.code, _ptry_exc.msg, _ptry_exc.file, _ptry_exc.ln)
275#define ptRethrow _ptry_throw(_ptry_exc.code, _ptry_exc.msg)
311 for (unsigned _ptry_phase = 0; _ptry_phase < 2; ++_ptry_phase) \
313 _blkBefore(_ptry_push(_pblock_unwind_top)) do
316#define _ptry_after_block \
325 _blkBefore(_ptry_phase = 2)
327 _blkBefore(_ptry_pop_until(_pblock_unwind_top))
359 _blkAfter(_ptry_exc.code ? ptRethrow : nop_stmt)
406#define ptCatch _ptry_after_block _blkAfter(_ptry_clear())
429#define ptCode _ptry_exc.code
449#define ptMsg _ptry_exc.msg
Protected blocks with stack unwinding (advanced feature)
int code
Application-specific exception code.
const char * msg
Exception message - MUST be a static string literal.