corn/include/panic.h
2024-02-01 17:01:52 -05:00

12 lines
344 B
C

#pragma once
#define _PANIC_STR(x) _PANIC_STR2(x)
#define _PANIC_STR2(x) #x
#define panic(msg) _panic_impl(_PANIC_STR(__LINE__), __FILE__, msg)
#define kassert(val, msg) do { if (!(val)) { panic(msg); } } while(0)
_Noreturn void _panic_impl(char *line, char *file, char *msg);
_Noreturn void panic_interrupt(void *ip, void *bp, char *msg);