Always evaluate BT_ASSERT(); add BT_ASSERT_DBG() for debug mode only
[babeltrace.git] / src / lib / assert-pre.h
index 942851f21fb7b2684fdc7f5b3942447d1ae0fda2..700341c6f79dcfb7bfc213e77d6ad447b84db439 100644 (file)
@@ -52,7 +52,6 @@
  *
  * Example:
  *
- *     BT_ASSERT_PRE_FUNC
  *     static inline bool check_complex_precond(...)
  *     {
  *         ...
@@ -87,7 +86,7 @@
  * code), use BT_ASSERT_POST().
  *
  * To assert that an internal postcondition is satisfied, use
- * BT_ASSERT().
+ * BT_ASSERT() or BT_ASSERT_DBG().
  */
 #define BT_ASSERT_PRE(_cond, _fmt, ...)                                \
        do {                                                            \
  * 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
                "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, ...)                              \
 # 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, ...)
This page took 0.023952 seconds and 4 git commands to generate.