debug_assert
This commit is contained in:
parent
41c9a51ff3
commit
09aa7b285f
5
src/h.h
5
src/h.h
@ -304,7 +304,9 @@ typedef struct Arr {
|
|||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
NOINLINE NORETURN void assert_fail(char* expr, char* file, int line, const char fn[]);
|
NOINLINE NORETURN void assert_fail(char* expr, char* file, int line, const char fn[]);
|
||||||
#define assert(X) do {if (!(X)) assert_fail(#X, __FILE__, __LINE__, __PRETTY_FUNCTION__);} while(0)
|
#define assert_impl(M, X) do {if (!(X)) assert_fail(M, __FILE__, __LINE__, __PRETTY_FUNCTION__);} while(0)
|
||||||
|
#define assert(X) assert_impl(#X, X)
|
||||||
|
#define debug_assert(X) assert_impl(#X, X)
|
||||||
B VALIDATE(B x);
|
B VALIDATE(B x);
|
||||||
Value* VALIDATEP(Value* x);
|
Value* VALIDATEP(Value* x);
|
||||||
#define UD assert(false)
|
#define UD assert(false)
|
||||||
@ -315,6 +317,7 @@ typedef struct Arr {
|
|||||||
#define NOGC_E cbqn_noAlloc=false
|
#define NOGC_E cbqn_noAlloc=false
|
||||||
#else
|
#else
|
||||||
#define assert(X) do {if (!(X)) __builtin_unreachable();} while(0)
|
#define assert(X) do {if (!(X)) __builtin_unreachable();} while(0)
|
||||||
|
#define debug_assert(X)
|
||||||
#define VALIDATE(X) (X)
|
#define VALIDATE(X) (X)
|
||||||
#define VALIDATEP(X) (X)
|
#define VALIDATEP(X) (X)
|
||||||
#define UD __builtin_unreachable()
|
#define UD __builtin_unreachable()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user