corn/include/panic.h

14 lines
452 B
C
Raw Normal View History

2024-01-29 21:27:03 +00:00
#pragma once
#define _PANIC_STR(x) _PANIC_STR2(x)
#define _PANIC_STR2(x) #x
2024-02-03 05:37:02 +00:00
#define panic(...) _panic_impl(_PANIC_STR(__LINE__), __FILE__, __VA_ARGS__)
#define kassert(val, ...) do { if (!(val)) { panic(__VA_ARGS__); } } while(0)
2024-01-29 21:27:03 +00:00
2024-02-03 05:37:02 +00:00
__attribute__((format(printf, 3, 4)))
_Noreturn void _panic_impl(char *line, char *file, char *format, ...);
2024-01-30 15:19:33 +00:00
2024-02-03 05:37:02 +00:00
__attribute__((format(printf, 3, 4)))
_Noreturn void panic_interrupt(void *ip, void *bp, char *format, ...);