- Adjusted how asserts work and types of asserts
This commit is contained in:
@@ -27,7 +27,15 @@ using assert_handler = void (*)(const char *, const char *, int , const char *);
|
||||
|
||||
extern void __assert_impl(const char* expression, const char* file, int line, const char* function, const char* desc);
|
||||
|
||||
// flagged unlikely to optimize branch prediction
|
||||
#define assert(expression, description) \
|
||||
if(not(expression)) { __assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description); }
|
||||
if(not(expression)) [[unlikely]] \
|
||||
{ __assert_impl(#expression, __FILE__, __LINE__, __PRETTY_FUNCTION__, description); }
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define assertd(expression, description) (0)
|
||||
#else
|
||||
#define assertd(expression, description) assert(expression, description)
|
||||
#endif
|
||||
|
||||
#endif // FENNEC_LANG_ASSERT_H
|
||||
|
||||
Reference in New Issue
Block a user