Fix: remove underscores from CTF IR field names at the source
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 16 Sep 2017 18:20:40 +0000 (14:20 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 17 Sep 2017 17:58:38 +0000 (13:58 -0400)
commit6acddae3723c0bf8ec27feb18ad2dde7aa073fd3
treece8885d3d26d0af65f1876afbefbb260108155b2
parent87b768aafe130a9c6d3438242cc519690836c2e7
Fix: remove underscores from CTF IR field names at the source

The CTF spec. states that if a structure field type's field name or a
variant field type's choice name starts with `_` in the TSDL metadata
stream, then this underscore should be removed from the effective
field/choice name.

This patch applies this at the source (src.ctf plugin), in the TSDL
metadata text to CTF IR objects visitor. To do so it must also remove
such underscore characters from the components of field references (tag
and length names).

The behaviour is removed from plugins/text/pretty/print.c which did it
at the output level.

A potential issue is that a variant field type can have its enumeration
tag field type contain mappings which still have the underscore
prefixes. To circumvent this, we add the field names and the field names
with underscores to the field types's hash tables of field names to
field indexes, so that `field_name` and `_field_name` refer to the same
index within the structure/variant field type, for example.

When serializing the structure/variant field types to TSDL (for the CTF
writer API), we prefix each field with `_` if it's a CTF identifier so
as to avoid conflicts. We also remove the check that structure/variant
field type field names must not be CTF identifiers since it is safe to
serialize them now.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
lib/ctf-ir/field-types.c
plugins/ctf/common/metadata/visitor-generate-ir.c
plugins/text/pretty/print.c
This page took 0.024789 seconds and 4 git commands to generate.