2 * SPDX-License-Identifier: MIT
4 * Copyright (c) 2018-2019 EfficiOS Inc. and Linux Foundation
5 * Copyright (c) 2018-2019 Philippe Proulx <pproulx@efficios.com>
8 #ifndef BABELTRACE_ASSERT_INTERNAL_H
9 #define BABELTRACE_ASSERT_INTERNAL_H
14 #include "common/macros.h"
21 extern void bt_common_assert_failed(const char *file
, int line
,
22 const char *func
, const char *assertion
)
23 __attribute__((noreturn
));
26 * Internal assertion (to detect logic errors on which the library user
27 * has no influence). Use BT_ASSERT_PRE*() or BT_ASSERT_POST*() to check
28 * preconditions or postconditions which must be directly or indirectly
29 * satisfied by the library user.
31 * BT_ASSERT() is enabled in both debug and non-debug modes.
33 #define BT_ASSERT(_cond) \
36 bt_common_assert_failed(__FILE__, __LINE__, __func__, \
37 G_STRINGIFY(_cond)); \
42 * Marks a function as being only used within a BT_ASSERT() context.
44 #define BT_ASSERT_FUNC
49 * Debug mode internal assertion.
51 #define BT_ASSERT_DBG(_cond) BT_ASSERT(_cond)
54 * Marks a function as being only used within a BT_ASSERT_DBG() context.
56 #define BT_ASSERT_DBG_FUNC
58 #else /* BT_DEBUG_MODE */
59 # define BT_ASSERT_DBG(_cond) BT_USE_EXPR(_cond)
60 # define BT_ASSERT_DBG_FUNC __attribute__((unused))
61 #endif /* BT_DEBUG_MODE */
67 #endif /* BABELTRACE_ASSERT_INTERNAL_H */
This page took 0.033138 seconds and 4 git commands to generate.