From 6caf41e28843d87b33b73b970d39eae595d17856 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Mon, 21 Jul 2014 11:47:35 +0100 Subject: [PATCH] eolian: only check redef on actual named structs --- src/lib/eolian/eo_parser.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c index a5ba28dac1..81735addd4 100644 --- a/src/lib/eolian/eo_parser.c +++ b/src/lib/eolian/eo_parser.c @@ -315,6 +315,7 @@ parse_type_struct(Eo_Lexer *ls, Eina_Bool allow_struct, Eina_Bool allow_anon) if (allow_struct) { Eina_Bool is_extern = EINA_FALSE; + int line, col; if (ls->t.kw == KW_at_extern) { is_extern = EINA_TRUE; @@ -330,12 +331,18 @@ parse_type_struct(Eo_Lexer *ls, Eina_Bool allow_struct, Eina_Bool allow_anon) 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"); + line = ls->line_number; + col = ls->column; sname = eina_stringshare_ref(ls->t.value); eo_lexer_get(ls); if (ls->t.token == '{') - return parse_struct(ls, sname, is_extern); + { + ls->line_number = line; + ls->column = col; + if (eina_hash_find(_structs, ls->t.value)) + eo_lexer_syntax_error(ls, "struct redefinition"); + return parse_struct(ls, sname, is_extern); + } } else {