12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- #ifndef _HV_VOS_ASSERT_H
- #define _HV_VOS_ASSERT_H
- #include "hv_vos_Types.h"
- VOS_EXTERN_C_BEGIN
- #define HV_MSG_NOT_IMPL "not implemented"
- #define HV_MSG_NOT_READY "not ready"
- #define HV_MSG_INV_ARG "invalid argument"
- #define HV_MSG_OUT_OF_MEMORY "out of memory"
- #define HV_MSG_OUT_OF_BOUNDS "out of bounds"
- void Hv_Vos_Assert_Report(const char *condition, int line,
- const char *function, const char *message);
- #define HV_ASSERT(cond) HV_ASSERT_IMPL((cond), __LINE__, __FUNCTION__, NULL)
- #define HV_ASSERT_RESULT(result) HV_ASSERT(result >= 0)
- #define HV_ASSERT_IMPL(cond, line, function, msg) \
- do { \
- if (!(cond)) { \
- Hv_Vos_Assert_Report(#cond, line, function, msg); \
- } \
- } while (0)
- #define HV_ASSERT_CHK_ARG(cond) \
- HV_ASSERT_IMPL((cond), __LINE__, __FUNCTION__, HV_MSG_INV_ARG)
- #define HV_ASSERT_NOT_IMPL() \
- HV_ASSERT_IMPL(0, __LINE__, __FUNCTION__, HV_MSG_NOT_IMPL)
- #define HV_ASSERT_OUT_OF_MEMORY() \
- HV_ASSERT_IMPL(0, __LINE__, __FUNCTION__, HV_MSG_OUT_OF_MEMORY)
- VOS_EXTERN_C_END
- #endif
|