- length = node_type_declarator->u.type_declarator.u.nested.length;
- if (length) {
- switch (length->type) {
- case NODE_UNARY_EXPRESSION:
- {
- struct declaration_array *array_declaration;
- size_t len;
-
- if (length->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
- fprintf(stderr, "[error] %s: array: unexpected unary expression.\n", __func__);
- return NULL;
- }
- len = length->u.unary_expression.u.unsigned_constant;
- array_declaration = array_declaration_new(len, nested_declaration,
- declaration_scope);
- declaration = &array_declaration->p;
- break;
- }
- case NODE_INTEGER:
- case NODE_TYPE_SPECIFIER:
- {
- struct declaration_sequence *sequence_declaration;
- struct declaration_integer *integer_declaration;
- GQuark dummy_id;
-
- declaration = ctf_type_declarator_visit(fd, depth,
- length,
- &dummy_id, NULL,
- declaration_scope,
- NULL, trace);
- assert(declaration->id == CTF_TYPE_INTEGER);
- integer_declaration = container_of(declaration, struct declaration_integer, p);
- declaration_sequence = sequence_declaration_new(integer_declaration,
- nested_declaration, declaration_scope);
- declaration = &declaration_sequence->p;
- break;
- }
- default:
- assert(0);
+ length = &node_type_declarator->u.type_declarator.u.nested.length;
+ if (cds_list_empty(length)) {
+ fprintf(stderr, "[error] %s: expecting length type or value.\n", __func__);
+ return NULL;
+ }
+ first = _cds_list_first_entry(length, struct ctf_node, siblings);
+ switch (first->type) {
+ case NODE_UNARY_EXPRESSION:
+ {
+ struct declaration_array *array_declaration;
+ size_t len;
+
+ if (first->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
+ fprintf(stderr, "[error] %s: array: unexpected unary expression.\n", __func__);
+ return NULL;