summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-12-04 15:30:17 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2019-12-04 16:08:02 +0100
commit387947f6b151f5dd65c6c38d99e762e612281269 (patch)
treedbc78576eb6bdfdf21e5893d6e4d9702671ab9a9
parentc6465dae30295d1b4adaaef83a62674dcc25c1d6 (diff)
eolian: account for entire inheritance trees when compositing
When a class composites an interface, we need to ignore all of its extends (and extends of those) as well as the main interface when doing API checks, as composites essentially provides a guarantee that this *will* be implemented at runtime, which further extends to the whole inheritance tree of that interface. Fixes T8491.
-rw-r--r--src/lib/eolian/database_validate.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 4e51718ecd..b1af2185ef 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -1247,6 +1247,17 @@ _add_composite(Eolian_Class *cl, const Eolian_Class *icl, Eina_Hash *ch)
1247 } 1247 }
1248} 1248}
1249 1249
1250static void
1251_add_implicit_composite(Eolian_Class *icl, Eina_Hash *ch, Eina_Bool try_tree)
1252{
1253 eina_hash_set(ch, &icl, icl);
1254 if (!try_tree)
1255 return;
1256 Eina_List *l;
1257 EINA_LIST_FOREACH(icl->extends, l, icl)
1258 _add_implicit_composite(icl, ch, try_tree);
1259}
1260
1250static Eina_Bool 1261static Eina_Bool
1251_db_fill_inherits(Validate_State *vals, Eolian_Class *cl, Eina_Hash *fhash, 1262_db_fill_inherits(Validate_State *vals, Eolian_Class *cl, Eina_Hash *fhash,
1252 Eina_Hash *errh) 1263 Eina_Hash *errh)
@@ -1325,7 +1336,12 @@ _db_fill_inherits(Validate_State *vals, Eolian_Class *cl, Eina_Hash *fhash,
1325 cl->composite = eina_list_append(cl->composite, out_cl); 1336 cl->composite = eina_list_append(cl->composite, out_cl);
1326 succ = _db_fill_inherits(vals, out_cl, fhash, errh); 1337 succ = _db_fill_inherits(vals, out_cl, fhash, errh);
1327 ++ncomp; 1338 ++ncomp;
1328 eina_hash_set(ch, &out_cl, out_cl); 1339 /* for each thing that is composited, we need to add the entire
1340 * inheritance tree of it into composite hash to check, so e.g.
1341 * class A -> composites B -> extends C does not complain about
1342 * A not implementing C
1343 */
1344 _add_implicit_composite(out_cl, ch, out_cl->type == EOLIAN_CLASS_INTERFACE);
1329 } 1345 }
1330 1346
1331 /* parent can be abstract, those are not checked for unimplemented, 1347 /* parent can be abstract, those are not checked for unimplemented,