diff --git a/src/lib/eolian/database_fill.c b/src/lib/eolian/database_fill.c index 6da91b8857..f4c4493cbe 100644 --- a/src/lib/eolian/database_fill.c +++ b/src/lib/eolian/database_fill.c @@ -459,18 +459,12 @@ nodeloop: break; case NODE_TYPEDEF: if (!database_type_add(nd->def_typedef)) - { - ERR("Redefinition of typedef %s\n", nd->def_typedef->alias); - goto error; - } + goto error; nd->def_typedef = NULL; break; case NODE_STRUCT: if (!database_struct_add(nd->def_struct)) - { - ERR("Redefinition of struct %s\n", nd->def_struct->name); - goto error; - } + goto error; nd->def_struct = NULL; break; default: diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index 187185c1cf..83e44bbe28 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -37,7 +37,6 @@ Eina_Bool database_type_add(Eolian_Typedef *def) { if (!_types) return EINA_FALSE; - if (eina_hash_find(_types, def->alias)) return EINA_FALSE; eina_hash_set(_types, def->alias, def); return EINA_TRUE; } @@ -45,7 +44,6 @@ database_type_add(Eolian_Typedef *def) Eina_Bool database_struct_add(Eolian_Type *tp) { if (!_structs) return EINA_FALSE; - if (eina_hash_find(_structs, tp->name)) return EINA_FALSE; eina_hash_set(_structs, tp->name, tp); return EINA_TRUE; } diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index d5bdc0c7a8..8c4a4f32a7 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -329,6 +329,9 @@ parse_type_struct(Eo_Lexer *ls, Eina_Bool allow_struct, Eina_Bool allow_anon) check(ls, TOK_VALUE); if (eo_lexer_get_c_type(ls->t.kw)) eo_lexer_syntax_error(ls, "invalid struct name"); + /* todo: see typedef */ + if (eina_hash_find(_structs, ls->t.value)) + eo_lexer_syntax_error(ls, "struct redefinition"); sname = eina_stringshare_ref(ls->t.value); eo_lexer_get(ls); if (ls->t.token == '{') @@ -407,6 +410,9 @@ parse_typedef(Eo_Lexer *ls) eo_lexer_get(ls); } check(ls, TOK_VALUE); + /* todo: store info about the previous definition and mention it here */ + if (eina_hash_find(_types, ls->t.value)) + eo_lexer_syntax_error(ls, "typedef redefinition"); ls->tmp.typedef_def->alias = eina_stringshare_ref(ls->t.value); eo_lexer_get(ls); (void)!!test_next(ls, ':'); @@ -1071,6 +1077,9 @@ parse_unit(Eo_Lexer *ls, Eina_Bool eot) check(ls, TOK_VALUE); if (eo_lexer_get_c_type(ls->t.kw)) eo_lexer_syntax_error(ls, "invalid struct name"); + /* todo: see typedef */ + if (eina_hash_find(_structs, ls->t.value)) + eo_lexer_syntax_error(ls, "struct redefinition"); name = eina_stringshare_ref(ls->t.value); eo_lexer_get(ls); parse_struct(ls, name, is_extern);