Defines | |
#define | cu_bugf(...) cu_bugf_fl(__FILE__, __LINE__, __VA_ARGS__) |
#define | cu_bug_unreachable() |
#define | cu_bug_unfinished() |
#define | cu_bug_todo(descr) cu_bugf_fl(__FILE__, __LINE__, "TODO: "descr) |
#define | cu_bugf_domain(...) cu_bugf_domain_in(__func__, __VA_ARGS__) |
Functions | |
void | cu_errf (char const *fmt,...) |
void | cu_verrf (char const *msg, va_list va) |
void | cu_warnf (char const *fmt,...) |
void | cu_vwarnf (char const *msg, va_list va) |
void | cu_verbf (int level, char const *fmt,...) |
int | cu_verbosity () |
void | cu_set_verbosity (int verbosity) |
void | cu_bugf_n (char const *fmt,...) CU_ATTR_NORETURN |
void | cu_bugf_at (cu_location_t, char const *fmt,...) CU_ATTR_NORETURN |
void | cu_bugf_fl (char const *file, int line, char const *msg,...) CU_ATTR_NORETURN |
void | cu_bugf_domain_in (char const *funcname, int argno, char const *argname, char const *fmt,...) CU_ATTR_NORETURN |
void | cu_handle_syserror (int err_code, char const *proc_name) |
void | cu_raise_out_of_memory (size_t size) |
void | cu_check_out_of_memory (void *ptr, size_t size) |
typedef | cu_clop (cu_diag_format_fn_t, void, cu_str_t fmt, cu_va_ref_t va, FILE *out) |
void | cu_diag_define_format_key (char key, cu_diag_format_fn_t fn) CU_ATTR_DEPRECATED |
void | cu_fprintf (FILE *, char const *,...) |
void | cu_vfprintf (FILE *, char const *, va_list va) |
void | cu_errf_at (cu_location_t loc, char const *fmt,...) |
void | cu_verrf_at (cu_location_t loc, char const *msg, va_list va) |
void | cu_warnf_at (cu_location_t loc, char const *fmt,...) |
void | cu_vwarnf_at (cu_location_t loc, char const *msg, va_list va) |
void | cu_verbf_at (int level, cu_location_t, char const *fmt,...) |
#define cu_bug_todo | ( | descr | ) | cu_bugf_fl(__FILE__, __LINE__, "TODO: "descr) |
Similar to cu_bug_unfinished, but also accepts an argument describing the unfinished work.
#define cu_bug_unfinished | ( | ) |
cu_bugf_fl(__FILE__, __LINE__, \ "Reached a code point which is not yet written.")
Temporary replacement for unfinished code, which aborts with an error message.
#define cu_bug_unreachable | ( | ) |
cu_bugf_fl(__FILE__, __LINE__, \ "This point should not have been reached.")
Asserts that the code point of the macro expansion is unreachable. For a version conditioned on CU_NDEBUG
, see cu_debug_unreachable.
#define cu_bugf | ( | ... | ) | cu_bugf_fl(__FILE__, __LINE__, __VA_ARGS__) |
Prints an internal error with the location of the callee and aborts. The arguments are the same as cu_bugf_n.
#define cu_bugf_domain | ( | ... | ) | cu_bugf_domain_in(__func__, __VA_ARGS__) |
Convenience macro around cu_bugf_domain_in, where __func__
is passed as the first argument.
void cu_bugf_at | ( | cu_location_t | , | |
char const * | fmt, | |||
... | ||||
) |
Prints an internal error with reference to source code and aborts.
void cu_bugf_domain_in | ( | char const * | funcname, | |
int | argno, | |||
char const * | argname, | |||
char const * | fmt, | |||
... | ||||
) |
Report that argument number argno (from 0) with symbolic name argname is outside the domain for the call to funcname, and print the additional message using the printf format fmt with the remaining arguments, then abort.
void cu_bugf_fl | ( | char const * | file, | |
int | line, | |||
char const * | msg, | |||
... | ||||
) |
Prints an internal error with reference to source code and aborts.
void cu_bugf_n | ( | char const * | fmt, | |
... | ||||
) |
Prints an internal error without location and aborts. Usually cu_bugf is more useful.
void cu_diag_define_format_key | ( | char | key, | |
cu_diag_format_fn_t | fn | |||
) |
Define a new format key for cu_fprintf by mapping key to the handler fn. The handler will be passed the format specifier along with reference to the current va_list
state and the output file.
void cu_errf | ( | char const * | fmt, | |
... | ||||
) |
A specialised cu_fprintf for printing error messages.
void cu_errf_at | ( | cu_location_t | loc, | |
char const * | fmt, | |||
... | ||||
) |
A specialised cu_fprintf for printing error messages with reference to source code.
void cu_fprintf | ( | FILE * | , | |
char const * | , | |||
... | ||||
) |
A fprintf
work-alike which supports registering new keys through cu_diag_define_format_key.
void cu_set_verbosity | ( | int | verbosity | ) |
Sets the verbosity level for cu_verbf and cu_verbf_at calls.
void cu_verbf | ( | int | level, | |
char const * | fmt, | |||
... | ||||
) |
Prints an informative message to if verbosity level is at least level.
void cu_verbf_at | ( | int | level, | |
cu_location_t | , | |||
char const * | fmt, | |||
... | ||||
) |
Prints an informative message with reference to source code if verbosity level is at least level.
int cu_verbosity | ( | ) |
The current verbosity level.
void cu_verrf | ( | char const * | msg, | |
va_list | va | |||
) |
As cu_errf, but passing arguments as a va_list
.
void cu_verrf_at | ( | cu_location_t | loc, | |
char const * | msg, | |||
va_list | va | |||
) |
As cu_errf_at, but passing arguments as a va_list
.
void cu_vfprintf | ( | FILE * | , | |
char const * | , | |||
va_list | va | |||
) |
As cu_fprintf, but passing arguments as a va_list
.
void cu_vwarnf | ( | char const * | msg, | |
va_list | va | |||
) |
As cu_warnf, but passing arguments as a va_list
.
void cu_vwarnf_at | ( | cu_location_t | loc, | |
char const * | msg, | |||
va_list | va | |||
) |
As cu_warnf_at, but passing arguments as a va_list
.
void cu_warnf | ( | char const * | fmt, | |
... | ||||
) |
A specialised cu_fprintf for printing warnings.
void cu_warnf_at | ( | cu_location_t | loc, | |
char const * | fmt, | |||
... | ||||
) |
A specialised cu_fprintf for printing warnings with reference to source code.