Cthulhu  0.2.10
Cthulhu compiler collection
panic.h File Reference
#include <ctu_base_api.h>
#include <ctu_config.h>
#include "core/source_info.h"
#include <stdarg.h>
Include dependency graph for panic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CTU_DEBUG   0
 enable panic handling More...
 
#define CTU_PARANOID   0
 enable paranoid assertions for expensive assertions that shouldnt be used too often use these for things that you do not want being turned into assumes due to the execution cost More...
 
#define CT_PANIC_INNER(...)
 
#define CT_PANIC(...)
 panic with a message and optional format arguments More...
 
#define CTASSERTF_ALWAYS(expr, ...)
 assert a condition with a message and optional format arguments More...
 
#define CTASSERT_ALWAYS(expr)   CTASSERTF_ALWAYS(expr, "assertion failed: %s", #expr)
 
#define CTASSERTM_ALWAYS(expr, msg)   CTASSERTF_ALWAYS(expr, "%s", msg)
 
#define CTASSERTF(expr, ...)   CT_ASSUME(expr)
 assert a condition with a message and optional format arguments More...
 
#define CTASSERTM(expr, msg)   CTASSERTF(expr, "%s", msg)
 assert a condition with a message More...
 
#define CTASSERT(expr)   CTASSERTM(expr, #expr)
 assert a condition, prints the condition as a message More...
 
#define CT_NEVER(...)   CT_PANIC(__VA_ARGS__)
 assert that a code path is never reached More...
 
#define CT_ASSERT_RANGE_PRI(value, min, max, pri)    CTASSERTF((value) >= (min) && (value) <= (max), "value " pri " not in range " pri "-" pri, (value), (min), (max))
 
#define CT_ASSERT_RANGE(value, min, max)    CT_ASSERT_RANGE_PRI(value, min, max, "%d")
 assert that a value is in a range inclusive bounds check More...
 
#define CT_PARANOID(...)
 a block of code that is only executed in paranoid builds More...
 
#define CT_PARANOID_ASSERTF(expr, ...)
 assert a condition with a message and optional format arguments More...
 

Typedefs

typedef void(* panic_handler_t) (source_info_t location, STA_FORMAT_STRING const char *fmt, va_list args)
 panic handler function More...
 

Functions

CT_BASE_API CT_NORETURN ctu_panic (source_info_t location, STA_FORMAT_STRING const char *msg,...)
 panic with a message, file, and line More...
 
CT_BASE_API CT_NORETURN ctu_vpanic (source_info_t location, STA_FORMAT_STRING const char *msg, va_list args)
 panic with a message, file, and line More...
 

Variables

CT_BASE_API panic_handler_t gPanicHandler
 the global panic handler. More...