38 #ifndef included_error_bootstrap_h 39 #define included_error_bootstrap_h 56 #define clib_error_function ((char *) __FUNCTION__) 58 #ifndef CLIB_ASSERT_ENABLE 59 #define CLIB_ASSERT_ENABLE (CLIB_DEBUG > 0) 65 extern void _clib_error (
int code,
69 #define ASSERT(truth) \ 71 if (CLIB_ASSERT_ENABLE && ! (truth)) \ 73 _clib_error (CLIB_ERROR_ABORT, 0, 0, \ 74 "%s:%d (%s) assertion `%s' fails", \ 77 clib_error_function, \ 82 #if defined(__clang__) 83 #define STATIC_ASSERT(truth,...) 85 #define STATIC_ASSERT(truth,...) _Static_assert(truth, __VA_ARGS__) 88 #define STATIC_ASSERT_SIZEOF(d, s) \ 89 STATIC_ASSERT (sizeof (d) == s, "Size of " #d " must be " # s " bytes") 91 #define STATIC_ASSERT_OFFSET_OF(s, e, o) \ 92 STATIC_ASSERT (STRUCT_OFFSET_OF(s,e) == o, "Offset of " #s "." #e " must be " # o) 94 #define STATIC_ASSERT_FITS_IN(s, e, o) \ 95 STATIC_ASSERT (STRUCT_OFFSET_OF(s,e) <= (o - sizeof(((s *)0)->e)), \ 96 #s "." #e " does not fit into " # o " bytes") 99 #define ASSERT_AND_PANIC(truth) \ 101 if (CLIB_ASSERT_ENABLE && ! (truth)) \
unsigned char function_name[]