`ctf` plugin: Use CTF_SCOPE_PACKET_UNKNOWN in place of -1
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 23 Jul 2019 19:36:30 +0000 (15:36 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 7 Aug 2019 18:05:20 +0000 (14:05 -0400)
commitaf06b405657bf79cfa9a229b8495c12dcaba5d94
tree6dab48270de600acb721d91bc681bcb8e7a20865
parenta99db7a164a54d9efc1ebe349f18c0db3d657577
`ctf` plugin: Use CTF_SCOPE_PACKET_UNKNOWN in place of -1

Seen on clang-3.9, 4.0 and clang-1001.0.46.4.

  Comparison of constant -1 with expression of type 'enum *****'
  is always false [-Wtautological-constant-out-of-range-compare]

Note that the enum underlying type is implementation defined and left to
the choice of the compiler by the standard [1] (6.7.2.2 4). Most
compiler default to unsigned int. The use of -1 is not a problem per see
since wrap around of unsigned int behaviour is not undefined. Using -1
is the equivalent of assigning UINT_MAX here. This warning was removed
for later clang for these specific cases since the effect of always being
false is erroneous.

Still, it make more sense to use a specific enum for such case instead
of relying on the compiler type.

get_root_scope_from_absolute_pathstr depends on the fact that
CTF_SCOPE_PACKET_HEADER is 0 to work.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ie13f6c4dbab5038eb7a7fea6d58ce4451bc551d1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1762
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/plugins/ctf/common/metadata/ctf-meta-resolve.c
src/plugins/ctf/common/metadata/ctf-meta.h
This page took 0.026128 seconds and 4 git commands to generate.