From 1017f37de74d6224ccebf74f2a82fa55d32f7f97 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Thu, 18 Jan 2018 12:49:05 +0100 Subject: [PATCH] eolian: fix redefined function checks For one, the hash has to be populated once per inheritance tree and the skipping on already-validated funcs was interfering with that as the function might have been validated in another inheritance tree already. Also, if a class appeared multiple times in an inheritance tree, as is common with e.g. Efl.Object, it would get added into the hash the first time and then checked against the second time, which would result in a strange error message about the function being redefined in its own class. So now we prevent both cases from happening. --- src/lib/eolian/database_validate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index 6b1058d5d1..1ba1dfd638 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c @@ -333,7 +333,7 @@ _validate_function(const Eolian_Unit *src, Eolian_Function *func, Eina_Hash *nha } const Eolian_Function *ofunc = nhash ? eina_hash_find(nhash, func->name) : NULL; - if (EINA_UNLIKELY(ofunc && (_duplicates_warn > 0))) + if (EINA_UNLIKELY(ofunc && (ofunc != func) && (_duplicates_warn > 0))) { snprintf(buf, sizeof(buf), "%sfunction '%s' redefined (originally at %s:%d:%d)", @@ -347,7 +347,12 @@ _validate_function(const Eolian_Unit *src, Eolian_Function *func, Eina_Hash *nha * but duplicate checks need to be performed every time */ if (func->base.validated) - return EINA_TRUE; + { + /* it might be validated, but need to add it anyway */ + if (!ofunc && nhash) + eina_hash_add(nhash, func->name, func); + return EINA_TRUE; + } if (func->get_ret_type && !_validate_type(src, func->get_ret_type)) return EINA_FALSE;