From 507c27488722d39224669795b2e4c385b55ce0de Mon Sep 17 00:00:00 2001 From: Elaina Claus Date: Thu, 15 Jan 2026 12:51:08 -0500 Subject: [PATCH] added prototype for basic oops handler function --- include/nickel/oops.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 include/nickel/oops.h 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