+# define BT_ASSERT_PRE_MSG(_fmt, ...) \
+ do { \
+ bt_lib_log(_BT_LOG_SRCLOC_FUNCTION, __FILE__, \
+ __LINE__, BT_LOG_FATAL, BT_LOG_TAG, \
+ (_fmt), ##__VA_ARGS__); \
+ } while (0)
+
+/*
+ * Developer mode: asserts that the library precondition `_cond` is
+ * satisfied.
+ *
+ * If `_cond` is false, log a fatal statement using `_fmt` and the
+ * optional arguments (same usage as BT_LIB_LOGF()), and abort.
+ *
+ * To assert that a library postcondition is satisfied (return from user
+ * code), use BT_ASSERT_POST().
+ *
+ * To assert that an internal postcondition is satisfied, use
+ * BT_ASSERT().
+ */
+# define BT_ASSERT_PRE(_cond, _fmt, ...) \
+ do { \
+ if (!(_cond)) { \
+ BT_ASSERT_PRE_MSG("Babeltrace 2 library precondition not satisfied; error is:"); \
+ BT_ASSERT_PRE_MSG((_fmt), ##__VA_ARGS__); \
+ BT_ASSERT_PRE_MSG("Aborting..."); \
+ abort(); \
+ } \
+ } while (0)
+
+/*
+ * Marks a function as being only used within a BT_ASSERT_PRE() context.
+ */
+# define BT_ASSERT_PRE_FUNC