lib: internal: message.h: require logging
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 28 Jun 2019 21:03:27 +0000 (17:03 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 29 Jun 2019 06:04:08 +0000 (02:04 -0400)
This patch makes the internal `message.h` require what it needs instead
of using the macros only if they exist. This makes it impossible to skip
logging in this header.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I2dd300931479a1d0752b6f90079c826324e19ce1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1581
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/lib/graph/message/message.h

index 98d27b9301c4988458156756ed35202ff56d346b..88924995b3c7f6d3e16d5251efdef932cf4bb391 100644 (file)
 #include "lib/object-pool.h"
 #include <babeltrace2/types.h>
 
+/* 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
+
 typedef struct bt_stream *(*get_stream_func)(
                struct bt_message *message);
 
@@ -74,10 +79,8 @@ struct bt_message *bt_message_create_from_pool(
        struct bt_message *msg = bt_object_pool_create_object(pool);
 
        if (G_UNLIKELY(!msg)) {
-#ifdef BT_LIB_LOGE
                BT_LIB_LOGE("Cannot allocate one message from message pool: "
                        "%![pool-]+o, %![graph-]+g", pool, graph);
-#endif
                goto error;
        }
 
This page took 0.026659 seconds and 4 git commands to generate.