lib: merge `assert-pre.h` and `assert-post.h` into `assert-cond.h`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 15 Apr 2020 20:47:18 +0000 (16:47 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 23 Apr 2020 03:45:20 +0000 (23:45 -0400)
Merge both files into a single one to make it possible to reuse code.

Specific `BT_ASSERT_PRE*` and `BT_ASSERT_POST*` macros which were
identical are merged into a single one with the `BT_ASSERT_COND*` prefix
now.

No functional changes intended.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I019bcc73d5c644012238775c16b6498d07931a9a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3428

55 files changed:
src/lib/Makefile.am
src/lib/assert-cond.h [new file with mode: 0644]
src/lib/assert-post.h [deleted file]
src/lib/assert-pre.h [deleted file]
src/lib/current-thread.c
src/lib/error.c
src/lib/graph/component-class-sink-simple.c
src/lib/graph/component-class.c
src/lib/graph/component-descriptor-set.c
src/lib/graph/component-filter.c
src/lib/graph/component-sink.c
src/lib/graph/component-source.c
src/lib/graph/component.c
src/lib/graph/connection.c
src/lib/graph/graph.c
src/lib/graph/graph.h
src/lib/graph/interrupter.c
src/lib/graph/iterator.c
src/lib/graph/message-iterator-class.c
src/lib/graph/message/discarded-items.c
src/lib/graph/message/event.c
src/lib/graph/message/message-iterator-inactivity.c
src/lib/graph/message/message.c
src/lib/graph/message/packet.c
src/lib/graph/message/stream.c
src/lib/graph/mip.c
src/lib/graph/port.c
src/lib/graph/query-executor.c
src/lib/integer-range-set.c
src/lib/lib-logging.c
src/lib/object-pool.c
src/lib/plugin/plugin-so.c
src/lib/plugin/plugin.c
src/lib/trace-ir/attributes.c
src/lib/trace-ir/clock-class.c
src/lib/trace-ir/clock-snapshot.c
src/lib/trace-ir/event-class.c
src/lib/trace-ir/event-class.h
src/lib/trace-ir/event.c
src/lib/trace-ir/event.h
src/lib/trace-ir/field-class.c
src/lib/trace-ir/field-class.h
src/lib/trace-ir/field-path.c
src/lib/trace-ir/field.c
src/lib/trace-ir/field.h
src/lib/trace-ir/packet.c
src/lib/trace-ir/resolve-field-path.c
src/lib/trace-ir/stream-class.c
src/lib/trace-ir/stream.c
src/lib/trace-ir/trace-class.c
src/lib/trace-ir/trace-class.h
src/lib/trace-ir/trace.c
src/lib/trace-ir/trace.h
src/lib/util.c
src/lib/value.c

index 3c43a68407ecdca667882fdade8a112b95c29e42..ce6ba4a4f664ec5d3279fc5511265192a8af61c3 100644 (file)
@@ -5,8 +5,7 @@ SUBDIRS = trace-ir prio-heap plugin graph
 lib_LTLIBRARIES = libbabeltrace2.la
 
 libbabeltrace2_la_SOURCES = \
-       assert-post.h \
-       assert-pre.h \
+       assert-cond.h \
        babeltrace2.c \
        current-thread.c \
        error.c \
diff --git a/src/lib/assert-cond.h b/src/lib/assert-cond.h
new file mode 100644 (file)
index 0000000..6fe6bed
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright (c) 2018 EfficiOS Inc. and Linux Foundation
+ * Copyright (c) 2018-2020 Philippe Proulx <pproulx@efficios.com>
+ */
+
+#ifndef BABELTRACE_ASSERT_COND_INTERNAL_H
+#define BABELTRACE_ASSERT_COND_INTERNAL_H
+
+/*
+ * The macros in this header use macros defined in "lib/logging.h". We
+ * don't want this header to automatically include "lib/logging.h"
+ * because you need to manually define BT_LOG_TAG before including
+ * "lib/logging.h" and it is unexpected that you also need to define it
+ * before including this header.
+ *
+ * This is a reminder that in order to use "lib/assert-cond.h", you also
+ * need to use logging explicitly.
+ */
+
+#ifndef BT_LIB_LOG_SUPPORTED
+# error Include "lib/logging.h" before this header.
+#endif
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <inttypes.h>
+#include "common/common.h"
+#include "common/macros.h"
+
+/*
+ * Prints the details of an unsatisfied precondition or postcondition
+ * without immediately aborting. You should use this within a function
+ * which checks preconditions or postconditions, but which is called
+ * from a BT_ASSERT_PRE() or BT_ASSERT_POST() context, so that the
+ * function can still return its result for
+ * BT_ASSERT_PRE()/BT_ASSERT_POST() to evaluate it.
+ *
+ * Example:
+ *
+ *     static inline bool check_complex_precond(...)
+ *     {
+ *         ...
+ *
+ *         if (...) {
+ *             BT_ASSERT_COND_MSG("Invalid object: ...", ...);
+ *             return false;
+ *         }
+ *
+ *         ...
+ *     }
+ *
+ *     ...
+ *
+ *     BT_ASSERT_PRE(check_complex_precond(...),
+ *                   "Precondition is not satisfied: ...", ...);
+ */
+#define BT_ASSERT_COND_MSG(_fmt, ...)                                  \
+       do {                                                            \
+               bt_lib_log(_BT_LOG_SRCLOC_FUNCTION, __FILE__,           \
+                       __LINE__, BT_LOG_FATAL, BT_LOG_TAG,             \
+                       (_fmt), ##__VA_ARGS__);                         \
+       } while (0)
+
+/*
+ * Internal to this file: asserts that the library condition `_cond` of
+ * type `_cond_type` (`pre` or `post`) is satisfied.
+ *
+ * If `_cond` is false, this macro logs a fatal message using `_fmt` and
+ * the optional arguments (same usage as BT_LIB_LOGF()), and abort.
+ *
+ * To assert that an internal precondition or postcondition is
+ * satisfied, use BT_ASSERT() or BT_ASSERT_DBG().
+ */
+#define _BT_ASSERT_COND(_cond_type, _cond, _fmt, ...)                  \
+       do {                                                            \
+               if (!(_cond)) {                                         \
+                       BT_ASSERT_COND_MSG("Babeltrace 2 library " _cond_type "condition not satisfied. Error is:"); \
+                       BT_ASSERT_COND_MSG(_fmt, ##__VA_ARGS__);        \
+                       BT_ASSERT_COND_MSG("Aborting...");              \
+                       bt_common_abort();                              \
+               }                                                       \
+       } while (0)
+
+/*
+ * Asserts that the library precondition `_cond` is satisfied.
+ *
+ * If `_cond` is false, log a fatal message 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 precondition or postcondition is
+ * satisfied, use BT_ASSERT() or BT_ASSERT_DBG().
+ */
+#define BT_ASSERT_PRE(_cond, _fmt, ...)                                        \
+       _BT_ASSERT_COND("pre", _cond, _fmt, ##__VA_ARGS__)
+
+/*
+ * Asserts that the library postcondition `_cond` is satisfied.
+ *
+ * If `_cond` is false, log a fatal message using `_fmt` and the
+ * optional arguments (same usage as BT_LIB_LOGF()), and abort.
+ *
+ * To assert that a library precondition is satisfied (return from user
+ * code), use BT_ASSERT_PRE().
+ *
+ * To assert that an internal precondition or postcondition is
+ * satisfied, use BT_ASSERT() or BT_ASSERT_DBG().
+ */
+#define BT_ASSERT_POST(_cond, _fmt, ...)                                       \
+       _BT_ASSERT_COND("post", _cond, _fmt, ##__VA_ARGS__)
+
+/*
+ * Asserts that a given variable `_obj` named `_obj_name` (capitalized)
+ * is not `NULL`.
+ */
+#define BT_ASSERT_PRE_NON_NULL(_obj, _obj_name)                                \
+       BT_ASSERT_PRE((_obj), "%s is NULL: ", _obj_name)
+
+/*
+ * Asserts that a given index `_index` is less than a given length
+ * `_length`.
+ */
+#define BT_ASSERT_PRE_VALID_INDEX(_index, _length)                     \
+       BT_ASSERT_PRE((_index) < (_length),                             \
+               "Index is out of bounds: index=%" PRIu64 ", "           \
+               "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length))
+
+/*
+ * Asserts that the current thread has no error set.
+ */
+#define BT_ASSERT_PRE_NO_ERROR() \
+       do {                                                                    \
+               const struct bt_error *err = bt_current_thread_take_error();    \
+               if (err) {                                                      \
+                       bt_current_thread_move_error(err);                      \
+               }                                                               \
+               BT_ASSERT_PRE(!err,                                             \
+                       "API function called while current thread has an "      \
+                       "error: function=%s", __func__);                        \
+       } while (0)
+
+/*
+ * Asserts that, if the current thread has an error, `_status` is an
+ * error status code.
+ *
+ * Puts back the error in place (if there is one) such that if this
+ * macro aborts, it will be possible to inspect it with a debugger.
+ */
+#define BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(_status)                    \
+       do {                                                                    \
+               const struct bt_error *err = bt_current_thread_take_error();    \
+               if (err) {                                                      \
+                       bt_current_thread_move_error(err);                      \
+               }                                                               \
+               BT_ASSERT_POST(_status < 0 || !err,                             \
+                       "Current thread has an error, but user function "       \
+                       "returned a non-error status: status=%s",               \
+                       bt_common_func_status_string(_status));                 \
+       } while (0)
+
+/*
+ * Asserts that the current thread has no error.
+ */
+#define BT_ASSERT_POST_NO_ERROR() \
+       BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(0)
+
+#ifdef BT_DEV_MODE
+/* Developer mode version of BT_ASSERT_PRE(). */
+# define BT_ASSERT_PRE_DEV(_cond, _fmt, ...)                           \
+       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)                   \
+       BT_ASSERT_PRE_NON_NULL((_obj), (_obj_name))
+
+/*
+ * Developer mode: asserts that a given object `_obj` named `_obj_name`
+ * (capitalized) is NOT frozen. This macro checks the `frozen` field of
+ * `_obj`.
+ *
+ * This currently only exists in developer mode because some freezing
+ * functions can be called on the fast path, so they too are only
+ * enabled in developer mode.
+ */
+# define BT_ASSERT_PRE_DEV_HOT(_obj, _obj_name, _fmt, ...)             \
+       BT_ASSERT_PRE(!(_obj)->frozen, "%s is frozen" _fmt, _obj_name,  \
+               ##__VA_ARGS__)
+
+/* Developer mode version of BT_ASSERT_PRE_VALID_INDEX() */
+# define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length)                        \
+       BT_ASSERT_PRE_VALID_INDEX((_index), (_length))
+
+/* Developer mode version of BT_ASSERT_PRE_NO_ERROR(). */
+# define BT_ASSERT_PRE_DEV_NO_ERROR() \
+       BT_ASSERT_PRE_NO_ERROR()
+
+/* Developer mode version of BT_ASSERT_POST(). */
+# define BT_ASSERT_POST_DEV(_cond, _fmt, ...)                          \
+       BT_ASSERT_POST((_cond), _fmt, ##__VA_ARGS__)
+
+/*
+ * Developer mode version of
+ * BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS().
+ */
+# define BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(_status) \
+       BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(_status)
+
+/* Developer mode version of BT_ASSERT_POST_NO_ERROR(). */
+# define BT_ASSERT_POST_DEV_NO_ERROR() \
+       BT_ASSERT_POST_NO_ERROR()
+
+/* Developer mode version of BT_ASSERT_COND_MSG(). */
+# define BT_ASSERT_COND_DEV_MSG(_fmt, ...)                             \
+       BT_ASSERT_COND_MSG(_fmt, ##__VA_ARGS__)
+
+/*
+ * Marks a function as being only used within a BT_ASSERT_PRE_DEV() or
+ * BT_ASSERT_POST_DEV() context.
+ */
+# define BT_ASSERT_COND_DEV_FUNC
+#else
+# define BT_ASSERT_COND_DEV_MSG(_fmt, ...)
+# define BT_ASSERT_PRE_DEV(_cond, _fmt, ...)   ((void) sizeof((void) (_cond), 0))
+# define BT_ASSERT_PRE_DEV_NON_NULL(_obj, _obj_name)                   \
+       ((void) sizeof((void) (_obj), (void) (_obj_name), 0))
+# define BT_ASSERT_PRE_DEV_HOT(_obj, _obj_name, _fmt, ...)             \
+       ((void) sizeof((void) (_obj), (void) (_obj_name), 0))
+# define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length)                        \
+       ((void) sizeof((void) (_index), (void) (_length), 0))
+# define BT_ASSERT_PRE_DEV_NO_ERROR()
+# define BT_ASSERT_POST_DEV(_cond, _fmt, ...)  ((void) sizeof((void) (_cond), 0))
+# define BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(_status) \
+       ((void) sizeof((void) (_status), 0))
+# define BT_ASSERT_POST_DEV_NO_ERROR()
+# define BT_ASSERT_COND_DEV_FUNC       __attribute__((unused))
+#endif /* BT_DEV_MODE */
+
+/*
+ * Mark anything that includes this file as supporting precondition and
+ * postcondition assertion macros.
+ */
+#define BT_ASSERT_COND_SUPPORTED
+
+#endif /* BABELTRACE_ASSERT_COND_INTERNAL_H */
diff --git a/src/lib/assert-post.h b/src/lib/assert-post.h
deleted file mode 100644 (file)
index 5a63f09..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright (c) 2019 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
- */
-
-#ifndef BABELTRACE_ASSERT_POST_INTERNAL_H
-#define BABELTRACE_ASSERT_POST_INTERNAL_H
-
-/*
- * The macros in this header use macros defined in "lib/logging.h".
- * We don't want this header to automatically include
- * "lib/logging.h" because you need to manually define BT_LOG_TAG
- * before including "lib/logging.h" and it is unexpected that you
- * also need to define it before including this header.
- *
- * This is a reminder that in order to use "lib/assert-post.h", you also
- * need to use logging explicitly.
- */
-
-#ifndef BT_LIB_LOG_SUPPORTED
-# error Include "lib/logging.h" before this header.
-#endif
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include "common/macros.h"
-#include "common/common.h"
-
-/*
- * Prints the details of an unsatisfied postcondition without
- * immediately aborting. You should use this within a function which
- * checks postconditions, but which is called from a
- * BT_ASSERT_POST() context, so that the function can still return
- * its result for BT_ASSERT_POST() to evaluate it.
- *
- * Example:
- *
- *     BT_ASSERT_POST_FUNC
- *     static inline bool check_complex_postcond(...)
- *     {
- *         ...
- *
- *         if (...) {
- *             BT_ASSERT_POST_MSG("Unexpected status: ...", ...);
- *             return false;
- *         }
- *
- *         ...
- *     }
- *
- *     ...
- *
- *     BT_ASSERT_POST(check_complex_postcond(...),
- *                         "Postcondition is not satisfied: ...", ...);
- */
-#define BT_ASSERT_POST_MSG(_fmt, ...)                                  \
-       do {                                                            \
-               bt_lib_log(_BT_LOG_SRCLOC_FUNCTION, __FILE__,           \
-                       __LINE__, BT_LOG_FATAL, BT_LOG_TAG,             \
-                       (_fmt), ##__VA_ARGS__);                         \
-       } while (0)
-
-/*
- * Asserts that the library postcondition `_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 precondition is satisfied (parameters from
- * the user), use BT_ASSERT_PRE().
- *
- * To assert that an internal postcondition is satisfied, use
- * BT_ASSERT() or BT_ASSERT_DBG().
- */
-#define BT_ASSERT_POST(_cond, _fmt, ...)                               \
-       do {                                                            \
-               if (!(_cond)) {                                         \
-                       BT_ASSERT_POST_MSG("Babeltrace 2 library postcondition not satisfied; error is:"); \
-                       BT_ASSERT_POST_MSG(_fmt, ##__VA_ARGS__);        \
-                       BT_ASSERT_POST_MSG("Aborting...");              \
-                       bt_common_abort();                                      \
-               }                                                       \
-       } while (0)
-
-/*
- * Asserts that if there's an error on the current thread, an error status code
- * was returned.  Puts back the error in place (if there is one) such that if
- * the assertion hits, it will be possible to inspect it with a debugger.
- */
-#define BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(_status)                    \
-       do {                                                                    \
-               const struct bt_error *err = bt_current_thread_take_error();    \
-               if (err) {                                                      \
-                       bt_current_thread_move_error(err);                      \
-               }                                                               \
-               BT_ASSERT_POST(_status < 0 || !err,                             \
-                       "Current thread has an error, but user function "       \
-                       "returned a non-error status: status=%s",               \
-                       bt_common_func_status_string(_status));                 \
-       } while (0)
-
-/*
- * Asserts that the current thread has no error.
- */
-#define BT_ASSERT_POST_NO_ERROR() \
-       BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(0)
-
-/*
- * Marks a function as being only used within a BT_ASSERT_POST()
- * context.
- */
-#define BT_ASSERT_POST_FUNC
-
-#ifdef BT_DEV_MODE
-/* Developer mode version of BT_ASSERT_POST_MSG(). */
-# define BT_ASSERT_POST_DEV_MSG(_fmt, ...)                             \
-       BT_ASSERT_POST_MSG(_fmt, ##__VA_ARGS__)
-
-/* Developer mode version of BT_ASSERT_POST(). */
-# define BT_ASSERT_POST_DEV(_cond, _fmt, ...)                          \
-       BT_ASSERT_POST((_cond), _fmt, ##__VA_ARGS__)
-
-/* Developer mode version of BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(). */
-# define BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(_status) \
-       BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(_status)
-
-/* Developer mode version of `BT_ASSERT_POST_FUNC`. */
-# define BT_ASSERT_POST_DEV_FUNC BT_ASSERT_POST_FUNC
-#else
-# define BT_ASSERT_POST_DEV_MSG(_fmt, ...)
-# define BT_ASSERT_POST_DEV(_cond, _fmt, ...)  ((void) sizeof((void) (_cond), 0))
-# define BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(_status) \
-       ((void) sizeof((void) (_status), 0))
-# define BT_ASSERT_POST_DEV_FUNC       __attribute__((unused))
-#endif /* BT_DEV_MODE */
-
-#define BT_ASSERT_POST_SUPPORTED
-
-#endif /* BABELTRACE_ASSERT_POST_INTERNAL_H */
diff --git a/src/lib/assert-pre.h b/src/lib/assert-pre.h
deleted file mode 100644 (file)
index d361d35..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * Copyright (c) 2018 EfficiOS Inc. and Linux Foundation
- * Copyright (c) 2018 Philippe Proulx <pproulx@efficios.com>
- */
-
-#ifndef BABELTRACE_ASSERT_PRE_INTERNAL_H
-#define BABELTRACE_ASSERT_PRE_INTERNAL_H
-
-/*
- * The macros in this header use macros defined in "lib/logging.h".
- * We don't want this header to automatically include
- * "lib/logging.h" because you need to manually define BT_LOG_TAG
- * before including "lib/logging.h" and it is unexpected that you
- * also need to define it before including this header.
- *
- * This is a reminder that in order to use "lib/assert-pre.h", you also
- * need to use logging explicitly.
- */
-
-#ifndef BT_LIB_LOG_SUPPORTED
-# error Include "lib/logging.h" before this header.
-#endif
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include "common/common.h"
-#include "common/macros.h"
-
-/*
- * Prints the details of an unsatisfied precondition without immediately
- * aborting. You should use this within a function which checks
- * preconditions, but which is called from a BT_ASSERT_PRE() context, so
- * that the function can still return its result for BT_ASSERT_PRE() to
- * evaluate it.
- *
- * Example:
- *
- *     static inline bool check_complex_precond(...)
- *     {
- *         ...
- *
- *         if (...) {
- *             BT_ASSERT_PRE_MSG("Invalid object: ...", ...);
- *             return false;
- *         }
- *
- *         ...
- *     }
- *
- *     ...
- *
- *     BT_ASSERT_PRE(check_complex_precond(...),
- *                   "Precondition is not satisfied: ...", ...);
- */
-#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)
-
-/*
- * 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() or BT_ASSERT_DBG().
- */
-#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...");               \
-                       bt_common_abort();                                      \
-               }                                                       \
-       } while (0)
-
-/*
- * Asserts that a given variable `_obj` named `_obj_name` (capitalized)
- * is not `NULL`.
- */
-#define BT_ASSERT_PRE_NON_NULL(_obj, _obj_name)                                \
-       BT_ASSERT_PRE((_obj), "%s is NULL: ", _obj_name)
-
-/*
- * Asserts that a given index `_index` is less than a given length
- * `_length`.
- */
-#define BT_ASSERT_PRE_VALID_INDEX(_index, _length)                     \
-       BT_ASSERT_PRE((_index) < (_length),                             \
-               "Index is out of bounds: index=%" PRIu64 ", "           \
-               "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length))
-
-/*
- * Asserts that the current thread has no error set.
- */
-#define BT_ASSERT_PRE_NO_ERROR() \
-       do {                                                                    \
-               const struct bt_error *err = bt_current_thread_take_error();    \
-               if (err) {                                                      \
-                       bt_current_thread_move_error(err);                      \
-               }                                                               \
-               BT_ASSERT_PRE(!err,                                             \
-                       "API function called while current thread has an "      \
-                       "error: function=%s", __func__);                        \
-       } while (0)
-
-#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__)
-
-/* Developer mode version of BT_ASSERT_PRE(). */
-# define BT_ASSERT_PRE_DEV(_cond, _fmt, ...)                           \
-       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)                   \
-       BT_ASSERT_PRE_NON_NULL((_obj), (_obj_name))
-
-/*
- * Developer mode: asserts that a given object `_obj` named `_obj_name`
- * (capitalized) is NOT frozen. This macro checks the `frozen` field of
- * `_obj`.
- *
- * This currently only exists in developer mode because some freezing
- * functions can be called on the fast path, so they too are only
- * enabled in developer mode.
- */
-# define BT_ASSERT_PRE_DEV_HOT(_obj, _obj_name, _fmt, ...)             \
-       BT_ASSERT_PRE(!(_obj)->frozen, "%s is frozen" _fmt, _obj_name,  \
-               ##__VA_ARGS__)
-
-/* Developer mode version of BT_ASSERT_PRE_VALID_INDEX() */
-# define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length)                        \
-       BT_ASSERT_PRE_VALID_INDEX((_index), (_length))
-
-/* Developer mode version of BT_ASSERT_PRE_NO_ERROR(). */
-# define BT_ASSERT_PRE_DEV_NO_ERROR() \
-       BT_ASSERT_PRE_NO_ERROR()
-
-/*
- * 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, ...)
-# define BT_ASSERT_PRE_DEV(_cond, _fmt, ...)   ((void) sizeof((void) (_cond), 0))
-# define BT_ASSERT_PRE_DEV_NON_NULL(_obj, _obj_name)                   \
-       ((void) sizeof((void) (_obj), (void) (_obj_name), 0))
-# define BT_ASSERT_PRE_DEV_HOT(_obj, _obj_name, _fmt, ...)             \
-       ((void) sizeof((void) (_obj), (void) (_obj_name), 0))
-# define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length)                        \
-       ((void) sizeof((void) (_index), (void) (_length), 0))
-# define BT_ASSERT_PRE_DEV_NO_ERROR()
-# define BT_ASSERT_PRE_DEV_FUNC                __attribute__((unused))
-#endif /* BT_DEV_MODE */
-
-#define BT_ASSERT_PRE_SUPPORTED
-
-#endif /* BABELTRACE_ASSERT_PRE_INTERNAL_H */
index fed1a2132abdf9cd9fb0a33719f68c39137daeec..457ca6f19871f6c50704cd01793155ea536036c8 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "error.h"
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/func-status.h"
 
 /*
index 21e92c4cac0c0358ba6bf7297c166649f5014be7..1429af06acf0a065334a58663f6616fed2d4f620 100644 (file)
@@ -16,7 +16,7 @@
 #include "graph/component.h"
 #include "graph/component-class.h"
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/func-status.h"
 
 #define BT_ASSERT_PRE_CAUSE_HAS_ACTOR_TYPE(_cause, _exp_type)          \
index bf55a69cde984bdaed95add69e5d4d445b594a64..69b40c1dee5e28477e6e5b554ecabaf7b3e28038 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "common/assert.h"
 #include "common/common.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/object.h"
 #include <babeltrace2/graph/component-class.h>
 #include <babeltrace2/graph/self-component-port.h>
index 6415c39ffbc10eedb9eb116cfb3cb54dc0998476..79de19fb07854fd160b76b5af35b4d540cfd0465 100644 (file)
@@ -9,7 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include <babeltrace2/graph/component-class.h>
 #include <babeltrace2/types.h>
index 631157d363fa6dab6dd041b1b55b08f0b3630d8a..23ed60ce143dba5d3de63cec25c9e4651a7e747f 100644 (file)
@@ -9,7 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include "common/common.h"
 #include <babeltrace2/types.h>
index 3541514fbac87009dba6c22ef98847f1b8c1369f..24be22772c3b6b0000768ea676692903335258ff 100644 (file)
@@ -9,7 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/graph/self-component.h>
index 1f4a5a66589533e65d83c10d5849788f31058f37..d89b7283b13da459892080df29b7c8fc871bccde 100644 (file)
@@ -9,8 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/graph/self-component.h>
index 879af72474e0fa1a91371c46e1cd82b23f9f21e4..9e2211e16279e6c70ef0a084e88bb493ba32cf3d 100644 (file)
@@ -9,7 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include <babeltrace2/graph/self-component.h>
 #include <babeltrace2/graph/component.h>
index d42dba7fc1ae8f6363f24a1743ade06102cdf792..7660425c91c9d38b76f5ba8ee5fd4328b8816d05 100644 (file)
@@ -10,8 +10,7 @@
 
 #include "common/common.h"
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/graph/self-component.h>
 #include <babeltrace2/graph/component.h>
 #include <babeltrace2/graph/graph.h>
index af480f255400bd855659b839f7a4fd0d1a35a9d4..c470994ee4c963fc57b136065355fecfd42a2b8e 100644 (file)
@@ -9,8 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/graph/connection.h>
 #include "lib/object.h"
 #include "compat/compiler.h"
index 11c7c29d17fd5a231861f6ea284c74d2fd94cabf..4645e0f5acfc1541ac8fdb909ec7463cfbbd2a1d 100644 (file)
@@ -9,8 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/graph/graph.h>
 #include <babeltrace2/graph/component.h>
 #include <babeltrace2/graph/port.h>
@@ -865,7 +864,7 @@ bool component_name_exists(struct bt_graph *graph, const char *name)
                struct bt_component *other_comp = graph->components->pdata[i];
 
                if (strcmp(name, bt_component_get_name(other_comp)) == 0) {
-                       BT_ASSERT_PRE_MSG("Another component with the same name already exists in the graph: "
+                       BT_ASSERT_COND_MSG("Another component with the same name already exists in the graph: "
                                "%![other-comp-]+c, name=\"%s\"",
                                other_comp, name);
                        exists = true;
index 61c2e29ef40910146c173b7b8abb29189a4752df..66654939417029f9a010c7181ce780dcde369004 100644 (file)
 # error Please include "lib/logging.h" before including this file.
 #endif
 
-/* Protection: this file uses BT_ASSERT_PRE*() macros directly */
-#ifndef BT_ASSERT_PRE_SUPPORTED
-# error Please include "lib/assert-pre.h" before including this file.
-#endif
-
-/* Protection: this file uses BT_ASSERT_POST*() macros directly */
-#ifndef BT_ASSERT_POST_SUPPORTED
-# error Please include "lib/assert-post.h" before including this file.
+/*
+ * Protection: this file uses precondition and postcondition assertion
+ * macros directly.
+ */
+#ifndef BT_ASSERT_COND_SUPPORTED
+# error Please include "lib/assert-cond.h" before including this file.
 #endif
 
 struct bt_component;
index 6e38226421f3e2a16d8689674b0cc01324108afb..a7e2c0d18b19dcb57acfc750ded5dae6774ff241 100644 (file)
@@ -12,7 +12,7 @@
 #include <babeltrace2/babeltrace.h>
 
 #include "interrupter.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 
 static
 void destroy_interrupter(struct bt_object *obj)
index fad7967a68d092d89bd2cf0f8b8bf3b2f4982db0..d8478553bb98c6d32005b5f38224461141564888 100644 (file)
@@ -30,8 +30,7 @@
 #include <babeltrace2/graph/message-iterator.h>
 #include <babeltrace2/types.h>
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <stdint.h>
 #include <inttypes.h>
 #include <stdbool.h>
@@ -510,7 +509,7 @@ void bt_self_message_iterator_configuration_set_can_seek_forward(
  * time.
  */
 
-BT_ASSERT_POST_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static
 bool clock_snapshots_are_monotonic_one(
                struct bt_message_iterator *iterator,
@@ -592,7 +591,7 @@ end:
        return result;
 }
 
-BT_ASSERT_POST_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static
 bool clock_snapshots_are_monotonic(
                struct bt_message_iterator *iterator,
@@ -619,7 +618,7 @@ end:
  * stream is compatible with what we've seen before.
  */
 
-BT_ASSERT_POST_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static
 bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
                const struct bt_message *msg)
@@ -659,7 +658,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
 
                case CLOCK_EXPECTATION_NONE:
                        if (clock_class) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting no clock class, got one: %![cc-]+K",
                                        clock_class);
                                result = false;
@@ -670,14 +669,14 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
 
                case CLOCK_EXPECTATION_ORIGIN_UNIX:
                        if (!clock_class) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class, got none.");
                                result = false;
                                goto end;
                        }
 
                        if (!bt_clock_class_origin_is_unix_epoch(clock_class)) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class with Unix epoch origin: %![cc-]+K",
                                        clock_class);
                                result = false;
@@ -687,14 +686,14 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
 
                case CLOCK_EXPECTATION_ORIGIN_OTHER_UUID:
                        if (!clock_class) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class, got none.");
                                result = false;
                                goto end;
                        }
 
                        if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class without Unix epoch origin: %![cc-]+K",
                                        clock_class);
                                result = false;
@@ -702,7 +701,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
                        }
 
                        if (!clock_class_uuid) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class with UUID: %![cc-]+K",
                                        clock_class);
                                result = false;
@@ -710,7 +709,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
                        }
 
                        if (bt_uuid_compare(iterator->clock_expectation.uuid, clock_class_uuid)) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class with UUID, got one "
                                        "with a different UUID: %![cc-]+K, expected-uuid=%!u",
                                        clock_class, iterator->clock_expectation.uuid);
@@ -721,14 +720,14 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
 
                case CLOCK_EXPECTATION_ORIGIN_OTHER_NO_UUID:
                        if (!clock_class) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class, got none.");
                                result = false;
                                goto end;
                        }
 
                        if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class without Unix epoch origin: %![cc-]+K",
                                        clock_class);
                                result = false;
@@ -736,7 +735,7 @@ bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
                        }
 
                        if (clock_class_uuid) {
-                               BT_ASSERT_POST_DEV_MSG(
+                               BT_ASSERT_COND_DEV_MSG(
                                        "Expecting a clock class without UUID: %![cc-]+K",
                                        clock_class);
                                result = false;
@@ -752,7 +751,7 @@ end:
        return result;
 }
 
-BT_ASSERT_POST_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static
 bool clock_classes_are_compatible(
                struct bt_message_iterator *iterator,
index c059862b9897d63c9a4541bed536a7ba2def8916..6ef9e72ae81612d08ed6a33c26ec92ba54a8c06c 100644 (file)
 #include "message-iterator-class.h"
 
 #include "compat/compiler.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/func-status.h"
 
-#define BT_ASSERT_PRE_DEV_MSG_ITER_CLS_HOT(_msg_iter_cls) \
+#define BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(_msg_iter_cls) \
        BT_ASSERT_PRE_DEV_HOT((_msg_iter_cls), \
                "Message iterator class", ": %!+I", (_msg_iter_cls))
 
@@ -84,7 +84,7 @@ bt_message_iterator_class_set_initialize_method(
        BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
-       BT_ASSERT_PRE_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
+       BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
        message_iterator_class->methods.initialize = method;
        BT_LIB_LOGD("Set message iterator class's iterator initialization method"
                ": %!+I", message_iterator_class);
@@ -99,7 +99,7 @@ bt_message_iterator_class_set_finalize_method(
        BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
-       BT_ASSERT_PRE_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
+       BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
        message_iterator_class->methods.finalize = method;
        BT_LIB_LOGD("Set message iterator class's finalization method"
                ": %!+I", message_iterator_class);
@@ -115,7 +115,7 @@ bt_message_iterator_class_set_seek_ns_from_origin_methods(
        BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class");
        BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method");
-       BT_ASSERT_PRE_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
+       BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
        message_iterator_class->methods.seek_ns_from_origin = seek_method;
        message_iterator_class->methods.can_seek_ns_from_origin = can_seek_method;
        BT_LIB_LOGD("Set message iterator class's \"seek nanoseconds from origin\" method"
@@ -132,7 +132,7 @@ bt_message_iterator_class_set_seek_beginning_methods(
        BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(message_iterator_class, "Message iterator class");
        BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method");
-       BT_ASSERT_PRE_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
+       BT_ASSERT_COND_DEV_MSG_ITER_CLS_HOT(message_iterator_class);
        message_iterator_class->methods.seek_beginning = seek_method;
        message_iterator_class->methods.can_seek_beginning = can_seek_method;
        BT_LIB_LOGD("Set message iterator class's \"seek beginning\" methods"
index 10c02160d7d590201af318ad2269fd2fc3d13fc6..b0b517279264d1972ad112cfc3dfa23f72cd54d8 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdbool.h>
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/object.h"
 #include "compat/compiler.h"
 #include <babeltrace2/trace-ir/clock-class.h>
index 302d4b5a8e9748aa65de0e52500a114dbdb084ce..e194fce0b1822b7c35140a46607707f4665169d8 100644 (file)
@@ -9,8 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include "lib/object.h"
 #include <babeltrace2/trace-ir/event.h>
index 9303c650256ddf756693c73a5cbe8d6221602798..6ead8bd59397e635fec6aa2b3defc1abb165f3eb 100644 (file)
@@ -7,7 +7,7 @@
 #define BT_LOG_TAG "LIB/MSG-MSG-ITER-INACTIVITY"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/object.h"
 #include "compat/compiler.h"
 #include <babeltrace2/trace-ir/clock-class.h>
index 0f1c807a5c14f6a0ef3b4e5fb0ca33b1e32a9abb..734281bd0396a7a638bc440c79570413fd9d2549 100644 (file)
@@ -9,8 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/graph/message.h>
 #include "lib/graph/message/message.h"
 #include "lib/graph/graph.h"
index 9afbb9f15681f271c6f9298217c2319a7e295f8b..84dd8c4c29e609a4faeeb7088fbe1cef0da59f5d 100644 (file)
@@ -10,8 +10,7 @@
 
 #include <stdbool.h>
 
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include <babeltrace2/trace-ir/packet.h>
 #include "lib/trace-ir/packet.h"
index afbabfea75c89b99be1540238e97fd03d991bacc..b4b045cf602368ee2ed46d44a2b54530c4e394e1 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/MSG-STREAM"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include <babeltrace2/trace-ir/clock-snapshot.h>
 #include "lib/trace-ir/stream.h"
index 7c2bb698be25224297339275f8bfc9528b0c5ec0..d32e8054d1f70b47d943aa82918d052ad932f79f 100644 (file)
@@ -7,8 +7,7 @@
 #define BT_LOG_TAG "LIB/MIP"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <stdbool.h>
 #include <unistd.h>
 #include <glib.h>
index 65e57196a17548651db771a73a38cb46ca18780b..52ebc7f851b5c3de39ce8452ef6b886499363ebb 100644 (file)
@@ -9,7 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/graph/port.h>
 #include <babeltrace2/graph/self-component-port.h>
 #include "lib/object.h"
index 78ba1f2caecf75d7824913926af2e6f811945cfd..e375979b530b3890589807899753d36adb5e5d1f 100644 (file)
@@ -9,8 +9,7 @@
 
 #include "common/assert.h"
 #include "common/common.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/graph/query-executor.h>
 #include <babeltrace2/graph/component-class.h>
 #include <babeltrace2/graph/query-executor.h>
index 9a5e817deb82d6706894a71ae7eece3522c59c60..8853d702be9f9064e8f54e74827c3e9f28a2a201 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <babeltrace2/babeltrace.h>
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/assert.h"
 #include "func-status.h"
 #include "integer-range-set.h"
index e4d3ac20c448fd470cb5dce4c33bc1074359fc9e..1730f6d09c93588f43f2388da579b0b820daa2e6 100644 (file)
@@ -21,8 +21,7 @@
 #include <babeltrace2/babeltrace.h>
 
 #include "logging.h"
-#include "assert-pre.h"
-#include "assert-post.h"
+#include "assert-cond.h"
 #include "value.h"
 #include "integer-range-set.h"
 #include "object-pool.h"
@@ -58,7 +57,6 @@
 #include "trace-ir/trace.h"
 #include "trace-ir/utils.h"
 #include "error.h"
-#include "assert-pre.h"
 
 #define LIB_LOGGING_BUF_SIZE   (4096 * 4)
 
index c354d9a53c337ec952ba29f1b3e7531223aa0783..3b48dee9dd71c1749376c33ae88a9b93bebae5e6 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <stdint.h>
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/object-pool.h"
 
 int bt_object_pool_initialize(struct bt_object_pool *pool,
index 6025bdec19ae829ab2922301467d4518fa1d35b9..02428c2ad072173e2fb2a59fa0ba353a4b1441a2 100644 (file)
@@ -9,7 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "compat/compiler.h"
 #include <babeltrace2/plugin/plugin-dev.h>
 #include "lib/graph/component-class.h"
index f9800af7fec233f730c72bd567ff53742cb5b13d..af8dc0924f177e1da3c79268c30f2c00e735ee2c 100644 (file)
@@ -9,7 +9,7 @@
 #include "lib/logging.h"
 
 #include "common/assert.h"
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/macros.h"
 #include "compat/compiler.h"
 #include "common/common.h"
index 924c71c43b3b1f92fd0794519f64af512434b7c1..68f54b8627bf54da58cf008c62ee99b532c869cf 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "common/macros.h"
 #include <babeltrace2/value.h>
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "lib/object.h"
 #include <babeltrace2/value.h>
 #include "lib/value.h"
index b9a66c02b0de4f109abe2fb0dbbfde8f29ee78d5..8d1002474ed00c232dcf63521e0cd500d1b380ae 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/CLOCK-CLASS"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/uuid.h"
 #include <babeltrace2/trace-ir/clock-class.h>
 #include "clock-class.h"
index 9f8d85ae95f26542d8b3a8d77ec99e2c1215108e..65d152f92c7f6e57089cfe2ce5216f1d4e9cf5e2 100644 (file)
@@ -7,7 +7,7 @@
 #define BT_LOG_TAG "LIB/CLOCK-SNAPSHOT"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/uuid.h"
 #include "clock-class.h"
 #include "clock-snapshot.h"
index 67e4f3a5c97df4ddbcbe524fd95271b4e372bb26..49c78fde4d06bcb16e750b01546d1043cae81f0d 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/EVENT-CLASS"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/event-class.h>
 #include <babeltrace2/trace-ir/stream-class.h>
index 61ff918e53a9f7fac041a63e489757ceafbc1347..00b2e23c1816b97a6c21a6ba0b3cc365d84d6521 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BABELTRACE_TRACE_IR_EVENT_CLASS_INTERNAL_H
 #define BABELTRACE_TRACE_IR_EVENT_CLASS_INTERNAL_H
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field.h>
 #include "common/macros.h"
index cb6b6adacdae2175e0594d9b32de714fdf54c53d..b973798a819343eaa98c54bd801a551f4e2b76ad 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/EVENT"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/event.h>
 #include <babeltrace2/trace-ir/event-class.h>
 #include <babeltrace2/trace-ir/stream-class.h>
index b783c1112bc25347b116f77ecb8393dce4678d1e..2899f271d93cc9652d119088db8f90ce2da1a0a6 100644 (file)
@@ -13,7 +13,7 @@
 # error Please include "lib/logging.h" before including this file.
 #endif
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/macros.h"
 #include <babeltrace2/value.h>
 #include <babeltrace2/trace-ir/stream-class.h>
index 00a7cd3ca8afc749ecef899b714433d5cbc467d6..97c8523c6972eaafb65ef4a61a62a918b47646c9 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/FIELD-CLASS"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field.h>
 #include <babeltrace2/trace-ir/clock-class.h>
index af9254f29de5e3d7af2c2869a7745691dd18665c..1cd14e39aa247d1c023b4fa75d0863bc85be224d 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BABELTRACE_TRACE_IR_FIELD_CLASSES_INTERNAL_H
 #define BABELTRACE_TRACE_IR_FIELD_CLASSES_INTERNAL_H
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/clock-class.h>
 #include <babeltrace2/trace-ir/field-class.h>
 #include "common/macros.h"
index 781aefcf15a397fcf83a899a8d6b0d31eee91da1..e1a76019d01a0e2efcf35f27feaf7accd89ebcea 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/FIELD-PATH"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field-path.h>
 #include <limits.h>
index 922b9abb8d4fac71329d2dd78e026874c891e262..37e6731ecd4b35d31bde09beb073118bb7683472 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/FIELD"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/field.h>
 #include "lib/object.h"
 #include "compat/compiler.h"
index c94ae318d917c7938eec2607228e6f45122c05de..7262f827b576254c329cc5a66e07a7a586cf41dc 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BABELTRACE_TRACE_IR_FIELDS_INTERNAL_H
 #define BABELTRACE_TRACE_IR_FIELDS_INTERNAL_H
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/common.h"
 #include "lib/object.h"
 #include "common/macros.h"
index 1c9268e8fdd2e4cff773867da761764f823cf16c..2b33bb80bf9562f61c39cdaaa4d9a1933ac7c9fc 100644 (file)
@@ -7,7 +7,7 @@
 #define BT_LOG_TAG "LIB/PACKET"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/packet.h>
 #include <babeltrace2/trace-ir/trace.h>
 #include <babeltrace2/trace-ir/stream-class.h>
index 25a5fb687561901dc747ff6c174fa9de712ebd59..ac8aed7e7153c72d330fbdee1084de0836b867f4 100644 (file)
@@ -7,7 +7,7 @@
 #define BT_LOG_TAG "LIB/RESOLVE-FIELD-PATH"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include "common/assert.h"
 #include <babeltrace2/trace-ir/field-path.h>
 #include <limits.h>
@@ -155,7 +155,7 @@ end:
        return field_path;
 }
 
-BT_ASSERT_PRE_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static inline
 bool target_is_before_source(struct bt_field_path *src_field_path,
                struct bt_field_path *tgt_field_path)
@@ -199,7 +199,7 @@ end:
        return is_valid;
 }
 
-BT_ASSERT_PRE_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static inline
 struct bt_field_class *borrow_root_field_class(
                struct bt_resolve_field_path_context *ctx, enum bt_field_path_scope scope)
@@ -220,7 +220,7 @@ struct bt_field_class *borrow_root_field_class(
        return NULL;
 }
 
-BT_ASSERT_PRE_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static inline
 struct bt_field_class *borrow_child_field_class(
                struct bt_field_class *parent_fc,
@@ -257,7 +257,7 @@ struct bt_field_class *borrow_child_field_class(
        return child_fc;
 }
 
-BT_ASSERT_PRE_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static inline
 bool target_field_path_in_different_scope_has_struct_fc_only(
                struct bt_field_path *src_field_path,
@@ -297,7 +297,7 @@ end:
        return is_valid;
 }
 
-BT_ASSERT_PRE_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static inline
 bool lca_is_structure_field_class(struct bt_field_path *src_field_path,
                struct bt_field_path *tgt_field_path,
@@ -353,7 +353,7 @@ end:
        return is_valid;
 }
 
-BT_ASSERT_PRE_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static inline
 bool lca_to_target_has_struct_fc_only(struct bt_field_path *src_field_path,
                struct bt_field_path *tgt_field_path,
@@ -416,7 +416,7 @@ end:
        return is_valid;
 }
 
-BT_ASSERT_PRE_DEV_FUNC
+BT_ASSERT_COND_DEV_FUNC
 static inline
 bool field_path_is_valid(struct bt_field_class *src_fc,
                struct bt_field_class *tgt_fc,
@@ -429,14 +429,14 @@ bool field_path_is_valid(struct bt_field_class *src_fc,
                tgt_fc, ctx);
 
        if (!src_field_path) {
-               BT_ASSERT_PRE_DEV_MSG("Cannot find requesting field class in "
+               BT_ASSERT_COND_DEV_MSG("Cannot find requesting field class in "
                        "resolving context: %!+F", src_fc);
                is_valid = false;
                goto end;
        }
 
        if (!tgt_field_path) {
-               BT_ASSERT_PRE_DEV_MSG("Cannot find target field class in "
+               BT_ASSERT_COND_DEV_MSG("Cannot find target field class in "
                        "resolving context: %!+F", tgt_fc);
                is_valid = false;
                goto end;
@@ -444,7 +444,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc,
 
        /* Target must be before source */
        if (!target_is_before_source(src_field_path, tgt_field_path)) {
-               BT_ASSERT_PRE_DEV_MSG("Target field class is located after "
+               BT_ASSERT_COND_DEV_MSG("Target field class is located after "
                        "requesting field class: %![req-fc-]+F, %![tgt-fc-]+F",
                        src_fc, tgt_fc);
                is_valid = false;
@@ -457,7 +457,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc,
         */
        if (!target_field_path_in_different_scope_has_struct_fc_only(
                        src_field_path, tgt_field_path, ctx)) {
-               BT_ASSERT_PRE_DEV_MSG("Target field class is located in a "
+               BT_ASSERT_COND_DEV_MSG("Target field class is located in a "
                        "different scope than requesting field class, "
                        "but within an array or a variant field class: "
                        "%![req-fc-]+F, %![tgt-fc-]+F",
@@ -468,7 +468,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc,
 
        /* Same scope: LCA must be a structure field class */
        if (!lca_is_structure_field_class(src_field_path, tgt_field_path, ctx)) {
-               BT_ASSERT_PRE_DEV_MSG("Lowest common ancestor of target and "
+               BT_ASSERT_COND_DEV_MSG("Lowest common ancestor of target and "
                        "requesting field classes is not a structure field class: "
                        "%![req-fc-]+F, %![tgt-fc-]+F",
                        src_fc, tgt_fc);
@@ -479,7 +479,7 @@ bool field_path_is_valid(struct bt_field_class *src_fc,
        /* Same scope: path from LCA to target has no array/variant FTs */
        if (!lca_to_target_has_struct_fc_only(src_field_path, tgt_field_path,
                        ctx)) {
-               BT_ASSERT_PRE_DEV_MSG("Path from lowest common ancestor of target "
+               BT_ASSERT_COND_DEV_MSG("Path from lowest common ancestor of target "
                        "and requesting field classes to target field class "
                        "contains an array or a variant field class: "
                        "%![req-fc-]+F, %![tgt-fc-]+F", src_fc, tgt_fc);
index e6c2c8f6177cad16e0a1872d4b5cfa3b8d540f0c..f32d7bc29e19e72cac1a60fe6c878b8f8c7cfa6a 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/STREAM-CLASS"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/trace.h>
 #include "compat/compiler.h"
 #include "common/align.h"
index daabe96f22785318b9aa8396fd116a092325820f..07bdcc892f0f8d9c66404e9a1b69a65f24ef48ef 100644 (file)
@@ -8,7 +8,7 @@
 #define BT_LOG_TAG "LIB/STREAM"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/stream.h>
 #include <babeltrace2/trace-ir/stream-class.h>
 #include <babeltrace2/trace-ir/trace.h>
index 90ae4de74f7ca6dd2416785b131dc56165ac0058..025698d2a0940490f27783440cd18f600abb113e 100644 (file)
@@ -8,8 +8,7 @@
 #define BT_LOG_TAG "LIB/TRACE-CLASS"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/trace-class.h>
 #include <babeltrace2/trace-ir/event-class.h>
 #include "ctf-writer/functor.h"
index 27a81b7672844d6b289036c979a7ef0e21623d67..0a09dfbe285cbff397491f3fcc426ccf9d982d6a 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BABELTRACE_TRACE_IR_TRACE_CLASS_INTERNAL_H
 #define BABELTRACE_TRACE_IR_TRACE_CLASS_INTERNAL_H
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/trace-class.h>
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field.h>
index 30e1f2419e79d66b1ad216aa28d816d8469f2a43..1be8992b55b45611f0cdcaac56d9c103faf10ca6 100644 (file)
@@ -8,8 +8,7 @@
 #define BT_LOG_TAG "LIB/TRACE"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/trace.h>
 #include <babeltrace2/trace-ir/event-class.h>
 #include "ctf-writer/functor.h"
index 81bcbd7fa36e3824a29dd595bd8b6e4be760a084..c62087787000f984a80103ef17d466d457ec8898 100644 (file)
@@ -8,7 +8,7 @@
 #ifndef BABELTRACE_TRACE_IR_TRACE_INTERNAL_H
 #define BABELTRACE_TRACE_IR_TRACE_INTERNAL_H
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <babeltrace2/trace-ir/trace.h>
 #include <babeltrace2/trace-ir/field-class.h>
 #include <babeltrace2/trace-ir/field.h>
index e52a956c94b7b99cf646b913127f0e7fa7d824f5..d5cc0a0ea9510c87736f361e96e387c9686bb097 100644 (file)
@@ -7,7 +7,7 @@
 #define BT_LOG_TAG "LIB/UTIL"
 #include "lib/logging.h"
 
-#include "lib/assert-pre.h"
+#include "lib/assert-cond.h"
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
index 3d73636e3bac657980bbb50127d2735a54b33354..f533aba35d6710139a8b5e80d7dc235d91f60683 100644 (file)
@@ -16,8 +16,7 @@
 #include "compat/compiler.h"
 #include "common/common.h"
 #include "compat/glib.h"
-#include "lib/assert-pre.h"
-#include "lib/assert-post.h"
+#include "lib/assert-cond.h"
 #include "lib/value.h"
 #include "common/assert.h"
 #include "func-status.h"
This page took 0.05525 seconds and 4 git commands to generate.