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, \ 89 #define ALWAYS_ASSERT(truth) \ 91 if (PREDICT_FALSE(!(truth))) \ 93 _clib_error (CLIB_ERROR_ABORT, 0, 0, \ 94 "%s:%d (%s) assertion `%s' fails", \ 97 clib_error_function, \ 102 #define ALWAYS_ASSERT(truth) \ 104 if (PREDICT_FALSE(!(truth))) \ 111 #define STATIC_ASSERT(truth,...) _Static_assert(truth, __VA_ARGS__) 113 #define STATIC_ASSERT_SIZEOF(d, s) \ 114 STATIC_ASSERT (sizeof (d) == s, "Size of " #d " must be " # s " bytes") 116 #define STATIC_ASSERT_SIZEOF_ELT(d, e, s) \ 117 STATIC_ASSERT (sizeof (((d *)0)->e) == s, "Size of " #d "." #e " must be " # s " bytes") 119 #define STATIC_ASSERT_OFFSET_OF(s, e, o) \ 120 STATIC_ASSERT (STRUCT_OFFSET_OF(s,e) == o, "Offset of " #s "." #e " must be " # o) 122 #define STATIC_ASSERT_FITS_IN(s, e, o) \ 123 STATIC_ASSERT (STRUCT_OFFSET_OF(s,e) <= (o - sizeof(((s *)0)->e)), \ 124 #s "." #e " does not fit into " # o " bytes") 127 #define ASSERT_AND_PANIC(truth) \ 129 if (CLIB_ASSERT_ENABLE && ! (truth)) \
description fragment has unexpected format
unsigned char function_name[]