Fix: ctf: assert that name is not NULL in warn_meaningless_field()
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 4 Sep 2019 16:13:39 +0000 (12:13 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Sep 2019 19:26:45 +0000 (15:26 -0400)
commit74ad166b12f92591f5ba5e812227507c6159586d
tree7831fa035dd27efd53ec1eb9fd913ae6b46e705d
parent48cb851a8f66c8f0d7e9db086c3c9b5c6172efb9
Fix: ctf: assert that name is not NULL in warn_meaningless_field()

gcc 9.1 reports that warn_meaningless_field's `name` is sometimes
NULL when it is inlined in warn_meaningless_fields(), itself
inlined in ctf_trace_class_warn_meaningless_header_fields() at
line 131.

The the only call site using a `NULL` name will have
`fc->type == CTF_FIELD_CLASS_TYPE_STRUCT`.

Add a `BT_ASSERT(name)` to warn_meaningless_field() and a comment
indicating that `name` is guaranteed to be non-NULL whenever the field
class is not a structure.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I323b9f390f80dbd898a69664082fd07d5cc2fc86
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2000
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/common/metadata/ctf-meta-warn-meaningless-header-fields.c
This page took 0.025383 seconds and 4 git commands to generate.