htils 1
A small set of utilities for C programming.
Loading...
Searching...
No Matches
assert.h
Go to the documentation of this file.
1#ifndef HTILS_ASSERT_H
2#define HTILS_ASSERT_H
3
5#define _GNU_SOURCE
6
7/***********************************/
8
9#include <htils/basictypes.h>
10
11/***********************************/
12
22
42_Noreturn void __htils_assert_fail(const cstr *expr_str, const cstr *executable,
43 const cstr *file, u32 line,
44 const cstr *func);
45
57#define htils_assert(expr) \
58 ((expr) ? (void)0 \
59 : __htils_assert_fail(#expr, program_invocation_short_name, \
60 __FILE__, __LINE__, __func__))
61
62#endif // !HTILS_ASSERT_H
cstr * program_invocation_short_name
The name of the program, exposed by the GNU standard.
_Noreturn void __htils_assert_fail(const cstr *expr_str, const cstr *executable, const cstr *file, u32 line, const cstr *func)
Terminates the program with an error message.
Definition assert.c:11
char cstr
Definition basictypes.h:59
uint32_t u32
Definition basictypes.h:19