X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fassert-pre.h;h=39472a44cba9478967b9afdb0c03901b7b8ea426;hb=5084732e40a7925d22f741e4ed08f19d36078fbe;hp=17ee8a89ad74ac27c96d64155412a9c5e6972ad6;hpb=bdb288b3e94e412a33c8647d44f6cfac66ca0665;p=babeltrace.git diff --git a/src/lib/assert-pre.h b/src/lib/assert-pre.h index 17ee8a89..39472a44 100644 --- a/src/lib/assert-pre.h +++ b/src/lib/assert-pre.h @@ -52,7 +52,6 @@ * * Example: * - * BT_ASSERT_PRE_FUNC * static inline bool check_complex_precond(...) * { * ... @@ -104,7 +103,7 @@ * is not `NULL`. */ #define BT_ASSERT_PRE_NON_NULL(_obj, _obj_name) \ - BT_ASSERT_PRE((_obj) != NULL, "%s is NULL: ", _obj_name) + BT_ASSERT_PRE((_obj), "%s is NULL: ", _obj_name) /* * Asserts that a given index `_index` is less than a given length @@ -115,19 +114,14 @@ "Index is out of bounds: index=%" PRIu64 ", " \ "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length)) -/* - * Marks a function as being only used within a BT_ASSERT_PRE() context. - */ -#define BT_ASSERT_PRE_FUNC - #ifdef BT_DEV_MODE /* Developer mode version of BT_ASSERT_PRE_MSG(). */ -# define BT_ASSERT_PRE_DEV_MSG(_fmt, ...) \ - BT_ASSERT_PRE_MSG(_fmt, #__VA_ARGS__) +# define BT_ASSERT_PRE_DEV_MSG(_fmt, ...) \ + BT_ASSERT_PRE_MSG(_fmt, ##__VA_ARGS__) /* Developer mode version of BT_ASSERT_PRE(). */ # define BT_ASSERT_PRE_DEV(_cond, _fmt, ...) \ - BT_ASSERT_PRE((_cond), _fmt, #__VA_ARGS__) + BT_ASSERT_PRE((_cond), _fmt, ##__VA_ARGS__) /* Developer mode version of BT_ASSERT_PRE_NON_NULL() */ # define BT_ASSERT_PRE_DEV_NON_NULL(_obj, _obj_name) \ @@ -150,7 +144,10 @@ # define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length) \ BT_ASSERT_PRE_VALID_INDEX((_index), (_length)) -/* Developer mode version of `BT_ASSERT_PRE_FUNC`. */ +/* + * Marks a function as being only used within a BT_ASSERT_PRE_DEV() + * context. + */ # define BT_ASSERT_PRE_DEV_FUNC #else # define BT_ASSERT_PRE_DEV_MSG(_fmt, ...)