Fix: ctf-writer: field_type_common_has_known_id always returns true
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 28 Oct 2019 01:52:47 +0000 (21:52 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 30 Oct 2019 19:14:53 +0000 (15:14 -0400)
I get this when building with gcc:

      CC       event.lo
    In file included from /home/simark/src/babeltrace/src/ctf-writer/event.h:42,
                     from /home/simark/src/babeltrace/src/ctf-writer/event.c:45:
    /home/simark/src/babeltrace/src/ctf-writer/fields.h: In function ‘field_type_common_has_known_id’:
    /home/simark/src/babeltrace/src/ctf-writer/fields.h:291:53: error: logical ‘or’ of collectively exhaustive tests is always true [-Werror=logical-op]
      291 |  return (int) ft->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN ||
          |

Indeed, the logical expression there always returns true.  Change the ||
for a &&, which is what I think was meant here.

Change-Id: I0dbfb074e97b96b8f727f85628a544c412d2221c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2272
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
configure.ac
src/ctf-writer/fields.h

index 120fb28ca631d6b1011b71d0a4e37747187a7495..b9edbf543c041c575ac8c58d208463e7a6d0ed4e 100644 (file)
@@ -675,7 +675,6 @@ AX_COMPILER_FLAGS(
                -Wno-missing-prototypes dnl
                -Wno-missing-declarations dnl
                -Wno-redundant-decls dnl
-               -Wno-logical-op dnl
                -Wno-double-promotion dnl
                -Wno-cast-align dnl
        ])
index bab2e581697e8c9031de0fcdb3900d8d720b00b9..5ff9ceb7852a0e87bca417b6a6e40bd5d4df0b0d 100644 (file)
@@ -288,7 +288,7 @@ BT_ASSERT_DBG_FUNC
 static inline bool field_type_common_has_known_id(
                struct bt_ctf_field_type_common *ft)
 {
-       return (int) ft->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN ||
+       return (int) ft->id > BT_CTF_FIELD_TYPE_ID_UNKNOWN &&
                (int) ft->id < BT_CTF_FIELD_TYPE_ID_NR;
 }
 
This page took 0.02618 seconds and 4 git commands to generate.