if (ret)
return ret;
}
- cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
- siblings) {
- iter->parent = node;
- ret = ctf_visitor_parent_links(fd, depth + 1, iter);
- if (ret)
- return ret;
+ if (!node->u.type_declarator.u.nested.abstract_array) {
+ cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
+ siblings) {
+ iter->parent = node;
+ ret = ctf_visitor_parent_links(fd, depth + 1, iter);
+ if (ret)
+ return ret;
+ }
}
if (node->u.type_declarator.bitfield_len) {
node->u.type_declarator.bitfield_len = node;
if (ret)
return ret;
}
- cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
- siblings) {
- if (iter->type != NODE_UNARY_EXPRESSION) {
- fprintf(fd, "[error] %s: expecting unary expression as length\n", __func__);
+ if (!node->u.type_declarator.u.nested.abstract_array) {
+ cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
+ siblings) {
+ if (iter->type != NODE_UNARY_EXPRESSION) {
+ fprintf(fd, "[error] %s: expecting unary expression as length\n", __func__);
+ return -EINVAL;
+ }
+ ret = _ctf_visitor_semantic_check(fd, depth + 1, iter);
+ if (ret)
+ return ret;
+ }
+ } else {
+ if (node->parent->type == NODE_TYPEALIAS_TARGET) {
+ fprintf(fd, "[error] %s: abstract array declarator not permitted as target of typealias\n", __func__);
return -EINVAL;
}
- ret = _ctf_visitor_semantic_check(fd, depth + 1, iter);
- if (ret)
- return ret;
}
if (node->u.type_declarator.bitfield_len) {
ret = _ctf_visitor_semantic_check(fd, depth + 1,
print_tabs(fd, depth);
fprintf(fd, "</type_declarator>\n");
}
- if (!cds_list_empty(&node->u.type_declarator.u.nested.length)) {
+ if (node->u.type_declarator.u.nested.abstract_array) {
+ print_tabs(fd, depth);
+ fprintf(fd, "<length>\n");
+ print_tabs(fd, depth);
+ fprintf(fd, "</length>\n");
+ } else if (!cds_list_empty(&node->u.type_declarator.u.nested.length)) {
print_tabs(fd, depth);
fprintf(fd, "<length>\n");
cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length,
print_tabs(fd, depth);
fprintf(fd, "</length>\n");
}
- if (node->u.type_declarator.u.nested.abstract_array) {
- print_tabs(fd, depth);
- fprintf(fd, "<length>\n");
- print_tabs(fd, depth);
- fprintf(fd, "</length>\n");
- }
if (node->u.type_declarator.bitfield_len) {
print_tabs(fd, depth);
fprintf(fd, "<bitfield_len>\n");