X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-visitor-generate-io-struct.c;h=4515b53e437fb16238530f9371b20a745b79f2b2;hb=fbad6b84b7a1a9e1d046d9ef983ca001f4f7ba29;hp=23c4f2f47377da09da3ca3f63b371ee6c547a6f8;hpb=4cb26dfbd763c06d99bf1069e2d1f3a569858e32;p=babeltrace.git diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c index 23c4f2f4..4515b53e 100644 --- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c +++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c @@ -649,7 +649,7 @@ int ctf_typedef_visit(FILE *fd, int depth, struct declaration_scope *scope, bt_list_for_each_entry(iter, type_declarators, siblings) { struct bt_declaration *type_declaration; int ret; - + type_declaration = ctf_type_declarator_visit(fd, depth, type_specifier_list, &identifier, iter, @@ -865,7 +865,6 @@ struct bt_declaration *ctf_declaration_struct_visit(FILE *fd, if (name) { if (bt_lookup_struct_declaration(g_quark_from_string(name), declaration_scope)) { - fprintf(fd, "[error] %s: struct %s already declared in scope\n", __func__, name); return NULL; } @@ -876,7 +875,6 @@ struct bt_declaration *ctf_declaration_struct_visit(FILE *fd, ret = get_unary_unsigned(min_align, &min_align_value); if (ret) { fprintf(fd, "[error] %s: unexpected unary expression for structure \"align\" attribute\n", __func__); - ret = -EINVAL; goto error; } } @@ -936,7 +934,6 @@ struct bt_declaration *ctf_declaration_variant_visit(FILE *fd, if (name) { if (bt_lookup_variant_declaration(g_quark_from_string(name), declaration_scope)) { - fprintf(fd, "[error] %s: variant %s already declared in scope\n", __func__, name); return NULL; } @@ -1105,7 +1102,6 @@ struct bt_declaration *ctf_declaration_enum_visit(FILE *fd, int depth, if (name) { if (bt_lookup_enum_declaration(g_quark_from_string(name), declaration_scope)) { - fprintf(fd, "[error] %s: enum %s already declared in scope\n", __func__, name); return NULL; } @@ -1233,7 +1229,7 @@ int get_boolean(FILE *fd, int depth, struct ctf_node *unary_expression) fprintf(fd, "[error] %s: unexpected unary expression type\n", __func__); return -EINVAL; - } + } } @@ -1323,6 +1319,11 @@ struct bt_declaration *ctf_declaration_integer_visit(FILE *fd, int depth, return NULL; } size = right->u.unary_expression.u.unsigned_constant; + if (!size) { + fprintf(fd, "[error] %s: integer size: expecting non-zero constant\n", + __func__); + return NULL; + } has_size = 1; } else if (!strcmp(left->u.unary_expression.u.string, "align")) { if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) { @@ -1479,9 +1480,9 @@ struct bt_declaration *ctf_declaration_floating_point_visit(FILE *fd, int depth, struct ctf_trace *trace) { struct ctf_node *expression; - uint64_t alignment = 1, exp_dig = 0, mant_dig = 0, - byte_order = trace->byte_order; - int has_alignment = 0, has_exp_dig = 0, has_mant_dig = 0; + uint64_t alignment = 1, exp_dig = 0, mant_dig = 0; + int byte_order = trace->byte_order, has_alignment = 0, + has_exp_dig = 0, has_mant_dig = 0; struct declaration_float *float_declaration; bt_list_for_each_entry(expression, expressions, siblings) { @@ -2403,6 +2404,7 @@ int ctf_clock_declaration_visit(FILE *fd, int depth, struct ctf_node *node, goto error; } clock->absolute = ret; + ret = 0; } else { fprintf(fd, "[warning] %s: attribute \"%s\" is unknown in clock declaration.\n", __func__, left); }