#define __TRY_TRACE() do { \ printf("trace: %s:%d\n", __FILE__, __LINE__); \ } while(0) \ // NOTE: The macro(s) below make use of a GCC extension called "Statement Exprs", which is nonstandard. // More info: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html #define TRYPTR_NIL(M_expr) __extension__({ void* _result = (void*)(M_expr); if (!_result) { __TRY_TRACE(); return (NULL); } _result; }) #define TRYPTR(M_expr) __extension__({ void* _result = (void*)(M_expr); if (!_result) { __TRY_TRACE(); return (-1); } _result; }) #define TRYST_NIL(M_expr) __extension__({ int _result = (int)(M_expr); if (_result < 0) { __TRY_TRACE(); return (NULL); } _result; }) #define TRYST(M_expr) __extension__({ int _result = (int)(M_expr); if (_result < 0) { __TRY_TRACE(); return (-1); } _result; })