Add enum {} default mapping to "int" type
[babeltrace.git] / formats / ctf / metadata / ctf-visitor-generate-io-struct.c
index 28962abd7281f16e683e163f10cc32810a606cab..a399066afc65b5e72f4368546b3319517f25aec4 100644 (file)
@@ -845,15 +845,19 @@ struct declaration *ctf_declaration_enum_visit(FILE *fd, int depth,
                        }
                }
                if (!container_type) {
-                       fprintf(fd, "[error] %s: missing container type for enumeration\n", __func__);
-                       return NULL;
-                       
+                       declaration = lookup_declaration(g_quark_from_static_string("int"),
+                                                        declaration_scope);
+                       if (!declaration) {
+                               fprintf(fd, "[error] %s: \"int\" type declaration missing for enumeration\n", __func__);
+                               return NULL;
+                       }
+               } else {
+                       declaration = ctf_type_declarator_visit(fd, depth,
+                                               container_type,
+                                               &dummy_id, NULL,
+                                               declaration_scope,
+                                               NULL, trace);
                }
-               declaration = ctf_type_declarator_visit(fd, depth,
-                                       container_type,
-                                       &dummy_id, NULL,
-                                       declaration_scope,
-                                       NULL, trace);
                if (!declaration) {
                        fprintf(fd, "[error] %s: unable to create container type for enumeration\n", __func__);
                        return NULL;
This page took 0.022769 seconds and 4 git commands to generate.