Duplicate variant field name check
[babeltrace.git] / formats / ctf / metadata / ctf-visitor-generate-io-struct.c
index 640b8fdff7c1ae6dc5095735328b2224972a1c79..bdb5c68d6cfaa45ec3395fc7ad408eb23ff9792a 100644 (file)
@@ -468,6 +468,13 @@ int ctf_variant_type_declarators_visit(FILE *fd, int depth,
                        fprintf(fd, "[error] %s: unable to find variant field declaration type\n", __func__);
                        return -EINVAL;
                }
+
+               if (untagged_variant_declaration_get_field_from_tag(untagged_variant_declaration, field_name) != NULL) {
+                       fprintf(fd, "[error] %s: duplicate field %s in variant\n", __func__, g_quark_to_string(field_name));
+                       return -EINVAL;
+               }
+
+
                untagged_variant_declaration_add_field(untagged_variant_declaration,
                                              g_quark_to_string(field_name),
                                              field_declaration);
This page took 0.025552 seconds and 4 git commands to generate.