* SOFTWARE.
*/
+/* Protection: this file uses BT_LIB_LOG*() macros directly */
+#ifndef BT_LIB_LOG_SUPPORTED
+# error Please include "lib/logging.h" before including this file.
+#endif
+
#include "common/macros.h"
#include "lib/object.h"
#include "common/assert.h"
struct bt_graph *graph;
};
-#define BT_ASSERT_PRE_MSG_IS_TYPE(_msg, _type) \
- BT_ASSERT_PRE(((struct bt_message *) (_msg))->type == (_type), \
- "Message has the wrong type: expected-type=%s, " \
- "%![msg-]+n", bt_message_type_string(_type), \
- (_msg))
+#define _BT_ASSERT_PRE_MSG_IS_TYPE_COND(_msg, _type) \
+ (((struct bt_message *) (_msg))->type == (_type))
+
+#define _BT_ASSERT_PRE_MSG_IS_TYPE_FMT \
+ "Message has the wrong type: expected-type=%s, %![msg-]+n"
+
+#define BT_ASSERT_PRE_MSG_IS_TYPE(_msg, _type) \
+ BT_ASSERT_PRE( \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_COND((_msg), (_type)), \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_FMT, \
+ bt_message_type_string(_type), (_msg))
+
+#define BT_ASSERT_PRE_DEV_MSG_IS_TYPE(_msg, _type) \
+ BT_ASSERT_PRE_DEV( \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_COND((_msg), (_type)), \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_FMT, \
+ bt_message_type_string(_type), (_msg))
BT_HIDDEN
void bt_message_init(struct bt_message *message,
struct bt_message *msg = bt_object_pool_create_object(pool);
if (G_UNLIKELY(!msg)) {
- BT_LIB_LOGE("Cannot allocate one message from message pool: "
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Cannot allocate one message from message pool: "
"%![pool-]+o, %![graph-]+g", pool, graph);
goto error;
}
return "BT_MESSAGE_TYPE_PACKET_BEGINNING";
case BT_MESSAGE_TYPE_PACKET_END:
return "BT_MESSAGE_TYPE_PACKET_END";
- case BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING:
- return "BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING";
- case BT_MESSAGE_TYPE_STREAM_ACTIVITY_END:
- return "BT_MESSAGE_TYPE_STREAM_ACTIVITY_END";
case BT_MESSAGE_TYPE_DISCARDED_EVENTS:
return "BT_MESSAGE_TYPE_DISCARDED_EVENTS";
default: