Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
byte_order = native OR network OR be OR le; /* default native */
size = value; /* value in bits, no default */
align = value; /* value in bits */
byte_order = native OR network OR be OR le; /* default native */
size = value; /* value in bits, no default */
align = value; /* value in bits */
Example of type inheritance (creation of a uint32_t named type):
Example of type inheritance (creation of a uint32_t named type):
unit is padded and the bitfield starts at the following unit. The unit size is
defined by the size of the type "unit_type".
unit is padded and the bitfield starts at the following unit. The unit size is
defined by the size of the type "unit_type".
-Metadata representation. Either:
-
-gcc_bitfield {
- unit_type = integer {
- ...
- };
- size = value;
-};
-
-Or bitfield within structures as specified by the C standard
+Metadata representation:
-is equivalent to the following structure declaration, aligned on the largest
-element (short). The second bitfield would be aligned on the next unit boundary,
-because it would not fit in the current unit. The two declarations (C
-declaration above or CTF declaration with "type gcc_bitfield") are strictly
-equivalent.
-
-struct example {
- gcc_bitfield {
- unit_type = short;
- size = 12;
- } a;
- gcc_bitfield {
- unit_type = short;
- size = 5;
- } b;
-};
+The example structure is aligned on the largest element (short). The second
+bitfield would be aligned on the next unit boundary, because it would not fit in
+the current unit.
exp_dig = value;
mant_dig = value;
byte_order = native OR network OR be OR le;
exp_dig = value;
mant_dig = value;
byte_order = native OR network OR be OR le;
Example of type inheritance:
Example of type inheritance:
If the values are omitted, the enumeration starts at 0 and increment of 1 for
each entry:
If the values are omitted, the enumeration starts at 0 and increment of 1 for
each entry:
Overlapping ranges within a single enumeration are implementation defined.
Overlapping ranges within a single enumeration are implementation defined.
+A nameless enumeration can be declared as a field type or as part of a typedef:
+
+enum <integer_type> {
+ ...
+}
+
4.2 Compound types
4.2.1 Structures
4.2 Compound types
4.2.1 Structures
The fields are placed in a sequence next to each other. They each possess a
field name, which is a unique identifier within the structure.
The fields are placed in a sequence next to each other. They each possess a
field name, which is a unique identifier within the structure.
-A nameless structure can be declared as a field type:
+A nameless structure can be declared as a field type or as part of a typedef:
any type not containing the type of the array being declared (no circular
dependency). The length is the number of elements in an array.
any type not containing the type of the array being declared (no circular
dependency). The length is the number of elements in an array.
-Metadata representation of a named array, either:
-
-typedef array {
- length = value;
- elem_type = type;
-} name;
-
-or:
+Metadata representation of a named array:
typedef elem_type name[length];
typedef elem_type name[length];
+A nameless array can be declared as a field type within a structure, e.g.:
-typedef array {
- length = 10;
- elem_type = uint32_t;
-} example;
-
-A nameless array can be declared as a field type, e.g.:
-
-array {
- length = 5;
- elem_type = uint8_t;
-} field_name;
-
-or
-
-uint8_t field_name[10];
+ uint8_t field_name[10];
the length of the sequence, followed by an array of "inner type" elements.
The length is the number of elements in the sequence.
the length of the sequence, followed by an array of "inner type" elements.
The length is the number of elements in the sequence.
-Metadata representation for a named sequence, either:
-
-typedef sequence {
- length_type = type; /* integer class */
- elem_type = type;
-} name;
-
-or:
+Metadata representation for a named sequence:
typedef elem_type name[length_type];
A nameless sequence can be declared as a field type, e.g.:
typedef elem_type name[length_type];
A nameless sequence can be declared as a field type, e.g.:
-sequence {
- length_type = int;
- elem_type = long;
-} field_name;
-
-or
-
long field_name[int];
The length type follows the integer types specifications, and the sequence
long field_name[int];
The length type follows the integer types specifications, and the sequence
*/
typedef aliased_type_prefix aliased_type new_type aliased_type_postfix;
*/
typedef aliased_type_prefix aliased_type new_type aliased_type_postfix;
/* e.g.: typedef struct example new_type_name[10]; */
typedef type_class {
...
} new_type_prefix new_type new_type_postfix;
/* e.g.: typedef struct example new_type_name[10]; */
typedef type_class {
...
} new_type_prefix new_type new_type_postfix;
/*
* e.g.:
* typedef integer {
/*
* e.g.:
* typedef integer {
-/* Unnamed types, contained within compound type fields or type assignments. */
+
+/* Unnamed types, contained within compound type fields or typedef. */
+
enum <integer_type> {
...
enum <integer_type> {
...
+}
+
+typedef type new_type[length];
+struct {
+ type field_name[length];
+}
+
+typedef type new_type[length_type];
+
+struct {
+ type field_name[length_type];
+}
+
+integer {
+}
+
+struct {
+ integer_type field_name:size; /* GNU/C bitfield */
+}
+
+struct {
+ string field_name;
+}