diff --git a/include/nickel/oops.h b/include/nickel/oops.h new file mode 100644 index 0000000..dc4d47d --- /dev/null +++ b/include/nickel/oops.h @@ -0,0 +1,31 @@ +#ifndef __NICKEL_OOPS_H +#define __NICKEL_OOPS_H + +#include +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// TODO: C23 adds [[noreturn]] (& [[]] function attribute tags) +// which are standardized, the below depends on compiler support. +#if defined(__GNUC__) || defined(__CLANG__) +#define NORETURN __attribute__ ((__noreturn__)) +#else +#define NORETURN +#endif /* __GNUC__ || __CLANG__*/ + +void nickel_oops_handler(const char *format, ...) NORETURN; + +#ifdef __cplusplus +} +#endif + +// clean up our noreturn define +#undef NORETURN +#endif \ No newline at end of file