From c23c2d0d9a23d99f631375cde28e395ec3c2aecb Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 4 Dec 2013 16:29:04 +0100 Subject: [PATCH] Clarity variant vs enum mapping requirements Signed-off-by: Mathieu Desnoyers --- common-trace-format-specification.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common-trace-format-specification.txt b/common-trace-format-specification.txt index ecdd26f..7d013d0 100644 --- a/common-trace-format-specification.txt +++ b/common-trace-format-specification.txt @@ -358,10 +358,10 @@ ranges (or single values) to strings. Instead of being limited to simple "value -> string" mappings, these enumerations map "[ start_value ... end_value ] -> string", which map inclusive ranges of values to strings. An enumeration from the C language can be represented in -this format by having the same start_value and end_value for each element, which -is in fact a range of size 1. This single-value range is supported without -repeating the start and end values with the value = string declaration. -Enumerations need to contain at least one entry. +this format by having the same start_value and end_value for each +mapping, which is in fact a range of size 1. This single-value range is +supported without repeating the start and end values with the value = +string declaration. Enumerations need to contain at least one entry. enum name : integer_type { somestring = start_value1 ... end_value1, @@ -462,12 +462,15 @@ A CTF variant is a selection between different types. A CTF variant must always be defined within the scope of a structure or within fields contained within a structure (defined recursively). A "tag" enumeration field must appear in either the same static scope, prior to the variant -field (in field declaration order), in an upper static scope , or in an +field (in field declaration order), in an upper static scope, or in an upper dynamic scope (see Section 7.3.2). The type selection is indicated by the mapping from the enumeration value to the string used as variant type selector. The field to use as tag is specified by the "tag_field", specified between "< >" after the "variant" keyword for unnamed -variants, and after "variant name" for named variants. +variants, and after "variant name" for named variants. It is not +required that each enumeration mapping appears as variant type tag field. +However, it is required that any enumeration mapping encountered within a +stream has a matching variant type tag field. The alignment of the variant is the alignment of the type as selected by the tag value for the specific instance of the variant. The size of the -- 2.34.1