#ifndef COMMON_PANIC_H #define COMMON_PANIC_H #include #include #define PANIC(...) \ (fputs("panic: ", stderr), \ fprintf(stderr, __VA_ARGS__), \ fprintf( \ stderr, "\n\tat ./%s:%d in %s()\n", __FILE__, __LINE__, __func__ \ ), \ exit(1)) #define ASSERT(condition, ...) \ if (!(condition)) \ (fputs("assertion failed: ", stderr), \ fprintf(stderr, __VA_ARGS__), \ fprintf( \ stderr, "\n\tat ./%s:%d in %s()\n", __FILE__, __LINE__, __func__ \ ), \ exit(1)) #endif