- _struct->scope = new_definition_scope(parent_scope);
- _struct->fields = g_array_sized_new(FALSE, TRUE,
- sizeof(struct field),
- DEFAULT_NR_STRUCT_FIELDS);
- g_array_set_size(_struct->fields, struct_declaration->fields->len);
+ /*
+ * Use INT_MAX order to ensure that all fields of the parent
+ * scope are seen as being prior to this scope.
+ */
+ _struct->p.index = root_name ? INT_MAX : index;
+ _struct->p.name = field_name;
+ _struct->p.path = new_definition_path(parent_scope, field_name, root_name);
+ _struct->p.scope = new_definition_scope(parent_scope, field_name, root_name);
+
+ ret = register_field_definition(field_name, &_struct->p,
+ parent_scope);
+ assert(!ret || ret == -EPERM);
+
+ _struct->fields = g_ptr_array_sized_new(DEFAULT_NR_STRUCT_FIELDS);
+ g_ptr_array_set_size(_struct->fields, struct_declaration->fields->len);