libpulsar
A modular compiler for the pulsar programming language
Loading...
Searching...
No Matches
abort.h
Go to the documentation of this file.
1
8#pragma once
9
10#include "def.h"
11
12#ifndef _PS_PUBLIC_SRC
13 #ifdef PS_DEBUG
17 #define CHECK(...) __VA_ARGS__
18 #else
22 #define CHECK(...) /* nothing */
23 #endif
24
33void _ps_abort(STR msg, int code, STR filename, STR function, int line);
34
40 #define ps_abort_with_code(msg, code) \
41 _ps_abort(msg, code, __FILE__, __func__, __LINE__)
42
47 #define ps_abort(msg) ps_abort_with_code(msg, 1)
48
53 #define ps_assert(cond, msg) \
54 do { \
55 CHECK({ \
56 if (!(cond)) { \
57 ps_abort(msg); \
58 } \
59 }) \
60 } while (0)
61
65 #define PS_NO_MEMORY() ps_abort("Virtual memory exhausted")
66
70 #define PS_NO_IMPL() ps_abort("Function took path not yet implemented")
71#endif
void _ps_abort(STR msg, int code, STR filename, STR function, int line)
Aborts the program with the given message.
Definition abort.c:7
Base definitions.
#define STR
Definition def.h:40