+static
+struct declaration *ctf_declaration_string_visit(FILE *fd, int depth,
+ struct cds_list_head *expressions,
+ struct ctf_trace *trace)
+{
+ struct ctf_node *expression;
+ const char *encoding_c = NULL;
+ enum ctf_string_encoding encoding = CTF_STRING_UTF8;
+ struct declaration_string *string_declaration;
+
+ cds_list_for_each_entry(expression, expressions, siblings) {
+ struct ctf_node *left, *right;
+
+ left = _cds_list_first_entry(&expression->u.ctf_expression.left, struct ctf_node, siblings);
+ right = _cds_list_first_entry(&expression->u.ctf_expression.right, struct ctf_node, siblings);
+ assert(left->u.unary_expression.type == UNARY_STRING);
+ if (!strcmp(left->u.unary_expression.u.string, "encoding")) {
+ if (right->u.unary_expression.type != UNARY_STRING) {
+ fprintf(fd, "[error] %s: encoding: expecting string\n",
+ __func__);
+ return NULL;
+ }
+ encoding_c = right->u.unary_expression.u.string;
+ } else {
+ fprintf(fd, "[error] %s: unknown attribute name %s\n",
+ __func__, left->u.unary_expression.u.string);
+ return NULL;
+ }
+ }
+ if (encoding_c && !strcmp(encoding_c, "ASCII"))
+ encoding = CTF_STRING_ASCII;
+ string_declaration = string_declaration_new(encoding);
+ return &string_declaration->p;
+}
+
+
+static
+struct declaration *ctf_type_specifier_list_visit(FILE *fd,
+ int depth, struct ctf_node *type_specifier_list,
+ struct declaration_scope *declaration_scope,
+ struct ctf_trace *trace)
+{
+ struct ctf_node *first;
+ struct ctf_node *node;
+
+ assert(type_specifier_list->type == NODE_TYPE_SPECIFIER_LIST);
+
+ first = _cds_list_first_entry(&type_specifier_list->u.type_specifier_list.head, struct ctf_node, siblings);
+
+ assert(first->type == NODE_TYPE_SPECIFIER);
+
+ node = first->u.type_specifier.node;
+
+ switch (first->u.type_specifier.type) {
+ case TYPESPEC_FLOATING_POINT:
+ return ctf_declaration_floating_point_visit(fd, depth,
+ &node->u.floating_point.expressions, trace);
+ case TYPESPEC_INTEGER:
+ return ctf_declaration_integer_visit(fd, depth,
+ &node->u.integer.expressions, trace);
+ case TYPESPEC_STRING:
+ return ctf_declaration_string_visit(fd, depth,
+ &node->u.string.expressions, trace);
+ case TYPESPEC_STRUCT: