// Copyright Microsoft and CHERIoT Contributors. | |
// SPDX-License-Identifier: MIT | |
#ifndef _ASSERT_H_ | |
#define _ASSERT_H_ | |
#ifdef NDEBUG | |
# define assert(x) ((void)0) | |
#else | |
// XXX extract needed bits from <stdlib.h> | |
#include <cdefs.h> | |
static inline void __dead2 panic() | |
{ | |
// Invalid instruction is guaranteed to trap. | |
while (1) | |
{ | |
__asm volatile("unimp"); | |
} | |
} | |
# define assert(x) ((x) ? (void)0 : panic()) | |
#endif | |
#ifndef static_assert | |
#define static_assert _Static_assert | |
#endif | |
#endif // _ASSERT_H_ |