From c0d2ddc2202a0213e4f7a3fb084a81bd189e9faa Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 28 Jun 2019 16:55:38 -0400 Subject: [PATCH] lib: internal: clock-snapshot-set.h: require logging This patch makes the internal `clock-snapshot-set.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 Change-Id: Ib8b3def2869ab214a3d38e3a1cea7b9954fc056c Reviewed-on: https://review.lttng.org/c/babeltrace/+/1578 Tested-by: jenkins Reviewed-by: Simon Marchi --- src/lib/trace-ir/clock-snapshot-set.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/lib/trace-ir/clock-snapshot-set.h b/src/lib/trace-ir/clock-snapshot-set.h index 0ad92809..855744b2 100644 --- a/src/lib/trace-ir/clock-snapshot-set.h +++ b/src/lib/trace-ir/clock-snapshot-set.h @@ -30,6 +30,11 @@ #include "clock-snapshot.h" #include "clock-class.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 + struct bt_clock_snapshot_set { /* Unique objects owned by this */ GPtrArray *clock_snapshots; @@ -45,10 +50,7 @@ int bt_clock_snapshot_set_initialize(struct bt_clock_snapshot_set *cs_set) cs_set->clock_snapshots = g_ptr_array_sized_new(1); if (!cs_set->clock_snapshots) { -#ifdef BT_LOGE_STR BT_LOGE_STR("Failed to allocate one GPtrArray."); -#endif - ret = -1; goto end; } @@ -130,11 +132,8 @@ int bt_clock_snapshot_set_set_clock_snapshot(struct bt_clock_snapshot_set *cs_se if (!clock_snapshot) { clock_snapshot = bt_clock_snapshot_create(cc); if (!clock_snapshot) { -#ifdef BT_LIB_LOGE BT_LIB_LOGE("Cannot create a clock snapshot from a clock class: " "%![cc-]+K", cc); -#endif - ret = -1; goto end; } -- 2.34.1