configure: re-enable '-Wunused-parameter'
[babeltrace.git] / src / lib / lib-logging.c
index e4d3ac20c448fd470cb5dce4c33bc1074359fc9e..95b1cebbd328f4f8b45023445e0a1f7ae446285d 100644 (file)
@@ -21,8 +21,7 @@
 #include <babeltrace2/babeltrace.h>
 
 #include "logging.h"
-#include "assert-pre.h"
-#include "assert-post.h"
+#include "assert-cond.h"
 #include "value.h"
 #include "integer-range-set.h"
 #include "object-pool.h"
@@ -58,7 +57,6 @@
 #include "trace-ir/trace.h"
 #include "trace-ir/utils.h"
 #include "error.h"
-#include "assert-pre.h"
 
 #define LIB_LOGGING_BUF_SIZE   (4096 * 4)
 
@@ -116,7 +114,7 @@ static inline void format_clock_snapshot(char **buf_ch, bool extended,
 static inline void format_field_path(char **buf_ch, bool extended,
                const char *prefix, const struct bt_field_path *field_path);
 
-static inline void format_object(char **buf_ch, bool extended,
+static inline void format_object(char **buf_ch, bool extended __attribute__((unused)),
                const char *prefix, const struct bt_object *obj)
 {
        BUF_APPEND(", %sref-count=%llu", prefix, obj->ref_count);
@@ -127,7 +125,7 @@ static inline void format_uuid(char **buf_ch, bt_uuid uuid)
        BUF_APPEND("\"" BT_UUID_FMT "\"", BT_UUID_FMT_VALUES(uuid));
 }
 
-static inline void format_object_pool(char **buf_ch, bool extended,
+static inline void format_object_pool(char **buf_ch, bool extended __attribute__((unused)),
                const char *prefix, const struct bt_object_pool *pool)
 {
        BUF_APPEND(", %ssize=%zu", PRFIELD(pool->size));
@@ -138,7 +136,7 @@ static inline void format_object_pool(char **buf_ch, bool extended,
 }
 
 static inline void format_integer_field_class(char **buf_ch,
-               bool extended, const char *prefix,
+               bool extended __attribute__((unused)), const char *prefix,
                const struct bt_field_class *field_class)
 {
        const struct bt_field_class_integer *int_fc =
@@ -150,7 +148,7 @@ static inline void format_integer_field_class(char **buf_ch,
 }
 
 static inline void format_array_field_class(char **buf_ch,
-               bool extended, const char *prefix,
+               bool extended __attribute__((unused)), const char *prefix,
                const struct bt_field_class *field_class)
 {
        const struct bt_field_class_array *array_fc =
@@ -845,7 +843,8 @@ static inline void format_clock_snapshot(char **buf_ch, bool extended,
        }
 }
 
-static inline void format_interrupter(char **buf_ch, bool extended,
+static inline void format_interrupter(char **buf_ch,
+               bool extended __attribute__((unused)),
                const char *prefix, const struct bt_interrupter *intr)
 {
        BUF_APPEND(", %sis-set=%d", PRFIELD(intr->is_set));
@@ -934,7 +933,7 @@ static inline void format_message(char **buf_ch, bool extended,
        char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %stype=%s",
-               PRFIELD(bt_message_type_string(msg->type)));
+               PRFIELD(bt_common_message_type_string(msg->type)));
 
        if (!extended) {
                return;
@@ -1059,7 +1058,7 @@ static inline void format_component_class(char **buf_ch, bool extended,
        char tmp_prefix[TMP_PREFIX_LEN];
 
        BUF_APPEND(", %stype=%s, %sname=\"%s\"",
-               PRFIELD(bt_component_class_type_string(comp_class->type)),
+               PRFIELD(bt_common_component_class_type_string(comp_class->type)),
                PRFIELD_GSTRING(comp_class->name));
 
        if (comp_class->description) {
@@ -1185,9 +1184,11 @@ static inline void format_graph(char **buf_ch, bool extended,
                &graph->packet_end_msg_pool);
 }
 
-static inline void format_message_iterator_class(char **buf_ch,
-               bool extended, const char *prefix,
-               const struct bt_message_iterator_class *iterator_class)
+static inline void format_message_iterator_class(
+               char **buf_ch __attribute__((unused)),
+               bool extended __attribute__((unused)),
+               const char *prefix __attribute__((unused)),
+               const struct bt_message_iterator_class *iterator_class __attribute__((unused)))
 {
        /* Empty, the address is automatically printed. */
 }
@@ -1337,15 +1338,17 @@ static inline void format_error_cause(char **buf_ch, bool extended,
        if (comp_class_id) {
                BUF_APPEND(", %scomp-cls-type=%s, %scomp-cls-name=\"%s\", "
                        "%splugin-name=\"%s\"",
-                       PRFIELD(bt_component_class_type_string(
+                       PRFIELD(bt_common_component_class_type_string(
                                comp_class_id->type)),
                        PRFIELD_GSTRING(comp_class_id->name),
                        PRFIELD_GSTRING(comp_class_id->plugin_name));
        }
 }
 
-static inline void handle_conversion_specifier_bt(void *priv_data,
-               char **buf_ch, size_t avail_size,
+static inline void handle_conversion_specifier_bt(
+               void *priv_data __attribute__((unused)),
+               char **buf_ch,
+               size_t avail_size __attribute__((unused)),
                const char **out_fmt_ch, va_list *args)
 {
        const char *fmt_ch = *out_fmt_ch;
@@ -1486,6 +1489,29 @@ update_fmt:
        *out_fmt_ch = fmt_ch;
 }
 
+/*
+ * This function would normally not be BT_EXPORTed, but it is used by the
+ * Python plugin provider, which is conceptually part of libbabeltrace2, but
+ * implemented as a separate shared object, for modularity.  It is therefore
+ * exposed, but not part of the public ABI.
+ */
+BT_EXPORT
+void bt_lib_log_v(const char *func, const char *file, unsigned line,
+               int lvl, const char *tag, const char *fmt, va_list *args)
+{
+       BT_ASSERT(fmt);
+       bt_common_custom_vsnprintf(lib_logging_buf, LIB_LOGGING_BUF_SIZE, '!',
+               handle_conversion_specifier_bt, NULL, fmt, args);
+       _bt_log_write_d(func, file, line, lvl, tag, "%s", lib_logging_buf);
+}
+
+/*
+ * This function would normally not be BT_EXPORTed, but it is used by the
+ * Python plugin provider, which is conceptually part of libbabeltrace2, but
+ * implemented as a separate shared object, for modularity.  It is therefore
+ * exposed, but not part of the public ABI.
+ */
+BT_EXPORT
 void bt_lib_log(const char *func, const char *file, unsigned line,
                int lvl, const char *tag, const char *fmt, ...)
 {
@@ -1493,12 +1519,17 @@ void bt_lib_log(const char *func, const char *file, unsigned line,
 
        BT_ASSERT(fmt);
        va_start(args, fmt);
-       bt_common_custom_vsnprintf(lib_logging_buf, LIB_LOGGING_BUF_SIZE, '!',
-               handle_conversion_specifier_bt, NULL, fmt, &args);
+       bt_lib_log_v(func, file, line, lvl, tag, fmt, &args);
        va_end(args);
-       _bt_log_write_d(func, file, line, lvl, tag, "%s", lib_logging_buf);
 }
 
+/*
+ * This function would normally not be BT_EXPORTed, but it is used by the
+ * Python plugin provider, which is conceptually part of libbabeltrace2, but
+ * implemented as a separate shared object, for modularity.  It is therefore
+ * exposed, but not part of the ABI.
+ */
+BT_EXPORT
 void bt_lib_maybe_log_and_append_cause(const char *func, const char *file,
                unsigned line, int lvl, const char *tag,
                const char *fmt, ...)
This page took 0.035171 seconds and 4 git commands to generate.