This patch makes the internal `graph.h` require what it needs instead of
using the macros only if they exist. This makes it impossible to skip
logging or precondition/postcondition validation in this header.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I157809be7b56720b2f4a241c45491413f5b8366d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1577
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
#include "common/assert.h"
#include "lib/assert-pre.h"
#include "common/assert.h"
#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include <babeltrace2/graph/connection-const.h>
#include "lib/object.h"
#include "compat/compiler.h"
#include <babeltrace2/graph/connection-const.h>
#include "lib/object.h"
#include "compat/compiler.h"
#include "component-sink.h"
#include "connection.h"
#include "component-sink.h"
#include "connection.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
+
+/* Protection: this file uses BT_ASSERT_PRE*() macros directly */
+#ifndef BT_ASSERT_PRE_SUPPORTED
+# error Please include "lib/assert-pre.h" before including this file.
+#endif
+
+/* Protection: this file uses BT_ASSERT_POST*() macros directly */
+#ifndef BT_ASSERT_POST_SUPPORTED
+# error Please include "lib/assert-post.h" before including this file.
+#endif
+
struct bt_component;
struct bt_port;
struct bt_component;
struct bt_port;
BT_ASSERT_PRE(graph->has_sink, "Graph has no sink component: %!+g", graph);
BT_ASSERT_PRE(graph->has_sink, "Graph has no sink component: %!+g", graph);
graph->config_state = BT_GRAPH_CONFIGURATION_STATE_PARTIALLY_CONFIGURED;
for (i = 0; i < graph->components->len; i++) {
graph->config_state = BT_GRAPH_CONFIGURATION_STATE_PARTIALLY_CONFIGURED;
for (i = 0; i < graph->components->len; i++) {
if (comp_cls_sink->methods.graph_is_configured) {
enum bt_self_component_status comp_status;
if (comp_cls_sink->methods.graph_is_configured) {
enum bt_self_component_status comp_status;
BT_LIB_LOGD("Calling user's \"graph is configured\" method: "
"%![graph-]+g, %![comp-]+c",
graph, comp);
BT_LIB_LOGD("Calling user's \"graph is configured\" method: "
"%![graph-]+g, %![comp-]+c",
graph, comp);
comp_status = comp_cls_sink->methods.graph_is_configured(
(void *) comp_sink);
comp_status = comp_cls_sink->methods.graph_is_configured(
(void *) comp_sink);
BT_LIB_LOGD("User method returned: status=%s",
bt_self_component_status_string(comp_status));
BT_LIB_LOGD("User method returned: status=%s",
bt_self_component_status_string(comp_status));
-#endif
-
-#ifdef BT_ASSERT_POST
BT_ASSERT_POST(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
comp_status == BT_SELF_COMPONENT_STATUS_NOMEM,
"Unexpected returned status: status=%s",
bt_self_component_status_string(comp_status));
BT_ASSERT_POST(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
comp_status == BT_SELF_COMPONENT_STATUS_NOMEM,
"Unexpected returned status: status=%s",
bt_self_component_status_string(comp_status));
if (comp_status != BT_SELF_COMPONENT_STATUS_OK) {
status = BT_GRAPH_STATUS_ERROR;
if (comp_status != BT_SELF_COMPONENT_STATUS_OK) {
status = BT_GRAPH_STATUS_ERROR;
BT_LIB_LOGW("User's \"graph is configured\" method failed: "
"%![comp-]+c, status=%s",
comp,
bt_self_component_status_string(
comp_status));
BT_LIB_LOGW("User's \"graph is configured\" method failed: "
"%![comp-]+c, status=%s",
comp,
bt_self_component_status_string(
comp_status));
void bt_graph_make_faulty(struct bt_graph *graph)
{
graph->config_state = BT_GRAPH_CONFIGURATION_STATE_FAULTY;
void bt_graph_make_faulty(struct bt_graph *graph)
{
graph->config_state = BT_GRAPH_CONFIGURATION_STATE_FAULTY;
BT_LIB_LOGI("Set graph's state to faulty: %![graph-]+g", graph);
BT_LIB_LOGI("Set graph's state to faulty: %![graph-]+g", graph);
}
#endif /* BABELTRACE_GRAPH_GRAPH_INTERNAL_H */
}
#endif /* BABELTRACE_GRAPH_GRAPH_INTERNAL_H */
#include "common/assert.h"
#include "lib/assert-pre.h"
#include "common/assert.h"
#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include "compat/compiler.h"
#include "lib/object.h"
#include <babeltrace2/trace-ir/event.h>
#include "compat/compiler.h"
#include "lib/object.h"
#include <babeltrace2/trace-ir/event.h>
#include "common/assert.h"
#include "lib/assert-pre.h"
#include "common/assert.h"
#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include <babeltrace2/graph/message-const.h>
#include "lib/graph/message/message.h"
#include "lib/graph/graph.h"
#include <babeltrace2/graph/message-const.h>
#include "lib/graph/message/message.h"
#include "lib/graph/graph.h"
#define BT_LOG_TAG "LIB/MSG-PACKET"
#include "lib/logging.h"
#define BT_LOG_TAG "LIB/MSG-PACKET"
#include "lib/logging.h"
+#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include "compat/compiler.h"
#include <babeltrace2/trace-ir/packet.h>
#include "lib/trace-ir/packet.h"
#include "compat/compiler.h"
#include <babeltrace2/trace-ir/packet.h>
#include "lib/trace-ir/packet.h"
#include <babeltrace2/graph/message-packet-beginning.h>
#include <babeltrace2/graph/message-packet-end.h>
#include "common/assert.h"
#include <babeltrace2/graph/message-packet-beginning.h>
#include <babeltrace2/graph/message-packet-end.h>
#include "common/assert.h"
-#include "lib/assert-pre.h"
#include "lib/object.h"
#include <inttypes.h>
#include "lib/object.h"
#include <inttypes.h>
#include <wchar.h>
#include <glib.h>
#include "common/common.h"
#include <wchar.h>
#include <glib.h>
#include "common/common.h"
-#include "lib/value.h"
-#include "lib/value.h"
-#include "lib/object-pool.h"
#include <babeltrace2/trace-ir/event-const.h>
#include <babeltrace2/trace-ir/packet-const.h>
#include <babeltrace2/trace-ir/stream-const.h>
#include <babeltrace2/trace-ir/event-const.h>
#include <babeltrace2/trace-ir/packet-const.h>
#include <babeltrace2/trace-ir/stream-const.h>
+#include "logging.h"
+#include "assert-pre.h"
+#include "assert-post.h"
+#include "value.h"
+#include "object-pool.h"
#include "graph/component-class.h"
#include "graph/component-class-sink-colander.h"
#include "graph/component-filter.h"
#include "graph/component-class.h"
#include "graph/component-class-sink-colander.h"
#include "graph/component-filter.h"
#include "graph/message/stream-activity.h"
#include "graph/message/stream.h"
#include "graph/port.h"
#include "graph/message/stream-activity.h"
#include "graph/message/stream.h"
#include "graph/port.h"
#include "plugin/plugin.h"
#include "plugin/plugin-so.h"
#include "trace-ir/clock-class.h"
#include "plugin/plugin.h"
#include "plugin/plugin-so.h"
#include "trace-ir/clock-class.h"
#include "trace-ir/trace-class.h"
#include "trace-ir/trace.h"
#include "trace-ir/utils.h"
#include "trace-ir/trace-class.h"
#include "trace-ir/trace.h"
#include "trace-ir/utils.h"
#define LIB_LOGGING_BUF_SIZE (4096 * 4)
#define LIB_LOGGING_BUF_SIZE (4096 * 4)