This commit is contained in:
2026-08-11 17:48:20 +02:00
committed by Marvin Friedrich
parent cf33867e68
commit 0e2d4ed8c6
55 changed files with 279 additions and 346 deletions
+26
View File
@@ -0,0 +1,26 @@
#pragma once
#include <common/compiler.h>
#include <kernel/panic.h>
// Like the standard C assert, but also active in debug builds.
#define assert(expr, msg, ...) \
({ \
if (__unlikely(!(expr))) { \
panic( \
"In function \"%s\" (%s:%u):\n" \
"Assertion \"%s\" failed!\n" msg, \
__FUNCTION__, \
__FILE__, \
__LINE__, \
#expr, \
##__VA_ARGS__ \
); \
} \
})
#ifndef NDEBUG
#define debug_assert(...) assert(__VA_ARGS__)
#else
#define debug_assert(...) ((void)0)
#endif