Refuse 0 integer size
[babeltrace.git] / formats / ctf / metadata / ctf-visitor-generate-io-struct.c
index c7de92e61d06eda45017d9313aeb05501b7bbdcf..4515b53e437fb16238530f9371b20a745b79f2b2 100644 (file)
@@ -1319,6 +1319,11 @@ struct bt_declaration *ctf_declaration_integer_visit(FILE *fd, int depth,
                                return NULL;
                        }
                        size = right->u.unary_expression.u.unsigned_constant;
                                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) {
                        has_size = 1;
                } else if (!strcmp(left->u.unary_expression.u.string, "align")) {
                        if (right->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT) {
This page took 0.022969 seconds and 4 git commands to generate.