configure: add '-Wlogical-op' to warning flags
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 7 Mar 2022 20:59:30 +0000 (15:59 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 15 Mar 2022 21:00:15 +0000 (17:00 -0400)
Change-Id: I0516add62151b22352f96d1e62871a013b8fa6f3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
src/bin/lttng-relayd/main.cpp
src/bin/lttng-sessiond/rotation-thread.cpp
src/common/macros.h
src/common/unix.cpp

index 5a63255c4549435a3594c08d996642ba73b130ea..8ca893f7512698fd159cbbc6f46b26c7f21fb702 100644 (file)
@@ -61,6 +61,7 @@ m4_define([WARN_FLAGS_COMMON_LIST], [ dnl
   -Wall dnl
   -Wnull-dereference dnl
   -Wundef dnl
+  -Wlogical-op dnl
   dnl We currently get this warning when building with Clang:
   dnl
   dnl /usr/include/setjmp.h:54:12: error: declaration of built-in function '__sigsetjmp' requires the declaration of the 'jmp_buf' type, commonly provided in the header <setjmp.h>. [-Werror,-Wincomplete-setjmp-declaration]
index 33684addda431e1f70f7a9d767b26bd9dfab8ea5..72bf30b7ec10589ce797b83af494bc6f7e782e78 100644 (file)
@@ -3405,7 +3405,10 @@ static enum relay_connection_status relay_process_control_receive_payload(
                        reception_buffer->data + state->received,
                        state->left_to_receive, MSG_DONTWAIT);
        if (ret < 0) {
+               DIAGNOSTIC_PUSH
+               DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno != EAGAIN && errno != EWOULDBLOCK) {
+               DIAGNOSTIC_POP
                        PERROR("Unable to receive command payload on sock %d",
                                        conn->sock->fd);
                        status = RELAY_CONNECTION_STATUS_ERROR;
@@ -3478,7 +3481,10 @@ static enum relay_connection_status relay_process_control_receive_header(
                        reception_buffer->data + state->received,
                        state->left_to_receive, MSG_DONTWAIT);
        if (ret < 0) {
+               DIAGNOSTIC_PUSH
+               DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno != EAGAIN && errno != EWOULDBLOCK) {
+               DIAGNOSTIC_POP
                        PERROR("Unable to receive control command header on sock %d",
                                        conn->sock->fd);
                        status = RELAY_CONNECTION_STATUS_ERROR;
@@ -3589,7 +3595,10 @@ static enum relay_connection_status relay_process_data_receive_header(
                        state->header_reception_buffer + state->received,
                        state->left_to_receive, MSG_DONTWAIT);
        if (ret < 0) {
+               DIAGNOSTIC_PUSH
+               DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno != EAGAIN && errno != EWOULDBLOCK) {
+               DIAGNOSTIC_POP
                        PERROR("Unable to receive data header on sock %d", conn->sock->fd);
                        status = RELAY_CONNECTION_STATUS_ERROR;
                }
@@ -3716,7 +3725,10 @@ static enum relay_connection_status relay_process_data_receive_payload(
                ret = conn->sock->ops->recvmsg(conn->sock, data_buffer,
                                recv_size, MSG_DONTWAIT);
                if (ret < 0) {
+                       DIAGNOSTIC_PUSH
+                       DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno != EAGAIN && errno != EWOULDBLOCK) {
+                       DIAGNOSTIC_POP
                                PERROR("Socket %d error", conn->sock->fd);
                                status = RELAY_CONNECTION_STATUS_ERROR;
                        }
index a2b92a858ae612254cafa8d8a13d05558c503bab..473138cf8861d16871cc6b2f250bf1fb6b911229 100644 (file)
@@ -215,7 +215,10 @@ void rotation_thread_enqueue_job(struct rotation_thread_timer_queue *queue,
                 * the job will be processed when the rotation_thread catches
                 * up.
                 */
+               DIAGNOSTIC_PUSH
+               DIAGNOSTIC_IGNORE_LOGICAL_OP
                if (errno == EAGAIN || errno == EWOULDBLOCK) {
+               DIAGNOSTIC_POP
                        /*
                         * Not an error, but would be surprising and indicate
                         * that the rotation thread can't keep up with the
index 43a4d692b80fbad0a5a42f03f2ceffc3450c63a1..3e175735083a9df7d390cdad5cc5fa43a20c4c26 100644 (file)
@@ -94,12 +94,15 @@ void *zmalloc(size_t len)
 # define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT
 # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
        _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
+# define DIAGNOSTIC_IGNORE_LOGICAL_OP
 #else
   /* GCC */
 # define DIAGNOSTIC_IGNORE_SUGGEST_ATTRIBUTE_FORMAT \
        _Pragma("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
 # define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
        _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
+# define DIAGNOSTIC_IGNORE_LOGICAL_OP \
+       _Pragma("GCC diagnostic ignored \"-Wlogical-op\"")
 #endif
 
 /* Used to make specific C++ functions to C code. */
index 091587f48f0edbd31ebdb4d24f6714abba19b131..beeb69572f8e48902f5dd2cb235ddc05bb683d18 100644 (file)
@@ -239,8 +239,11 @@ retry:
                        /*
                         * We consider EPIPE and EAGAIN/EWOULDBLOCK as expected.
                         */
+                       DIAGNOSTIC_PUSH
+                       DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno == EAGAIN || errno == EWOULDBLOCK ||
                                        errno == EPIPE) {
+                       DIAGNOSTIC_POP
                                /*
                                 * Nothing was recv.
                                 */
@@ -343,8 +346,11 @@ retry:
                        /*
                         * We consider EPIPE and EAGAIN/EWOULDBLOCK as expected.
                         */
+                       DIAGNOSTIC_PUSH
+                       DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno == EAGAIN || errno == EWOULDBLOCK ||
                                        errno == EPIPE) {
+                       DIAGNOSTIC_POP
                                /*
                                 * This can happen in non blocking mode.
                                 * Nothing was sent.
@@ -569,7 +575,10 @@ retry:
                        /*
                         * We consider EPIPE and EAGAIN/EWOULDBLOCK as expected.
                         */
+                       DIAGNOSTIC_PUSH
+                       DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno == EAGAIN || errno == EWOULDBLOCK) {
+                       DIAGNOSTIC_POP
                                /*
                                 * This can happen in non blocking mode.
                                 * Nothing was sent.
@@ -883,7 +892,10 @@ retry:
                        /*
                         * We consider EPIPE and EAGAIN/EWOULDBLOCK as expected.
                         */
+                       DIAGNOSTIC_PUSH
+                       DIAGNOSTIC_IGNORE_LOGICAL_OP
                        if (errno == EAGAIN || errno == EWOULDBLOCK) {
+                       DIAGNOSTIC_POP
                                /*
                                 * This can happen in non blocking mode.
                                 * Nothing was recv.
This page took 0.030491 seconds and 4 git commands to generate.