X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fgraph%2Fmessage%2Fmessage.h;h=75515ef8f41ffc224033fde627bd59ffc44eb0a7;hb=bdb288b3e94e412a33c8647d44f6cfac66ca0665;hp=a1e529974594aeb14a9e4308c2c783602318acdb;hpb=185ecf645233ced089ad72b060a420e8f6f7edeb;p=babeltrace.git diff --git a/src/lib/graph/message/message.h b/src/lib/graph/message/message.h index a1e52997..75515ef8 100644 --- a/src/lib/graph/message/message.h +++ b/src/lib/graph/message/message.h @@ -55,11 +55,23 @@ struct bt_message { 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,