clang-tidy: add most bugprone warnings
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 14 Jan 2023 00:34:42 +0000 (19:34 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Jan 2023 03:40:21 +0000 (22:40 -0500)
Most of the changes proposed by clang-tidy are explicit checks for the
result of strcmp() and adding parentheses for all macro parameters.

Change-Id: I6ce7384b6d96035454d5456ac920becbf2882e65
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
65 files changed:
.clang-tidy
doc/examples/rotation/rotate-client-example.c
src/bin/lttng-crash/lttng-crash.cpp
src/bin/lttng-relayd/live.cpp
src/bin/lttng-relayd/main.cpp
src/bin/lttng-sessiond/channel.cpp
src/bin/lttng-sessiond/cmd.cpp
src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp
src/bin/lttng-sessiond/event.cpp
src/bin/lttng-sessiond/main.cpp
src/bin/lttng-sessiond/notification-thread-events.cpp
src/bin/lttng-sessiond/timer.cpp
src/bin/lttng-sessiond/trace-kernel.cpp
src/bin/lttng-sessiond/trace-ust.cpp
src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp
src/bin/lttng-sessiond/ust-app.cpp
src/bin/lttng-sessiond/ust-field-convert.cpp
src/bin/lttng-sessiond/ust-registry-channel.cpp
src/bin/lttng/commands/add_context.cpp
src/bin/lttng/commands/enable_events.cpp
src/common/actions/rotate-session.cpp
src/common/actions/snapshot-session.cpp
src/common/actions/start-session.cpp
src/common/actions/stop-session.cpp
src/common/argpar/argpar.h
src/common/conditions/buffer-usage.cpp
src/common/conditions/event-rule-matches.cpp
src/common/conditions/session-consumed-size.cpp
src/common/conditions/session-rotation.cpp
src/common/config/session-config.cpp
src/common/consumer/consumer-timer.hpp
src/common/consumer/consumer.cpp
src/common/context.cpp
src/common/defaults.hpp
src/common/event-rule/jul-logging.cpp
src/common/event-rule/kernel-kprobe.cpp
src/common/event-rule/kernel-syscall.cpp
src/common/event-rule/kernel-tracepoint.cpp
src/common/event-rule/kernel-uprobe.cpp
src/common/event-rule/log4j-logging.cpp
src/common/event-rule/python-logging.cpp
src/common/event-rule/user-tracepoint.cpp
src/common/event.cpp
src/common/fd-tracker/fd-tracker.cpp
src/common/hashtable/utils.cpp
src/common/ini-config/ini-config.cpp
src/common/kernel-consumer/kernel-consumer.cpp
src/common/kernel-probe.cpp
src/common/lttng-elf.cpp
src/common/lttng-kernel-old.hpp
src/common/lttng-kernel.hpp
src/common/macros.hpp
src/common/optional.hpp
src/common/runas.cpp
src/common/trace-chunk.cpp
src/common/tracker.cpp
src/common/urcu.hpp
src/common/userspace-probe.cpp
src/common/ust-consumer/ust-consumer.cpp
src/lib/lttng-ctl/lttng-ctl.cpp
src/lib/lttng-ctl/tracker.cpp
src/vendor/.clang-tidy [new file with mode: 0644]
tests/regression/tools/trigger/utils/notification-client.c
tests/unit/test_fd_tracker.cpp
tests/unit/test_unix_socket.cpp

index f2bcc43978a83a48dd884dd27b9a2965d509f8da..666624f20cf8766f00af6f43283a97a9104b6aea 100644 (file)
@@ -2,11 +2,58 @@ HeaderFilterRegex: '.*((include/.*-internal)|(src/common.*)|(src/bin.*)|(src/lib
 Checks:          '-*,
                   bugprone-argument-comment,
                   bugprone-assert-side-effect,
+                  bugprone-assignment-in-if-condition,
+                  bugprone-bad-signal-to-kill-thread,
+                  bugprone-bool-pointer-implicit-conversion,
+                  bugprone-copy-constructor-init,
                   bugprone-dangling-handle,
+                  bugprone-exception-escape,
+                  bugprone-fold-init-type,
+                  bugprone-forward-declaration-namespace,
+                  bugprone-forwarding-reference-overload,
                   bugprone-inaccurate-erase,
+                  bugprone-incorrect-roundings,
+                  bugprone-infinite-loop,
+                  bugprone-integer-division,
+                  bugprone-macro-parentheses,
+                  bugprone-macro-repeated-side-effects,
+                  bugprone-misplaced-operator-in-strlen-in-alloc,
+                  bugprone-misplaced-pointer-arithmetic-in-alloc,
+                  bugprone-move-forwarding-reference,
+                  bugprone-multiple-statement-macro,
+                  bugprone-not-null-terminated-result,
+                  bugprone-parent-virtual-call,
+                  bugprone-posix-return,
+                  bugprone-shared-ptr-array-mismatch,
+                  bugprone-signal-handler,
+                  bugprone-signed-char-misuse,
+                  bugprone-sizeof-container,
+                  bugprone-sizeof-expression,
+                  bugprone-standalone-empty,
                   bugprone-string-constructor,
                   bugprone-string-integer-assignment,
+                  bugprone-string-literal-with-embedded-nul,
+                  bugprone-suspicious-enum-usage,
+                  bugprone-suspicious-include,
+                  bugprone-suspicious-memory-comparison
+                  bugprone-suspicious-memset-usage,
+                  bugprone-suspicious-missing-comma,
+                  bugprone-suspicious-realloc-usage,
+                  bugprone-suspicious-semicolon,
+                  bugprone-suspicious-string-compare,
+                  bugprone-swapped-arguments,
+                  bugprone-terminating-continue,
+                  bugprone-throw-keyword-missing,
+                  bugprone-too-small-loop-variable,
+                  bugprone-unchecked-optional-access
                   bugprone-undefined-memory-manipulation,
+                  bugprone-undelegated-constructor,
+                  bugprone-unhandled-exception-at-new,
+                  bugprone-unhandled-self-assignment,
+                  bugprone-unused-raii,
+                  bugprone-unused-return-value,
+                  bugprone-use-after-move,
+                  bugprone-virtual-near-miss,
                   bugprone-unused-raii,
                   bugprone-use-after-move,
                   google-build-explicit-make-pair,
@@ -35,4 +82,6 @@ Checks:          '-*,
 FormatStyle: 'file'
 CheckOptions:
   - key:          bugprone-assert-side-effect.AssertMacros
-    value:        assert,LTTNG_ASSERT
\ No newline at end of file
+    value:        assert,LTTNG_ASSERT
+  - key:          bugprone-signed-char-misuse.CharTypdefsToIgnore
+    value:        'int8_t'
index a5ee70da326c2181d8133af103e7d83eb57ecc6d..86e5b04f25fc9a5cd55fcd9ca83bcad82c7b7833 100644 (file)
@@ -37,6 +37,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <assert.h>
 
 #define DEFAULT_DATA_AVAILABILITY_WAIT_TIME 200000 /* usec */
 
@@ -44,7 +45,10 @@ static volatile int quit = 0;
 
 static void sighandler(int signal __attribute__((unused)))
 {
-       printf("Signal caught, exiting\n");
+       const char msg[] = "Signal caught, exiting\n";
+       const int ret =  write(STDOUT_FILENO, msg, sizeof(msg));
+
+       assert(ret == 0); /* NOLINT assert is not async signal safe */
        quit = 1;
 }
 
index bd548236317bb09927b7634bdf28ca7cc0beb537..d4e41e0336fe95ace3fb532885f954e2397b99fb 100644 (file)
@@ -388,13 +388,13 @@ _crash_get_field(const struct lttng_crash_layout *layout, const char *ptr, size_
 }
 
 #define crash_get_field(layout, map, name) \
-       _crash_get_field(layout, (map) + (layout)->offset.name, layout->length.name)
+       _crash_get_field(layout, (map) + (layout)->offset.name, (layout)->length.name)
 
-#define crash_get_array_field(layout, map, array_name, idx, field_name) \
-       _crash_get_field(layout,                                        \
-                        (map) + (layout)->offset.array_name +          \
-                                (idx * (layout)->stride.array_name) +  \
-                                (layout)->offset.field_name,           \
+#define crash_get_array_field(layout, map, array_name, idx, field_name)  \
+       _crash_get_field(layout,                                         \
+                        (map) + (layout)->offset.array_name +           \
+                                ((idx) * (layout)->stride.array_name) + \
+                                (layout)->offset.field_name,            \
                         (layout)->length.field_name)
 
 #define crash_get_hdr_raw_field(layout, hdr, name) ((hdr)->name)
index f862709ac7838840c33f554edec59e415602e391..786feaae83651acf86f3115b0cb0f3530552cf2a 100644 (file)
@@ -904,7 +904,9 @@ static void *thread_dispatcher(void *data __attribute__((unused)))
                         * the data will be read at some point in time
                         * or wait to the end of the world :)
                         */
-                       ret = lttng_write(live_conn_pipe[1], &conn, sizeof(conn));
+                       ret = lttng_write(live_conn_pipe[1], &conn, sizeof(conn)); /* NOLINT sizeof
+                                                                                     used on a
+                                                                                     pointer. */
                        if (ret < 0) {
                                PERROR("write conn pipe");
                                connection_put(conn);
@@ -2640,7 +2642,10 @@ restart:
                                if (revents & LPOLLIN) {
                                        struct relay_connection *conn;
 
-                                       ret = lttng_read(live_conn_pipe[0], &conn, sizeof(conn));
+                                       ret = lttng_read(live_conn_pipe[0],
+                                                        &conn,
+                                                        sizeof(conn)); /* NOLINT sizeof used on a
+                                                                          pointer. */
                                        if (ret < 0) {
                                                goto error;
                                        }
index e7598974de380e57ce76636d80b4d9474e3ed769..9793e277808975728d5f6965e12f8648de35a9ff 100644 (file)
@@ -490,7 +490,7 @@ static int config_entry_handler(const struct config_entry *entry,
 
        for (i = 0; i < (sizeof(long_options) / sizeof(struct option)) - 1; i++) {
                /* Ignore if entry name is not fully matched. */
-               if (strcmp(entry->name, long_options[i].name)) {
+               if (strcmp(entry->name, long_options[i].name) != 0) {
                        continue;
                }
 
@@ -1320,7 +1320,12 @@ static void *relay_thread_dispatcher(void *data __attribute__((unused)))
                         * the data will be read at some point in time
                         * or wait to the end of the world :)
                         */
-                       ret = lttng_write(relay_conn_pipe[1], &new_conn, sizeof(new_conn));
+                       ret = lttng_write(relay_conn_pipe[1], &new_conn, sizeof(new_conn)); /* NOLINT
+                                                                                              sizeof
+                                                                                              used
+                                                                                              on a
+                                                                                              pointer.
+                                                                                            */
                        if (ret < 0) {
                                PERROR("write connection pipe");
                                connection_put(new_conn);
@@ -3961,7 +3966,10 @@ restart:
                                if (revents & LPOLLIN) {
                                        struct relay_connection *conn;
 
-                                       ret = lttng_read(relay_conn_pipe[0], &conn, sizeof(conn));
+                                       ret = lttng_read(relay_conn_pipe[0],
+                                                        &conn,
+                                                        sizeof(conn)); /* NOLINT sizeof used on a
+                                                                          pointer. */
                                        if (ret < 0) {
                                                goto error;
                                        }
index 96eed11c00c089a69ffd9b79c774b0dcfdba6d98..2e7ed527d39d3d9c7564cb06fbd14c441a4fe58a 100644 (file)
@@ -449,7 +449,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
 
        /* Adding the channel to the channel hash table. */
        rcu_read_lock();
-       if (strncmp(uchan->name, DEFAULT_METADATA_NAME, sizeof(uchan->name))) {
+       if (strncmp(uchan->name, DEFAULT_METADATA_NAME, sizeof(uchan->name)) != 0) {
                lttng_ht_add_unique_str(usess->domain_global.channels, &uchan->node);
                chan_published = true;
        } else {
index 388e056e0c15dc7a8534c60ae59043bbf108a357..8f274abcb0524305adf35a4ce05fe0cdefbeb2a0 100644 (file)
@@ -1435,19 +1435,23 @@ static enum lttng_error_code cmd_enable_channel_internal(struct ltt_session *ses
                 * adhered to.
                 */
                if (domain->type == LTTNG_DOMAIN_JUL) {
-                       if (strncmp(attr->name, DEFAULT_JUL_CHANNEL_NAME, LTTNG_SYMBOL_NAME_LEN)) {
+                       if (strncmp(attr->name,
+                                   DEFAULT_JUL_CHANNEL_NAME,
+                                   LTTNG_SYMBOL_NAME_LEN - 1) != 0) {
                                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
                } else if (domain->type == LTTNG_DOMAIN_LOG4J) {
-                       if (strncmp(attr->name, DEFAULT_LOG4J_CHANNEL_NAME, LTTNG_SYMBOL_NAME_LEN)) {
+                       if (strncmp(attr->name,
+                                   DEFAULT_LOG4J_CHANNEL_NAME,
+                                   LTTNG_SYMBOL_NAME_LEN - 1) != 0) {
                                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
                } else if (domain->type == LTTNG_DOMAIN_PYTHON) {
                        if (strncmp(attr->name,
                                    DEFAULT_PYTHON_CHANNEL_NAME,
-                                   LTTNG_SYMBOL_NAME_LEN)) {
+                                   LTTNG_SYMBOL_NAME_LEN - 1) != 0) {
                                ret_code = LTTNG_ERR_INVALID_CHANNEL_NAME;
                                goto error;
                        }
@@ -1935,11 +1939,11 @@ int cmd_add_context(struct command_ctx *cmd_ctx,
                 * name, return an error.
                 */
                if (domain == LTTNG_DOMAIN_JUL && *channel_name &&
-                   strcmp(channel_name, DEFAULT_JUL_CHANNEL_NAME)) {
+                   strcmp(channel_name, DEFAULT_JUL_CHANNEL_NAME) != 0) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error;
                } else if (domain == LTTNG_DOMAIN_LOG4J && *channel_name &&
-                          strcmp(channel_name, DEFAULT_LOG4J_CHANNEL_NAME)) {
+                          strcmp(channel_name, DEFAULT_LOG4J_CHANNEL_NAME) != 0) {
                        ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
                        goto error;
                }
index 6b6c6265b5c8e661b84fe8cc0e4ad961e113c42e..24fe15792545f43c38120d803e56d81f51fa46ce 100644 (file)
@@ -103,7 +103,8 @@ const char *get_role_name(lst::static_length_blob_type::role role)
 namespace ctf2 {
 class trace_environment_visitor : public lst::trace_class_environment_visitor {
 public:
-       trace_environment_visitor() = default;
+       trace_environment_visitor() = default; /* NOLINT clang-tidy 14 identifies this as a move
+                                                 constructor. */
 
        void visit(const lst::environment_field<int64_t>& field) override
        {
@@ -134,7 +135,7 @@ private:
 class field_visitor : public lttng::sessiond::trace::field_visitor,
                      public lttng::sessiond::trace::type_visitor {
 public:
-       field_visitor() = default;
+       field_visitor() = default; /* NOLINT clang-tidy 14 identifies this as a move constructor. */
 
        /* Only call once. */
        json::json move_fragment()
index 0dd1e387fd84f5ded847ecdd999a209a1b081f8a..e81fa9417c4333198c6ddf0af507b91bff7905ee 100644 (file)
@@ -80,7 +80,7 @@ int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
        cds_list_for_each_entry (kevent, &kchan->events_list.head, list) {
                if (type != LTTNG_EVENT_ALL && kevent->type != type)
                        continue;
-               if (event_name != nullptr && strcmp(event_name, kevent->event->name)) {
+               if (event_name != nullptr && strcmp(event_name, kevent->event->name) != 0) {
                        continue;
                }
                found++;
index 01633390522d6ecec7f2c265155663d48fcd7ea9..cc32856198c3de9f0aac3c7bda84caf1d5b89564 100644 (file)
@@ -791,7 +791,7 @@ static int config_entry_handler(const struct config_entry *entry,
 
        for (i = 0; i < (sizeof(long_options) / sizeof(struct option)) - 1; i++) {
                /* Ignore if not fully matched. */
-               if (strcmp(entry->name, long_options[i].name)) {
+               if (strcmp(entry->name, long_options[i].name) != 0) {
                        continue;
                }
 
index c9348cb3d14a6c77e55bb45787210204ce23fef2..a560ad1c01967222d305845947f6e078c610d268 100644 (file)
@@ -1416,10 +1416,10 @@ static bool buffer_usage_condition_applies_to_channel(const struct lttng_conditi
        status = lttng_condition_buffer_usage_get_channel_name(condition, &condition_channel_name);
        LTTNG_ASSERT((status == LTTNG_CONDITION_STATUS_OK) && condition_channel_name);
 
-       if (strcmp(channel_info->session_info->name, condition_session_name)) {
+       if (strcmp(channel_info->session_info->name, condition_session_name) != 0) {
                goto fail;
        }
-       if (strcmp(channel_info->name, condition_channel_name)) {
+       if (strcmp(channel_info->name, condition_channel_name) != 0) {
                goto fail;
        }
 
index b99428041fabfae859620d6d338e1acdcf95d236..243b562190d12e3656e438c561f25aba4bc8215b 100644 (file)
 #include <inttypes.h>
 #include <signal.h>
 
-#define LTTNG_SESSIOND_SIG_QS                    SIGRTMIN + 10
-#define LTTNG_SESSIOND_SIG_EXIT                          SIGRTMIN + 11
-#define LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK SIGRTMIN + 12
-#define LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION    SIGRTMIN + 13
-
-#define UINT_TO_PTR(value)                          \
-       ({                                          \
-               LTTNG_ASSERT(value <= UINTPTR_MAX); \
-               (void *) (uintptr_t) value;         \
+#define LTTNG_SESSIOND_SIG_QS                    (SIGRTMIN + 10)
+#define LTTNG_SESSIOND_SIG_EXIT                          (SIGRTMIN + 11)
+#define LTTNG_SESSIOND_SIG_PENDING_ROTATION_CHECK (SIGRTMIN + 12)
+#define LTTNG_SESSIOND_SIG_SCHEDULED_ROTATION    (SIGRTMIN + 13)
+
+#define UINT_TO_PTR(value)                            \
+       ({                                            \
+               LTTNG_ASSERT((value) <= UINTPTR_MAX); \
+               (void *) (uintptr_t) (value);         \
        })
-#define PTR_TO_UINT(ptr) ((uintptr_t) ptr)
+#define PTR_TO_UINT(ptr) ((uintptr_t) (ptr))
 
 namespace {
 /*
index 4cf8e6f862e7d651a29aa39053bb75d423e880ea..e1d591761977af24332bcb0c2d3f3cf8df7a7c0c 100644 (file)
@@ -85,7 +85,7 @@ struct ltt_kernel_event *trace_kernel_find_event(char *name,
                if (type != LTTNG_EVENT_ALL && ev->type != type) {
                        continue;
                }
-               if (strcmp(name, ev->event->name)) {
+               if (strcmp(name, ev->event->name) != 0) {
                        continue;
                }
                if ((ev->filter && !filter) || (!ev->filter && filter)) {
@@ -125,7 +125,7 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(char *name,
                if (type != LTTNG_EVENT_ALL && ev->type != type) {
                        continue;
                }
-               if (strcmp(name, ev->event->name)) {
+               if (strcmp(name, ev->event->name) != 0) {
                        continue;
                }
                found = 1;
index 285e57909a87dd0902252058b4d3260ea802fe3a..1505c3159ffb6e10b28404367772df3776c54d27 100644 (file)
@@ -645,15 +645,15 @@ int trace_ust_match_context(const struct ltt_ust_context *uctx,
                }
                if (strncmp(uctx->ctx.u.perf_counter.name,
                            ctx->u.perf_counter.name,
-                           LTTNG_UST_ABI_SYM_NAME_LEN)) {
+                           LTTNG_UST_ABI_SYM_NAME_LEN) != 0) {
                        return 0;
                }
                break;
        case LTTNG_UST_ABI_CONTEXT_APP_CONTEXT:
                LTTNG_ASSERT(uctx->ctx.u.app_ctx.provider_name);
                LTTNG_ASSERT(uctx->ctx.u.app_ctx.ctx_name);
-               if (strcmp(uctx->ctx.u.app_ctx.provider_name, ctx->u.app_ctx.provider_name) ||
-                   strcmp(uctx->ctx.u.app_ctx.ctx_name, ctx->u.app_ctx.ctx_name)) {
+               if (strcmp(uctx->ctx.u.app_ctx.provider_name, ctx->u.app_ctx.provider_name) != 0 ||
+                   strcmp(uctx->ctx.u.app_ctx.ctx_name, ctx->u.app_ctx.ctx_name) != 0) {
                        return 0;
                }
        default:
index ec41be6c6573858b33cbc88b1a3b57616b5c7f7d..6136f5fc71b77796d4a88307ae13b3e4646debc6 100644 (file)
@@ -786,9 +786,7 @@ private:
 
 class tsdl_trace_environment_visitor : public lst::trace_class_environment_visitor {
 public:
-       tsdl_trace_environment_visitor() : _environment{ "env {\n" }
-       {
-       }
+       tsdl_trace_environment_visitor() = default;
 
        void visit(const lst::environment_field<int64_t>& field) override
        {
@@ -810,7 +808,7 @@ public:
        }
 
 private:
-       std::string _environment;
+       std::string _environment{ "env {\n" };
 };
 } /* namespace */
 
index 37e7204eab5ec85cf0d2b6cb5627887eea431404..684dec8690e0a2b0dc86fa618ca7f679975afd37 100644 (file)
@@ -2841,13 +2841,13 @@ static int ht_match_ust_app_ctx(struct cds_lfht_node *node, const void *_key)
        case LTTNG_UST_ABI_CONTEXT_PERF_THREAD_COUNTER:
                if (strncmp(key->u.perf_counter.name,
                            ctx->ctx.u.perf_counter.name,
-                           sizeof(key->u.perf_counter.name))) {
+                           sizeof(key->u.perf_counter.name)) != 0) {
                        goto no_match;
                }
                break;
        case LTTNG_UST_ABI_CONTEXT_APP_CONTEXT:
-               if (strcmp(key->u.app_ctx.provider_name, ctx->ctx.u.app_ctx.provider_name) ||
-                   strcmp(key->u.app_ctx.ctx_name, ctx->ctx.u.app_ctx.ctx_name)) {
+               if (strcmp(key->u.app_ctx.provider_name, ctx->ctx.u.app_ctx.provider_name) != 0 ||
+                   strcmp(key->u.app_ctx.ctx_name, ctx->ctx.u.app_ctx.ctx_name) != 0) {
                        goto no_match;
                }
                break;
index 67fcdf1b21b786e2a90e7a0d10e19835b9d6f68d..62ac4825bf96361a941e7fb67da419c7276209d1 100644 (file)
@@ -539,7 +539,7 @@ lst::type::cuptr create_sequence_nestable_type_from_ust_ctl_fields(
 
        lst::field_location::elements length_field_location_elements =
                current_field_location_elements;
-       length_field_location_elements.emplace_back(std::move(length_field_name));
+       length_field_location_elements.emplace_back(length_field_name);
 
        lst::field_location length_field_location{ lookup_root,
                                                   std::move(length_field_location_elements) };
index 3cf58e0889082acce22b8d3f09ba00b807b215f3..03532cd09e65dfdd9fc4105a02ec1c9e6ecc9124 100644 (file)
@@ -447,7 +447,7 @@ void lsu::registry_channel::add_event(int session_objd,
                const auto& event_ref = *event;
 
                /* Ownership transferred to _events hash table. */
-               event.release();
+               (void) event.release();
 
                /* Request next event id if the node was successfully added. */
                event_id = event_ref.id;
index cc5e487df3b8b0d8398c32a7c229af07f061f4c9..79142cc65f29522e629d7bc2fede64f01c4d0c9f 100644 (file)
@@ -976,7 +976,7 @@ static struct ctx_type *get_context_type(const char *ctx)
        }
 
        /* String starts with $app. */
-       if (strncmp(ctx, app_ctx_prefix, sizeof(app_ctx_prefix) - 1)) {
+       if (strncmp(ctx, app_ctx_prefix, sizeof(app_ctx_prefix) - 1) != 0) {
                goto not_found;
        }
 
index ef58bfa75ff0f752fc57a63c32168c1ea5faac3f..f9e464510ba0da1ff537db026a0fca369c864c6c 100644 (file)
@@ -845,7 +845,7 @@ static int enable_events(char *session_name, char *event_list)
                        switch (opt_event_type) {
                        case LTTNG_EVENT_ALL: /* Enable tracepoints and syscalls */
                                /* If event name differs from *, select tracepoint. */
-                               if (strcmp(ev->name, "*")) {
+                               if (strcmp(ev->name, "*") != 0) {
                                        ev->type = LTTNG_EVENT_TRACEPOINT;
                                }
                                break;
index c2b962ab6d94b893177c39d44226f63891103a92..8997542e9358a91f074a821d5db3182af380b5e8 100644 (file)
@@ -96,7 +96,7 @@ static bool lttng_action_rotate_session_is_equal(const struct lttng_action *_a,
        /* Action is not valid if this is not true. */
        LTTNG_ASSERT(a->session_name);
        LTTNG_ASSERT(b->session_name);
-       if (strcmp(a->session_name, b->session_name)) {
+       if (strcmp(a->session_name, b->session_name) != 0) {
                goto end;
        }
 
index 23d6f8a56db3c1c21539068d5a0d6f784673927b..015a834ddfe52e468fe1ea359e3129fa8b946b12 100644 (file)
@@ -117,7 +117,7 @@ static bool lttng_action_snapshot_session_is_equal(const struct lttng_action *_a
        /* Action is not valid if this is not true. */
        LTTNG_ASSERT(a->session_name);
        LTTNG_ASSERT(b->session_name);
-       if (strcmp(a->session_name, b->session_name)) {
+       if (strcmp(a->session_name, b->session_name) != 0) {
                goto end;
        }
 
index aed2938c6394f3e83f10564421447747a86ff3ef..1004290fe9a94020b84934070637e9e3b9484233 100644 (file)
@@ -96,7 +96,7 @@ static bool lttng_action_start_session_is_equal(const struct lttng_action *_a,
        /* Action is not valid if this is not true. */
        LTTNG_ASSERT(a->session_name);
        LTTNG_ASSERT(b->session_name);
-       if (strcmp(a->session_name, b->session_name)) {
+       if (strcmp(a->session_name, b->session_name) != 0) {
                goto end;
        }
 
index 9db4a25fc7104cb083fa16836b13fda91d5baa87..be8fd0aaec92cf489eb0b5109f4b8f3178dcd259 100644 (file)
@@ -95,7 +95,7 @@ static bool lttng_action_stop_session_is_equal(const struct lttng_action *_a,
        /* Action is not valid if this is not true. */
        LTTNG_ASSERT(a->session_name);
        LTTNG_ASSERT(b->session_name);
-       if (strcmp(a->session_name, b->session_name)) {
+       if (strcmp(a->session_name, b->session_name) != 0) {
                goto end;
        }
 
index c528cc4412272700990a0a61a480b6859ce57c18..af9df9f5bee69caf8c8ff6bd99e52acd67889ea0 100644 (file)
@@ -334,7 +334,7 @@ void argpar_item_destroy(const struct argpar_item *item);
 #define ARGPAR_ITEM_DESTROY_AND_RESET(_item)                           \
        {                                                               \
                argpar_item_destroy(_item);                             \
-               _item = NULL;                                           \
+               ((_item)) = NULL;                                               \
        }
 
 /// @}
index 4574d6242f1659f9f54387535e75f5c936037357..c78528735063cb261a0f4830fb023131397cd496 100644 (file)
@@ -160,13 +160,13 @@ static bool lttng_condition_buffer_usage_is_equal(const struct lttng_condition *
        /* Condition is not valid if this is not true. */
        LTTNG_ASSERT(a->session_name);
        LTTNG_ASSERT(b->session_name);
-       if (strcmp(a->session_name, b->session_name)) {
+       if (strcmp(a->session_name, b->session_name) != 0) {
                goto end;
        }
 
        LTTNG_ASSERT(a->channel_name);
        LTTNG_ASSERT(b->channel_name);
-       if (strcmp(a->channel_name, b->channel_name)) {
+       if (strcmp(a->channel_name, b->channel_name) != 0) {
                goto end;
        }
 
index d951ccd3c351602262a9c5839f5a4bf8a6cfb5da..d86d2ad7b048b036133f8e9ee8f66049287de5f6 100644 (file)
@@ -528,7 +528,7 @@ static uint64_t uint_from_buffer(const struct lttng_buffer_view *view, size_t si
 
        switch (size) {
        case 1:
-               ret = (uint64_t) *uint_view.data;
+               ret = (unsigned char) *uint_view.data;
                break;
        case sizeof(uint32_t):
        {
index 9a5c96e8723afee12746310e611f9252aef64f60..1e9cb4379a428609e5e6de5e72d68350a8e9dc25 100644 (file)
@@ -120,7 +120,7 @@ static bool lttng_condition_session_consumed_size_is_equal(const struct lttng_co
 
        LTTNG_ASSERT(a->session_name);
        LTTNG_ASSERT(b->session_name);
-       if (strcmp(a->session_name, b->session_name)) {
+       if (strcmp(a->session_name, b->session_name) != 0) {
                goto end;
        }
 
index c62b5b38a1274ba25e3b94356f14f316478e475b..20af727cf8ff29feea0d6023208c0141b45dc70f 100644 (file)
@@ -133,7 +133,7 @@ static bool lttng_condition_session_rotation_is_equal(const struct lttng_conditi
                goto end;
        }
 
-       if (a->session_name && b->session_name && strcmp(a->session_name, b->session_name)) {
+       if (a->session_name && b->session_name && strcmp(a->session_name, b->session_name) != 0) {
                goto end;
        }
 
index 95edd7aa42309b31ccd02cdf56956f58b9af5ae3..9af61fa93fb349f037b1e07c5039587c61944729 100644 (file)
@@ -1260,7 +1260,7 @@ static int create_session(const char *name,
                }
 
                if (strcmp((const char *) consumer_output_node->name,
-                          config_element_consumer_output)) {
+                          config_element_consumer_output) != 0) {
                        WARN("Invalid output type, expected %s node",
                             config_element_consumer_output);
                        ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
@@ -3035,7 +3035,7 @@ static int process_session_rotation_schedules_node(xmlNodePtr schedules_node,
                        time_us_node = xmlFirstElementChild(child);
                        if (!time_us_node ||
                            strcmp((const char *) time_us_node->name,
-                                  config_element_rotation_schedule_periodic_time_us)) {
+                                  config_element_rotation_schedule_periodic_time_us) != 0) {
                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                goto end;
                        }
@@ -3061,7 +3061,7 @@ static int process_session_rotation_schedules_node(xmlNodePtr schedules_node,
                        bytes_node = xmlFirstElementChild(child);
                        if (!bytes_node ||
                            strcmp((const char *) bytes_node->name,
-                                  config_element_rotation_schedule_size_threshold_bytes)) {
+                                  config_element_rotation_schedule_size_threshold_bytes) != 0) {
                                ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
                                goto end;
                        }
@@ -3208,7 +3208,7 @@ static int process_session_node(xmlNodePtr session_node,
                goto error;
        }
 
-       if (session_name && strcmp((char *) name, session_name)) {
+       if (session_name && strcmp((char *) name, session_name) != 0) {
                /* This is not the session we are looking for */
                ret = -LTTNG_ERR_NO_SESSION;
                goto error;
@@ -3573,7 +3573,8 @@ static int load_session_from_path(const char *path,
                        /* Does the file end with .lttng? */
                        if (strcmp(DEFAULT_SESSION_CONFIG_FILE_EXTENSION,
                                   result->d_name + file_name_len -
-                                          sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION) + 1)) {
+                                          sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION) + 1) !=
+                           0) {
                                continue;
                        }
 
index b38460f6021631bc0aca44984388a8c0a2c27302..656ebe036268ee868b82564ef30afa53629b95e0 100644 (file)
 
 #include "consumer.hpp"
 
-#define LTTNG_CONSUMER_SIG_SWITCH      SIGRTMIN + 10
-#define LTTNG_CONSUMER_SIG_TEARDOWN    SIGRTMIN + 11
-#define LTTNG_CONSUMER_SIG_LIVE                SIGRTMIN + 12
-#define LTTNG_CONSUMER_SIG_MONITOR     SIGRTMIN + 13
-#define LTTNG_CONSUMER_SIG_EXIT                SIGRTMIN + 14
+#define LTTNG_CONSUMER_SIG_SWITCH      ((SIGRTMIN + 10))
+#define LTTNG_CONSUMER_SIG_TEARDOWN    ((SIGRTMIN + 11))
+#define LTTNG_CONSUMER_SIG_LIVE                ((SIGRTMIN + 12))
+#define LTTNG_CONSUMER_SIG_MONITOR     ((SIGRTMIN + 13))
+#define LTTNG_CONSUMER_SIG_EXIT                ((SIGRTMIN + 14))
 
 #define CLOCKID CLOCK_MONOTONIC
 
index eb7e6375eed4577736fb303a098ab37a6d7c3ece..4d64b0ea2be2b7f531f5fc03c1eef4573d2eefc8 100644 (file)
@@ -104,7 +104,8 @@ static void notify_thread_lttng_pipe(struct lttng_pipe *pipe)
 
        LTTNG_ASSERT(pipe);
 
-       (void) lttng_pipe_write(pipe, &null_stream, sizeof(null_stream));
+       (void) lttng_pipe_write(pipe, &null_stream, sizeof(null_stream)); /* NOLINT sizeof used on a
+                                                                            pointer. */
 }
 
 static void notify_health_quit_pipe(int *pipe)
@@ -2375,8 +2376,11 @@ void *consumer_thread_metadata_poll(void *data)
 
                                        pipe_len = lttng_pipe_read(ctx->consumer_metadata_pipe,
                                                                   &stream,
-                                                                  sizeof(stream));
-                                       if (pipe_len < sizeof(stream)) {
+                                                                  sizeof(stream)); /* NOLINT sizeof
+                                                                                      used on a
+                                                                                      pointer. */
+                                       if (pipe_len < sizeof(stream)) { /* NOLINT sizeof used on a
+                                                                           pointer. */
                                                if (pipe_len < 0) {
                                                        PERROR("read metadata stream");
                                                }
@@ -2643,9 +2647,12 @@ void *consumer_thread_data_poll(void *data)
                        ssize_t pipe_readlen;
 
                        DBG("consumer_data_pipe wake up");
-                       pipe_readlen = lttng_pipe_read(
-                               ctx->consumer_data_pipe, &new_stream, sizeof(new_stream));
-                       if (pipe_readlen < sizeof(new_stream)) {
+                       pipe_readlen = lttng_pipe_read(ctx->consumer_data_pipe,
+                                                      &new_stream,
+                                                      sizeof(new_stream)); /* NOLINT sizeof used on
+                                                                              a pointer. */
+                       if (pipe_readlen < sizeof(new_stream)) { /* NOLINT sizeof used on a pointer.
+                                                                 */
                                PERROR("Consumer data pipe");
                                /* Continue so we can at least handle the current stream(s). */
                                continue;
index 60e30ad298d9edc9a9bf7a519dc0bba32cf794d3..14763c00d3b83beb680861304a4982bfa287fb9f 100644 (file)
@@ -29,7 +29,7 @@ int parse_application_context(const char *str, char **out_provider_name, char **
        }
 
        /* String starts with $app. */
-       if (strncmp(str, app_ctx_prefix, sizeof(app_ctx_prefix) - 1)) {
+       if (strncmp(str, app_ctx_prefix, sizeof(app_ctx_prefix) - 1) != 0) {
                goto not_found;
        }
 
index 4588fe768e1536549e3a872ea6c51ebe2f83c2fc..cae1ec5fcf1dcbc9755f450e2d65a4945484d89c 100644 (file)
  * than enough. We might end up with quantum computing in a cell phone when
  * reaching this limit.
  */
-#define DEFAULT_STREAM_NAME_LEN        LTTNG_SYMBOL_NAME_LEN + 8
+#define DEFAULT_STREAM_NAME_LEN (LTTNG_SYMBOL_NAME_LEN + 8)
 
 /* Default channel attributes */
 #define DEFAULT_CHANNEL_NAME            "channel0"
 #define DEFAULT_PYTHON_EVENT_COMPONENT    "lttng_python"
 #define DEFAULT_PYTHON_EVENT_NAME         DEFAULT_PYTHON_EVENT_COMPONENT ":*"
 
-#define DEFAULT_CHANNEL_OVERWRITE       -1
+#define DEFAULT_CHANNEL_OVERWRITE      (-1)
 #define DEFAULT_CHANNEL_TRACEFILE_SIZE  CONFIG_DEFAULT_CHANNEL_TRACEFILE_SIZE
 #define DEFAULT_CHANNEL_TRACEFILE_COUNT CONFIG_DEFAULT_CHANNEL_TRACEFILE_COUNT
 
index bff0aa6b6896533e3314948b84e3de45167a86f9..3db273744d18614ff109ca7d35336f6ec15d40de 100644 (file)
@@ -145,12 +145,12 @@ static bool lttng_event_rule_jul_logging_is_equal(const struct lttng_event_rule
        /* Long check. */
        LTTNG_ASSERT(a->pattern);
        LTTNG_ASSERT(b->pattern);
-       if (strcmp(a->pattern, b->pattern)) {
+       if (strcmp(a->pattern, b->pattern) != 0) {
                goto end;
        }
 
        if (a->filter_expression && b->filter_expression) {
-               if (strcmp(a->filter_expression, b->filter_expression)) {
+               if (strcmp(a->filter_expression, b->filter_expression) != 0) {
                        goto end;
                }
        } else if (!!a->filter_expression != !!b->filter_expression) {
index 712136ebdbce453a80e02389cd29510732b2882e..bae7bdfa78380ac0e224cffae54ca77aee58d4a0 100644 (file)
@@ -138,7 +138,7 @@ static bool lttng_event_rule_kernel_kprobe_is_equal(const struct lttng_event_rul
        /* Long check */
        LTTNG_ASSERT(a->name);
        LTTNG_ASSERT(b->name);
-       if (strcmp(a->name, b->name)) {
+       if (strcmp(a->name, b->name) != 0) {
                goto end;
        }
 
index b65729cbb3be34e0e061574d6bf8c4f64b82dc72..23a432aacaaff285e6f0e3cb735d8cb1b4b3f26a 100644 (file)
@@ -120,12 +120,12 @@ static bool lttng_event_rule_kernel_syscall_is_equal(const struct lttng_event_ru
 
        LTTNG_ASSERT(a->pattern);
        LTTNG_ASSERT(b->pattern);
-       if (strcmp(a->pattern, b->pattern)) {
+       if (strcmp(a->pattern, b->pattern) != 0) {
                goto end;
        }
 
        if (a->filter_expression && b->filter_expression) {
-               if (strcmp(a->filter_expression, b->filter_expression)) {
+               if (strcmp(a->filter_expression, b->filter_expression) != 0) {
                        goto end;
                }
        } else if (!!a->filter_expression != !!b->filter_expression) {
index 77dd51ed0c26d8540f850ffc4eef5362410cf7a4..50dda01b73774b4ae0cf4b7b1126060842aecba3 100644 (file)
@@ -127,12 +127,12 @@ static bool lttng_event_rule_kernel_tracepoint_is_equal(const struct lttng_event
        /* Long check. */
        LTTNG_ASSERT(a->pattern);
        LTTNG_ASSERT(b->pattern);
-       if (strcmp(a->pattern, b->pattern)) {
+       if (strcmp(a->pattern, b->pattern) != 0) {
                goto end;
        }
 
        if (a->filter_expression && b->filter_expression) {
-               if (strcmp(a->filter_expression, b->filter_expression)) {
+               if (strcmp(a->filter_expression, b->filter_expression) != 0) {
                        goto end;
                }
        } else if (!!a->filter_expression != !!b->filter_expression) {
index 9c4078982a2c9d66de55ec89163747e7ebe62569..6e750576cf1e69040a441c9e61e66f381de8da01 100644 (file)
@@ -123,7 +123,7 @@ static bool lttng_event_rule_kernel_uprobe_is_equal(const struct lttng_event_rul
        /* uprobe is invalid if this is not true. */
        LTTNG_ASSERT(a->name);
        LTTNG_ASSERT(b->name);
-       if (strcmp(a->name, b->name)) {
+       if (strcmp(a->name, b->name) != 0) {
                goto end;
        }
 
index fec9589ad89d61c179b922c17e0b6887de04b21e..5655cd3bcc8fec6d0722bc166c50fe8c8f246f9d 100644 (file)
@@ -145,12 +145,12 @@ static bool lttng_event_rule_log4j_logging_is_equal(const struct lttng_event_rul
        /* Long check. */
        LTTNG_ASSERT(a->pattern);
        LTTNG_ASSERT(b->pattern);
-       if (strcmp(a->pattern, b->pattern)) {
+       if (strcmp(a->pattern, b->pattern) != 0) {
                goto end;
        }
 
        if (a->filter_expression && b->filter_expression) {
-               if (strcmp(a->filter_expression, b->filter_expression)) {
+               if (strcmp(a->filter_expression, b->filter_expression) != 0) {
                        goto end;
                }
        } else if (!!a->filter_expression != !!b->filter_expression) {
index 2f2187267615cc24c4a2a97da0a823b2b6753cf7..eb23b337bfd2c365f90e0fa84b1e8ed81ae020e7 100644 (file)
@@ -145,12 +145,12 @@ static bool lttng_event_rule_python_logging_is_equal(const struct lttng_event_ru
        /* Long check. */
        LTTNG_ASSERT(a->pattern);
        LTTNG_ASSERT(b->pattern);
-       if (strcmp(a->pattern, b->pattern)) {
+       if (strcmp(a->pattern, b->pattern) != 0) {
                goto end;
        }
 
        if (a->filter_expression && b->filter_expression) {
-               if (strcmp(a->filter_expression, b->filter_expression)) {
+               if (strcmp(a->filter_expression, b->filter_expression) != 0) {
                        goto end;
                }
        } else if (!!a->filter_expression != !!b->filter_expression) {
index 20993e12b397b36e1dc41d5feae78e0ab515bfc8..55b1c2505c9fb76ace05fa3df06ded60facd3354 100644 (file)
@@ -208,12 +208,12 @@ static bool lttng_event_rule_user_tracepoint_is_equal(const struct lttng_event_r
        /* Long check. */
        LTTNG_ASSERT(a->pattern);
        LTTNG_ASSERT(b->pattern);
-       if (strcmp(a->pattern, b->pattern)) {
+       if (strcmp(a->pattern, b->pattern) != 0) {
                goto end;
        }
 
        if (a->filter_expression && b->filter_expression) {
-               if (strcmp(a->filter_expression, b->filter_expression)) {
+               if (strcmp(a->filter_expression, b->filter_expression) != 0) {
                        goto end;
                }
        } else if (!!a->filter_expression != !!b->filter_expression) {
@@ -234,7 +234,7 @@ static bool lttng_event_rule_user_tracepoint_is_equal(const struct lttng_event_r
                status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
                        _b, i, &exclusion_b);
                LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
-               if (strcmp(exclusion_a, exclusion_b)) {
+               if (strcmp(exclusion_a, exclusion_b) != 0) {
                        goto end;
                }
        }
index b00cda83b7db462793952a323fbfbd277069253a..c0d128f53edede855184f53b4a8d502b10d5ccdf 100644 (file)
@@ -368,7 +368,7 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
        local_event->type = (enum lttng_event_type) event_comm->event_type;
        local_event->loglevel_type = (enum lttng_loglevel_type) event_comm->loglevel_type;
        local_event->loglevel = event_comm->loglevel;
-       local_event->enabled = event_comm->enabled;
+       local_event->enabled = !!event_comm->enabled;
        local_event->pid = event_comm->pid;
        local_event->flags = (enum lttng_event_flag) event_comm->flags;
 
index e610118e9a8d1a3217d24b9cd7ce0ec42159af64..e7ea6e9efb2973f23e6c56a9a9f19fb08732d1bb 100644 (file)
 #include <urcu/rculfhash.h>
 
 /* Tracker lock must be taken by the user. */
-#define TRACKED_COUNT(tracker)                                                      \
-       (tracker->count.suspendable.active + tracker->count.suspendable.suspended + \
-        tracker->count.unsuspendable)
+#define TRACKED_COUNT(tracker)                                                          \
+       ((tracker)->count.suspendable.active + (tracker)->count.suspendable.suspended + \
+        (tracker)->count.unsuspendable)
 
 /* Tracker lock must be taken by the user. */
-#define ACTIVE_COUNT(tracker) (tracker->count.suspendable.active + tracker->count.unsuspendable)
+#define ACTIVE_COUNT(tracker) ((tracker)->count.suspendable.active + (tracker)->count.unsuspendable)
 
 /* Tracker lock must be taken by the user. */
-#define SUSPENDED_COUNT(tracker) (tracker->count.suspendable.suspended)
+#define SUSPENDED_COUNT(tracker) ((tracker)->count.suspendable.suspended)
 
 /* Tracker lock must be taken by the user. */
 #define SUSPENDABLE_COUNT(tracker) \
-       (tracker->count.suspendable.active + tracker->count.suspendable.suspended)
+       ((tracker)->count.suspendable.active + (tracker)->count.suspendable.suspended)
 
 /* Tracker lock must be taken by the user. */
-#define UNSUSPENDABLE_COUNT(tracker) (tracker->count.unsuspendable)
+#define UNSUSPENDABLE_COUNT(tracker) ((tracker)->count.unsuspendable)
 
 struct fd_tracker {
        pthread_mutex_t lock;
index 305660c804ff6319f3d7aea7c36055590858e261..5b9344b15ba36cf430b55c69214328f58ff4293f 100644 (file)
  * on, and rotates are much kinder to the top and bottom bits, so I used
  * rotates.
  */
-#define mix(a, b, c)             \
-       {                        \
-               a -= c;          \
-               a ^= rot(c, 4);  \
-               c += b;          \
-               b -= a;          \
-               b ^= rot(a, 6);  \
-               a += c;          \
-               c -= b;          \
-               c ^= rot(b, 8);  \
-               b += a;          \
-               a -= c;          \
-               a ^= rot(c, 16); \
-               c += b;          \
-               b -= a;          \
-               b ^= rot(a, 19); \
-               a += c;          \
-               c -= b;          \
-               c ^= rot(b, 4);  \
-               b += a;          \
+#define mix(a, b, c)               \
+       {                          \
+               (a) -= (c);        \
+               (a) ^= rot(c, 4);  \
+               (c) += (b);        \
+               (b) -= (a);        \
+               (b) ^= rot(a, 6);  \
+               (a) += (c);        \
+               (c) -= (b);        \
+               (c) ^= rot(b, 8);  \
+               (b) += (a);        \
+               (a) -= (c);        \
+               (a) ^= rot(c, 16); \
+               (c) += (b);        \
+               (b) -= (a);        \
+               (b) ^= rot(a, 19); \
+               (a) += (c);        \
+               (c) -= (b);        \
+               (c) ^= rot(b, 4);  \
+               (b) += (a);        \
        }
 
 /*
  *  10  8 15 26 3 22 24
  *  11  8 15 26 3 22 24
  */
-#define final(a, b, c)           \
-       {                        \
-               c ^= b;          \
-               c -= rot(b, 14); \
-               a ^= c;          \
-               a -= rot(c, 11); \
-               b ^= a;          \
-               b -= rot(a, 25); \
-               c ^= b;          \
-               c -= rot(b, 16); \
-               a ^= c;          \
-               a -= rot(c, 4);  \
-               b ^= a;          \
-               b -= rot(a, 14); \
-               c ^= b;          \
-               c -= rot(b, 24); \
+#define final(a, b, c)             \
+       {                          \
+               (c) ^= (b);        \
+               (c) -= rot(b, 14); \
+               (a) ^= (c);        \
+               (a) -= rot(c, 11); \
+               (b) ^= (a);        \
+               (b) -= rot(a, 25); \
+               (c) ^= (b);        \
+               (c) -= rot(b, 16); \
+               (a) ^= (c);        \
+               (a) -= rot(c, 4);  \
+               (b) ^= (a);        \
+               (b) -= rot(a, 14); \
+               (c) ^= (b);        \
+               (c) -= rot(b, 24); \
        }
 
 /*
index 11f4e5193e8cb6e8681fd6dd0f1253d8b811a81f..ebfe153c276c593870df422ea5ea0c9ed6cad81a 100644 (file)
@@ -46,7 +46,7 @@ static int config_entry_handler_filter(struct handler_filter_args *args,
        }
 
        if (args->section) {
-               if (strcmp(args->section, section)) {
+               if (strcmp(args->section, section) != 0) {
                        goto end;
                }
        }
index 3b42438d8826a1d2e246cf2c403a92107f699d79..f520736b42b10c580f28a46b09238bdf028da283 100644 (file)
@@ -783,7 +783,12 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                health_code_update();
 
-               ret_pipe_write = lttng_pipe_write(stream_pipe, &new_stream, sizeof(new_stream));
+               ret_pipe_write =
+                       lttng_pipe_write(stream_pipe, &new_stream, sizeof(new_stream)); /* NOLINT
+                                                                                          sizeof
+                                                                                          used on a
+                                                                                          pointer.
+                                                                                        */
                if (ret_pipe_write < 0) {
                        ERR("Consumer write %s stream to pipe %d",
                            new_stream->metadata_flag ? "metadata" : "data",
index daf0dc005edf204f649bd8fe57a613018fe5d02f..d1b6744d9eac938b946e694a926d32f0ebedc736 100644 (file)
@@ -540,7 +540,7 @@ lttng_kernel_probe_location_symbol_is_equal(const struct lttng_kernel_probe_loca
 
        LTTNG_ASSERT(a->symbol_name);
        LTTNG_ASSERT(b->symbol_name);
-       if (strcmp(a->symbol_name, b->symbol_name)) {
+       if (strcmp(a->symbol_name, b->symbol_name) != 0) {
                goto end;
        }
 
index 108686042db85ae66fb46b9383754be8ac7c5bdc..be1db0250ac02bae4af5cba422c52c3cb41a8132 100644 (file)
@@ -33,7 +33,7 @@
 #define NOTE_STAPSDT_SECTION_NAME      ".note.stapsdt"
 #define NOTE_STAPSDT_NAME              "stapsdt"
 #define NOTE_STAPSDT_TYPE              3
-#define MAX_SECTION_DATA_SIZE          512 * 1024 * 1024
+#define MAX_SECTION_DATA_SIZE          (512 * 1024 * 1024)
 
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define NATIVE_ELF_ENDIANNESS ELFDATA2LSB
 #define NATIVE_ELF_ENDIANNESS ELFDATA2MSB
 #endif
 
-#define next_4bytes_boundary(x) (typeof(x)) ((((uint64_t) x) + 3) & ~0x03)
-
-#define bswap(x)                                   \
-       do {                                       \
-               switch (sizeof(x)) {               \
-               case 8:                            \
-                       x = be64toh((uint64_t) x); \
-                       break;                     \
-               case 4:                            \
-                       x = be32toh((uint32_t) x); \
-                       break;                     \
-               case 2:                            \
-                       x = be16toh((uint16_t) x); \
-                       break;                     \
-               case 1:                            \
-                       break;                     \
-               default:                           \
-                       abort();                   \
-               }                                  \
+#define next_4bytes_boundary(x) (typeof(x)) ((((uint64_t) (x)) + 3) & ~0x03)
+
+#define bswap(x)                                       \
+       do {                                           \
+               switch (sizeof(x)) {                   \
+               case 8:                                \
+                       (x) = be64toh((uint64_t) (x)); \
+                       break;                         \
+               case 4:                                \
+                       (x) = be32toh((uint32_t) (x)); \
+                       break;                         \
+               case 2:                                \
+                       (x) = be16toh((uint16_t) (x)); \
+                       break;                         \
+               case 1:                                \
+                       break;                         \
+               default:                               \
+                       abort();                       \
+               }                                      \
        } while (0)
 
 #define bswap_shdr(shdr)                    \
                (dst_ehdr).e_shstrndx = (src_ehdr).e_shstrndx;   \
        } while (0)
 
-#define copy_sym(src_sym, dst_sym)                   \
-       do {                                         \
-               dst_sym.st_name = src_sym.st_name;   \
-               dst_sym.st_info = src_sym.st_info;   \
-               dst_sym.st_other = src_sym.st_other; \
-               dst_sym.st_shndx = src_sym.st_shndx; \
-               dst_sym.st_value = src_sym.st_value; \
-               dst_sym.st_size = src_sym.st_size;   \
+#define copy_sym(src_sym, dst_sym)                       \
+       do {                                             \
+               (dst_sym).st_name = (src_sym).st_name;   \
+               (dst_sym).st_info = (src_sym).st_info;   \
+               (dst_sym).st_other = (src_sym).st_other; \
+               (dst_sym).st_shndx = (src_sym).st_shndx; \
+               (dst_sym).st_value = (src_sym).st_value; \
+               (dst_sym).st_size = (src_sym).st_size;   \
        } while (0)
 
 #ifndef ELFCLASSNUM
index 2ffb75483240ebfafd6b7278b90f615081d4ef87..4e13cb4a7c9c4576d1cc01f89a4599f2c6342297 100644 (file)
@@ -27,7 +27,7 @@ struct lttng_kernel_abi_old_perf_counter_ctx {
 
 /* Event/Channel context */
 #define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1  16
-#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING2  LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32
+#define LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING2  ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
 struct lttng_kernel_abi_old_context {
        enum lttng_kernel_abi_context_type ctx;
        char padding[LTTNG_KERNEL_ABI_OLD_CONTEXT_PADDING1];
@@ -61,7 +61,7 @@ struct lttng_kernel_abi_old_function {
 };
 
 #define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING1    16
-#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING2    LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32
+#define LTTNG_KERNEL_ABI_OLD_EVENT_PADDING2    ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
 struct lttng_kernel_abi_old_event {
        char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
        enum lttng_kernel_abi_instrumentation instrumentation;
@@ -85,7 +85,7 @@ struct lttng_kernel_abi_old_tracer_version {
 /*
  * kernel channel
  */
-#define LTTNG_KERNEL_ABI_OLD_CHANNEL_PADDING1 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_KERNEL_ABI_OLD_CHANNEL_PADDING1 ((LTTNG_SYMBOL_NAME_LEN + 32))
 struct lttng_kernel_abi_old_channel {
        int overwrite;                      /* 1: overwrite, 0: discard */
        uint64_t subbuf_size;               /* bytes */
index 6b1f7985db589fd847df9f651a404be55aa06f1e..1363ba584c21049bf4a95c205426c18fc84554a4 100644 (file)
@@ -86,7 +86,7 @@ struct lttng_kernel_abi_perf_counter_ctx {
 
 /* Event/Channel context */
 #define LTTNG_KERNEL_ABI_CONTEXT_PADDING1  16
-#define LTTNG_KERNEL_ABI_CONTEXT_PADDING2  LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32
+#define LTTNG_KERNEL_ABI_CONTEXT_PADDING2  ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
 struct lttng_kernel_abi_context {
        enum lttng_kernel_abi_context_type ctx;
        char padding[LTTNG_KERNEL_ABI_CONTEXT_PADDING1];
@@ -159,7 +159,7 @@ struct lttng_kernel_abi_function {
 } LTTNG_PACKED;
 
 #define LTTNG_KERNEL_ABI_EVENT_PADDING1    8
-#define LTTNG_KERNEL_ABI_EVENT_PADDING2    LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32
+#define LTTNG_KERNEL_ABI_EVENT_PADDING2    ((LTTNG_KERNEL_ABI_SYM_NAME_LEN + 32))
 struct lttng_kernel_abi_event {
        char name[LTTNG_KERNEL_ABI_SYM_NAME_LEN];
        enum lttng_kernel_abi_instrumentation instrumentation;
@@ -281,7 +281,7 @@ struct lttng_kernel_abi_syscall_mask {
 /*
  * kernel channel
  */
-#define LTTNG_KERNEL_ABI_CHANNEL_PADDING1 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_KERNEL_ABI_CHANNEL_PADDING1 ((LTTNG_SYMBOL_NAME_LEN + 32))
 struct lttng_kernel_abi_channel {
        uint64_t subbuf_size;               /* bytes */
        uint64_t num_subbuf;                /* power of 2 */
index cfe6eb5289d637ef1f1d1ddafe1b2f808a78535a..031d2a0564da7da1da1b999a7bac47018c8c50bc 100644 (file)
@@ -39,7 +39,7 @@
  * memory using malloc(), we must use generic accessors for compat in order to
  * *not* use a function to access members and not the variable name.
  */
-#define LTTNG_REF(x) ((typeof(*x) *)(x))
+#define LTTNG_REF(x) ((typeof(*(x)) *) (x))
 
 #ifdef NDEBUG
 /*
@@ -88,7 +88,7 @@ template<typename T>
 T *zmalloc()
 {
        static_assert (can_malloc<T>::value, "type can be malloc'ed");
-       return (T *) zmalloc_internal(sizeof(T));
+       return (T *) zmalloc_internal(sizeof(T)); /* NOLINT sizeof potentially used on a pointer. */
 }
 
 /*
@@ -111,7 +111,7 @@ template<typename T>
 T *calloc(size_t nmemb)
 {
        static_assert (can_malloc<T>::value, "type can be malloc'ed");
-       return (T *) zmalloc_internal(nmemb * sizeof(T));
+       return (T *) zmalloc_internal(nmemb * sizeof(T)); /* NOLINT sizeof potentially used on a pointer. */
 }
 
 /*
@@ -243,7 +243,7 @@ void *memmove(T *d, const U *s, size_t n) = delete;
 
 #define member_sizeof(type, field)     sizeof(((type *) 0)->field)
 
-#define ASSERT_LOCKED(lock) LTTNG_ASSERT(pthread_mutex_trylock(&lock))
+#define ASSERT_LOCKED(lock)         LTTNG_ASSERT(pthread_mutex_trylock(&(lock)))
 #define ASSERT_RCU_READ_LOCKED(lock) LTTNG_ASSERT(rcu_read_ongoing())
 
 /* Attribute suitable to tag functions as having printf()-like arguments. */
index f34c5991fdfd4be070a1362d1968c4b3b88d2526..4bb774739a8aa870c03aa328040690e9a725e3a8 100644 (file)
 /*
  * Initialize an optional field as 'set' with a given value.
  */
-#define LTTNG_OPTIONAL_INIT_VALUE(val) { .is_set = 1, .value = val }
+#define LTTNG_OPTIONAL_INIT_VALUE(val)      \
+       {                                   \
+               .is_set = 1, .value = (val) \
+       }
 
 /* Set the value of an optional field. */
 #define LTTNG_OPTIONAL_SET(field_ptr, val)     \
index d253ee0544e5317183b1a01becfc87a11cbd5ed5..7651470c8c57336f5f2c995c886d60f02e143e78 100644 (file)
@@ -177,30 +177,31 @@ struct run_as_ret {
        bool _error;
 } LTTNG_PACKED;
 
-#define COMMAND_IN_FDS(data_ptr)                                                         \
-       ({                                                                               \
-               int *fds = NULL;                                                         \
-               if (command_properties[data_ptr->cmd].in_fds_offset != -1) {             \
-                       fds = (int *) ((char *) data_ptr +                               \
-                                      command_properties[data_ptr->cmd].in_fds_offset); \
-               }                                                                        \
-               fds;                                                                     \
+#define COMMAND_IN_FDS(data_ptr)                                                           \
+       ({                                                                                 \
+               int *fds = NULL;                                                           \
+               if (command_properties[(data_ptr)->cmd].in_fds_offset != -1) {             \
+                       fds = (int *) ((char *) (data_ptr) +                               \
+                                      command_properties[(data_ptr)->cmd].in_fds_offset); \
+               }                                                                          \
+               fds;                                                                       \
        })
 
-#define COMMAND_OUT_FDS(cmd, ret_ptr)                                                              \
-       ({                                                                                         \
-               int *fds = NULL;                                                                   \
-               if (command_properties[cmd].out_fds_offset != -1) {                                \
-                       fds = (int *) ((char *) ret_ptr + command_properties[cmd].out_fds_offset); \
-               }                                                                                  \
-               fds;                                                                               \
+#define COMMAND_OUT_FDS(cmd, ret_ptr)                                           \
+       ({                                                                      \
+               int *fds = NULL;                                                \
+               if (command_properties[cmd].out_fds_offset != -1) {             \
+                       fds = (int *) ((char *) (ret_ptr) +                     \
+                                      command_properties[cmd].out_fds_offset); \
+               }                                                               \
+               fds;                                                            \
        })
 
-#define COMMAND_IN_FD_COUNT(data_ptr) ({ command_properties[data_ptr->cmd].in_fd_count; })
+#define COMMAND_IN_FD_COUNT(data_ptr) ({ command_properties[(data_ptr)->cmd].in_fd_count; })
 
 #define COMMAND_OUT_FD_COUNT(cmd) ({ command_properties[cmd].out_fd_count; })
 
-#define COMMAND_USE_CWD_FD(data_ptr) command_properties[data_ptr->cmd].use_cwd_fd
+#define COMMAND_USE_CWD_FD(data_ptr) command_properties[(data_ptr)->cmd].use_cwd_fd
 
 struct run_as_command_properties {
        /* Set to -1 when not applicable. */
index 2be4224f950167675df9b46e155fb4a34ff44270..d48ebc6be3bc22bca29711a28e3afabb9f5ecb1b 100644 (file)
@@ -1545,7 +1545,7 @@ static int lttng_trace_chunk_move_to_completed_post_release(struct lttng_trace_c
         * the creation of the next chunk. This happens if a rotation is
         * performed while tracing is stopped.
         */
-       if (!trace_chunk->path || strcmp(trace_chunk->path, DEFAULT_CHUNK_TMP_OLD_DIRECTORY)) {
+       if (!trace_chunk->path || strcmp(trace_chunk->path, DEFAULT_CHUNK_TMP_OLD_DIRECTORY) != 0) {
                status = lttng_trace_chunk_rename_path_no_lock(trace_chunk,
                                                               DEFAULT_CHUNK_TMP_OLD_DIRECTORY);
                if (status != LTTNG_TRACE_CHUNK_STATUS_OK) {
index 1f292a3f02981653fd90682bc88e6733c45d98b4..dba84293dc216f1d28e3f44239149032326ac8f3 100644 (file)
@@ -39,11 +39,11 @@ struct process_attr_tracker_value_comm {
        ((as_type) (std::is_signed<as_type>::value ? (value_ptr)->u._signed : \
                                                     (value_ptr)->u._unsigned))
 
-#define SET_INTEGRAL_COMM_VALUE(comm_value, val)                                     \
-       if (std::is_signed<typeof(val)>::value) {                                    \
-               (comm_value)->u._signed = (typeof((comm_value)->u._signed)) val;     \
-       } else {                                                                     \
-               (comm_value)->u._unsigned = (typeof((comm_value)->u._unsigned)) val; \
+#define SET_INTEGRAL_COMM_VALUE(comm_value, val)                                       \
+       if (std::is_signed<typeof(val)>::value) {                                      \
+               (comm_value)->u._signed = (typeof((comm_value)->u._signed)) (val);     \
+       } else {                                                                       \
+               (comm_value)->u._unsigned = (typeof((comm_value)->u._unsigned)) (val); \
        }
 
 static inline bool is_virtual_process_attr(enum lttng_process_attr process_attr)
index d121ecd9f6799b62e1236a56b17d4d9f4110ba85..abbf71679690c0b7f95e2f3f44db744cf05ef413 100644 (file)
@@ -57,15 +57,13 @@ public:
  */
 class read_lock_guard {
 public:
-       read_lock_guard() : _guard(_lock)
-       {
-       }
+       read_lock_guard() = default;
 
        read_lock_guard(const read_lock_guard &) = delete;
 
 private:
        details::read_lock _lock;
-       std::lock_guard<details::read_lock> _guard;
+       std::lock_guard<details::read_lock> _guard{_lock};
 };
 
 using unique_read_lock = std::unique_lock<details::read_lock>;
index 8be0e07247e4333395e4ca54b78887b9648a5d84..4a9c31812b75909769121c12edcf60e1571d6f6f 100644 (file)
@@ -236,13 +236,13 @@ lttng_userspace_probe_location_function_is_equal(const struct lttng_userspace_pr
 
        LTTNG_ASSERT(a->function_name);
        LTTNG_ASSERT(b->function_name);
-       if (strcmp(a->function_name, b->function_name)) {
+       if (strcmp(a->function_name, b->function_name) != 0) {
                goto end;
        }
 
        LTTNG_ASSERT(a->binary_path);
        LTTNG_ASSERT(b->binary_path);
-       if (strcmp(a->binary_path, b->binary_path)) {
+       if (strcmp(a->binary_path, b->binary_path) != 0) {
                goto end;
        }
 
@@ -356,19 +356,19 @@ lttng_userspace_probe_location_tracepoint_is_equal(const struct lttng_userspace_
 
        LTTNG_ASSERT(a->probe_name);
        LTTNG_ASSERT(b->probe_name);
-       if (strcmp(a->probe_name, b->probe_name)) {
+       if (strcmp(a->probe_name, b->probe_name) != 0) {
                goto end;
        }
 
        LTTNG_ASSERT(a->provider_name);
        LTTNG_ASSERT(b->provider_name);
-       if (strcmp(a->provider_name, b->provider_name)) {
+       if (strcmp(a->provider_name, b->provider_name) != 0) {
                goto end;
        }
 
        LTTNG_ASSERT(a->binary_path);
        LTTNG_ASSERT(b->binary_path);
-       if (strcmp(a->binary_path, b->binary_path)) {
+       if (strcmp(a->binary_path, b->binary_path) != 0) {
                goto end;
        }
 
index 5339553cb5fd7fb7b54d61f8b74814f21e1faf6c..d0b39a887b467f1098397ba53213a69bd670067e 100644 (file)
@@ -167,7 +167,8 @@ static int send_stream_to_thread(struct lttng_consumer_stream *stream,
        stream->globally_visible = 1;
        cds_list_del_init(&stream->send_node);
 
-       ret = lttng_pipe_write(stream_pipe, &stream, sizeof(stream));
+       ret = lttng_pipe_write(stream_pipe, &stream, sizeof(stream)); /* NOLINT sizeof used on a
+                                                                        pointer. */
        if (ret < 0) {
                ERR("Consumer write %s stream to pipe %d",
                    stream->metadata_flag ? "metadata" : "data",
index b9311a07ef2051bfeb6243e071f381aef3f90379..15a699e24f3fd63837edbc6b11dccfa3ac5b1a10 100644 (file)
 #include <string.h>
 #include <unistd.h>
 
-#define COPY_DOMAIN_PACKED(dst, src)                             \
-       do {                                                     \
-               struct lttng_domain _tmp_domain;                 \
-                                                                 \
-               lttng_ctl_copy_lttng_domain(&_tmp_domain, &src); \
-               dst = _tmp_domain;                               \
+#define COPY_DOMAIN_PACKED(dst, src)                               \
+       do {                                                       \
+               struct lttng_domain _tmp_domain;                   \
+                                                                   \
+               lttng_ctl_copy_lttng_domain(&_tmp_domain, &(src)); \
+               (dst) = _tmp_domain;                               \
        } while (0)
 
 /* Socket to session daemon for communication */
index 6b7469fdf75c82412d9f15d39044e0ce2cd5551a..a31b5a1893643abe67cda41de44c1fd2ebc82816 100644 (file)
@@ -465,35 +465,36 @@ end:
        return type;
 }
 
-#define DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(value_type_name, value_type, expected_value_type) \
-       enum lttng_process_attr_values_status                                                     \
-               lttng_process_attr_values_get_##value_type_name##_at_index(                       \
-                       const struct lttng_process_attr_values *values,                           \
-                       unsigned int index,                                                       \
-                       value_type *out_value)                                                    \
-       {                                                                                         \
-               enum lttng_process_attr_values_status status =                                    \
-                       LTTNG_PROCESS_ATTR_VALUES_STATUS_OK;                                      \
-               const struct process_attr_value *value;                                           \
-                                                                                                  \
-               if (!values) {                                                                    \
-                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;                        \
-                       goto end;                                                                 \
-               }                                                                                 \
-                                                                                                  \
-               if (_lttng_process_attr_values_get_count(values) <= index) {                      \
-                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;                        \
-                       goto end;                                                                 \
-               }                                                                                 \
-                                                                                                  \
-               value = lttng_process_attr_tracker_values_get_at_index(values, index);            \
-               if (value->type != LTTNG_PROCESS_ATTR_VALUE_TYPE_##expected_value_type) {         \
-                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE;                   \
-                       goto end;                                                                 \
-               }                                                                                 \
-               *out_value = value->value.value_type_name;                                        \
-       end:                                                                                      \
-               return status;                                                                    \
+#define DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(value_type_name, value_type, expected_value_type)  \
+       enum lttng_process_attr_values_status                                                      \
+               lttng_process_attr_values_get_##value_type_name##_at_index(                        \
+                       const struct lttng_process_attr_values *values,                            \
+                       unsigned int index,                                                        \
+                       value_type *out_value) /* NOLINT clang-tidy sees value_type as a value and \
+                                                 adds parentheses */                              \
+       {                                                                                          \
+               enum lttng_process_attr_values_status status =                                     \
+                       LTTNG_PROCESS_ATTR_VALUES_STATUS_OK;                                       \
+               const struct process_attr_value *value;                                            \
+                                                                                                   \
+               if (!values) {                                                                     \
+                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;                         \
+                       goto end;                                                                  \
+               }                                                                                  \
+                                                                                                   \
+               if (_lttng_process_attr_values_get_count(values) <= index) {                       \
+                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID;                         \
+                       goto end;                                                                  \
+               }                                                                                  \
+                                                                                                   \
+               value = lttng_process_attr_tracker_values_get_at_index(values, index);             \
+               if (value->type != LTTNG_PROCESS_ATTR_VALUE_TYPE_##expected_value_type) {          \
+                       status = LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE;                    \
+                       goto end;                                                                  \
+               }                                                                                  \
+               *out_value = value->value.value_type_name;                                         \
+       end:                                                                                       \
+               return status;                                                                     \
        }
 
 DEFINE_LTTNG_PROCESS_ATTR_VALUES_GETTER(pid, pid_t, PID);
diff --git a/src/vendor/.clang-tidy b/src/vendor/.clang-tidy
new file mode 100644 (file)
index 0000000..91aebac
--- /dev/null
@@ -0,0 +1 @@
+Checks: '-*,llvm-twine-local'
index 3d8aec46ddbd8b7feb5cf90dbc75a43298384bfc..11e9206964b80974dffbabbf1e77d30afa61eb3f 100644 (file)
@@ -173,11 +173,11 @@ int main(int argc, char **argv)
                const char *trigger_name = NULL;
 
                lttng_trigger_get_name(trigger, &trigger_name);
-               if (strcmp(trigger_name, expected_trigger_name)) {
+               if (strcmp(trigger_name, expected_trigger_name) != 0) {
                        /* Might match the end event trigger */
                        if (end_trigger_name != NULL &&
                                        strcmp(trigger_name,
-                                                       end_trigger_name)) {
+                                                       end_trigger_name) != 0) {
                                continue;
                        }
                }
index 9e40c83c2ab5499893a8139f74468b4b014d4730..cdc622a04e463e30dbdd6971bd3e6a03d55f39ab 100644 (file)
@@ -704,7 +704,7 @@ skip_write:
                        break;
                }
 
-               if (strcmp(file_contents, read_buf)) {
+               if (strcmp(file_contents, read_buf) != 0) {
                        content_ok = false;
                        diag("File content doesn't match the expectated string");
                        (void) close(fd);
index 361dbe36a7edf4e0c7b304b81ed30e499cd9211e..ea02c2ec2700ddcebc3b42f810fea9b7ab5b6a9a 100644 (file)
@@ -27,7 +27,7 @@
 
 #define HIGH_FD_COUNT          LTTCOMM_MAX_SEND_FDS
 #define MESSAGE_COUNT          4
-#define LARGE_PAYLOAD_SIZE     4 * 1024
+#define LARGE_PAYLOAD_SIZE     (4 * 1024)
 #define LARGE_PAYLOAD_RECV_SIZE 100
 
 static const int TEST_COUNT = 37;
This page took 0.063148 seconds and 4 git commands to generate.