blob: 9a9646678fe4a89c5b5780f8043a25347a6c2f16 [file] [log] [blame]
/*
* assert.h
*/
#ifndef _ASSERT_H
#define _ASSERT_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef NDEBUG
/*
* NDEBUG doesn't just suppress the faulting behavior of assert(),
* but also all side effects of the assert() argument. This behavior
* is required by the C standard, and allows the argument to reference
* variables that are not defined without NDEBUG.
*/
#define assert(x) ((void)(0))
#else
#include <stddef.h>
#include "os/os_fault.h"
#define assert(x) ((x) ? (void)0 : OS_CRASH())
#endif
#if !defined __cplusplus
#define static_assert _Static_assert
#endif
#ifdef __cplusplus
}
#endif
#endif /* _ASSERT_H */