int ret = 0;
struct bt_ctf_field_type_structure *structure;
+ /*
+ * TODO: check that `field_type` does not contain `type`,
+ * recursively.
+ */
if (!type || !field_type || type->frozen ||
bt_ctf_validate_identifier(field_name) ||
- (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_STRUCT) ||
+ type == field_type) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
GQuark field_name_quark = g_quark_from_string(field_name);
+ /*
+ * TODO: check that `field_type` does not contain `type`,
+ * recursively.
+ */
if (!type || !field_type || type->frozen ||
bt_ctf_validate_identifier(field_name) ||
- (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
+ (type->declaration->id != BT_CTF_TYPE_ID_VARIANT) ||
+ type == field_type) {
ret = -1;
goto end;
}
#define DEFAULT_CLOCK_TIME 0
#define DEFAULT_CLOCK_VALUE 0
-#define NR_TESTS 604
+#define NR_TESTS 605
static int64_t current_time = 42;
ok(bt_ctf_field_type_array_get_length(array_type) == ARRAY_TEST_LENGTH,
"bt_ctf_field_type_array_get_length returns the correct length");
+ ok(bt_ctf_field_type_structure_add_field(inner_structure_type,
+ inner_structure_type, "yes"), "Cannot add self to structure");
ok(!bt_ctf_field_type_structure_add_field(inner_structure_type,
uint_35_type, "seq_len"), "Add seq_len field to inner structure");
ok(!bt_ctf_field_type_structure_add_field(inner_structure_type,