make singeli assertions checked in debug mode

This commit is contained in:
dzaima 2023-04-28 14:58:45 +03:00
parent 187eea1197
commit 34a4d48d95
2 changed files with 3 additions and 2 deletions

View File

@ -40,8 +40,8 @@ def rare{x & knum{x}} = x
def rare{x:u1} = emit{u1, '__builtin_expect', x, 0}
def assert{x & x==0} = assert{'failed assertion'}
def assert{x & x==1} = 1
def unreachable{} = emit{void, '__builtin_unreachable'}
def assert{x:u1} = { if (not x) emit{void, '__builtin_unreachable'} }
def unreachable{} = emit{void, 'si_unreachable'}
def assert{x:u1} = { if (not x) emit{void, 'si_unreachable'} }
# various checks
def isreg = kreg

View File

@ -14,6 +14,7 @@
#define SINGELI_FILE0(X) #X
#define SINGELI_FILE1(X) SINGELI_FILE0(X)
#define si_unreachable() ({UD})
#endif