lib: remove unused includes
[babeltrace.git] / src / lib / current-thread.c
index 457ca6f19871f6c50704cd01793155ea536036c8..5547a146b5e4b156b422b0767f954c1678db35f7 100644 (file)
 #include <stdarg.h>
 
 #include "error.h"
-#include "common/assert.h"
 #include "lib/assert-cond.h"
 #include "lib/func-status.h"
 
+#define BT_ASSERT_PRE_FILE_NAME_NON_NULL(_file_name)                   \
+       BT_ASSERT_PRE_NON_NULL("file-name", (_file_name), "File name");
+
+#define BT_ASSERT_PRE_MSG_FMT_NON_NULL(_msg_fmt)                       \
+       BT_ASSERT_PRE_NON_NULL("message-format", (_msg_fmt), "Message format");
+
 /*
  * This points to the thread's error object, or it's `NULL` if there's
  * no current error object.
  */
 static __thread struct bt_error *thread_error;
 
+BT_EXPORT
 const struct bt_error *bt_current_thread_take_error(void)
 {
        struct bt_error *error = thread_error;
@@ -32,6 +38,7 @@ const struct bt_error *bt_current_thread_take_error(void)
        return error;
 }
 
+BT_EXPORT
 void bt_current_thread_clear_error(void)
 {
        bt_error_destroy(thread_error);
@@ -40,9 +47,10 @@ void bt_current_thread_clear_error(void)
        thread_error = NULL;
 }
 
+BT_EXPORT
 void bt_current_thread_move_error(const struct bt_error *error)
 {
-       BT_ASSERT_PRE_NON_NULL(error, "Error");
+       BT_ASSERT_PRE_ERROR_NON_NULL(error);
        bt_current_thread_clear_error();
        thread_error = (void *) error;
        BT_LOGD("Moved error object as current thread's error: addr=%p",
@@ -76,6 +84,7 @@ end:
        return status;
 }
 
+BT_EXPORT
 enum bt_current_thread_error_append_cause_status
 bt_current_thread_error_append_cause_from_unknown(
                const char *module_name, const char *file_name,
@@ -85,9 +94,9 @@ bt_current_thread_error_append_cause_from_unknown(
                try_create_thread_error();
        va_list args;
 
-       BT_ASSERT_PRE_NON_NULL(module_name, "Module name");
-       BT_ASSERT_PRE_NON_NULL(file_name, "File name");
-       BT_ASSERT_PRE_NON_NULL(msg_fmt, "Message format string");
+       BT_ASSERT_PRE_NON_NULL("module-name", module_name, "Module name");
+       BT_ASSERT_PRE_FILE_NAME_NON_NULL(file_name);
+       BT_ASSERT_PRE_MSG_FMT_NON_NULL(msg_fmt);
 
        if (status) {
                goto end;
@@ -104,6 +113,7 @@ end:
        return status;
 }
 
+BT_EXPORT
 enum bt_current_thread_error_append_cause_status
 bt_current_thread_error_append_cause_from_component(
                bt_self_component *self_comp, const char *file_name,
@@ -113,9 +123,9 @@ bt_current_thread_error_append_cause_from_component(
                try_create_thread_error();
        va_list args;
 
-       BT_ASSERT_PRE_NON_NULL(self_comp, "Component");
-       BT_ASSERT_PRE_NON_NULL(file_name, "File name");
-       BT_ASSERT_PRE_NON_NULL(msg_fmt, "Message format string");
+       BT_ASSERT_PRE_COMP_NON_NULL(self_comp);
+       BT_ASSERT_PRE_FILE_NAME_NON_NULL(file_name);
+       BT_ASSERT_PRE_MSG_FMT_NON_NULL(msg_fmt);
 
        if (status) {
                goto end;
@@ -132,6 +142,7 @@ end:
        return status;
 }
 
+BT_EXPORT
 enum bt_current_thread_error_append_cause_status
 bt_current_thread_error_append_cause_from_component_class(
                bt_self_component_class *self_comp_class, const char *file_name,
@@ -141,9 +152,9 @@ bt_current_thread_error_append_cause_from_component_class(
                try_create_thread_error();
        va_list args;
 
-       BT_ASSERT_PRE_NON_NULL(self_comp_class, "Component class");
-       BT_ASSERT_PRE_NON_NULL(file_name, "File name");
-       BT_ASSERT_PRE_NON_NULL(msg_fmt, "Message format string");
+       BT_ASSERT_PRE_COMP_CLS_NON_NULL(self_comp_class);
+       BT_ASSERT_PRE_FILE_NAME_NON_NULL(file_name);
+       BT_ASSERT_PRE_MSG_FMT_NON_NULL(msg_fmt);
 
        if (status) {
                goto end;
@@ -160,6 +171,7 @@ end:
        return status;
 }
 
+BT_EXPORT
 enum bt_current_thread_error_append_cause_status
 bt_current_thread_error_append_cause_from_message_iterator(
                bt_self_message_iterator *self_iter, const char *file_name,
@@ -169,9 +181,9 @@ bt_current_thread_error_append_cause_from_message_iterator(
                try_create_thread_error();
        va_list args;
 
-       BT_ASSERT_PRE_NON_NULL(self_iter, "Message iterator");
-       BT_ASSERT_PRE_NON_NULL(file_name, "File name");
-       BT_ASSERT_PRE_NON_NULL(msg_fmt, "Message format string");
+       BT_ASSERT_PRE_MSG_ITER_NON_NULL(self_iter);
+       BT_ASSERT_PRE_FILE_NAME_NON_NULL(file_name);
+       BT_ASSERT_PRE_MSG_FMT_NON_NULL(msg_fmt);
 
        if (status) {
                goto end;
This page took 0.033397 seconds and 4 git commands to generate.