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 18:10:51 +0000 (14:10 -0400)
commita153db4890d7c3c1199acb5448ac2a3b21c90f45
treea49edfa86afe9e3daa4c3652e4f3808afd8ede49
parentf4811b4fbd18dc912ed4cb2f8a210c3c46203dfe
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.024378 seconds and 4 git commands to generate.