mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 22:14:37 +00:00
36 lines
2.4 KiB
C
36 lines
2.4 KiB
C
#ifndef __FENNIX_KERNEL_ASSERT_H__
|
|
#define __FENNIX_KERNEL_ASSERT_H__
|
|
|
|
#include <types.h>
|
|
|
|
#include <debug.h>
|
|
|
|
#define assert(x) \
|
|
do \
|
|
{ \
|
|
if (!(x)) \
|
|
{ \
|
|
void *CallerAddress = __builtin_extract_return_addr(__builtin_return_address(0)); \
|
|
error("Assertion failed! [%s] [%#lx => %s:%s:%d]", #x, CallerAddress, __FILE__, __FUNCTION__, __LINE__); \
|
|
while (1) \
|
|
; \
|
|
} \
|
|
} while (0)
|
|
|
|
#define assert_allow_continue(x) \
|
|
do \
|
|
{ \
|
|
if (!(x)) \
|
|
{ \
|
|
void *CallerAddress = __builtin_extract_return_addr(__builtin_return_address(0)); \
|
|
error("Assertion failed! [%s] [%#lx => %s:%s:%d]", #x, CallerAddress, __FILE__, __FUNCTION__, __LINE__); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define static_assert(x) \
|
|
switch (x) \
|
|
case 0: \
|
|
case (x):
|
|
|
|
#endif // !__FENNIX_KERNEL_ASSERT_H__
|