Page MenuHomePhabricator

How to handle different "default return value" between legacy function and eolan-generated one
Closed, ResolvedPublic


As we can check in D10051, default return value can be different between legacy and eolian-generated.
Then, we need to have a way to keep legacy default value from eolian-generated one.
What could be a proper way for this ?

Plus, as @zmike talked in D10051, we need to think "return false", whenever error case is happened.

zmike added projects: Restricted Project, efl: api, efl (efl-1.23).Sep 23 2019, 7:36 PM
zmike triaged this task as Showstopper Issues priority.
zmike added subscribers: q66, cedric, stefan_schmidt.

This needs to be resolved before 1.23.

Well, legacy code is being slowly separated from EO files, so I propose we fix this from the legacy code.
Many legacy entrypoints just call their unified counterparts, which now return a different value for invalid objects.
We can add a check in the legacy code, before calling the unified entrypoint, and return the legacy default value for invalid objects.

I'm talking about adding this one line in ./src/lib/evas/canvas/efl_canvas_object_eo.legacy.c:63:

EAPI void
evas_object_propagate_events_set(Efl_Canvas_Object *obj, Eina_Bool propagate)
   if (!obj) return EINA_FALSE; // Instead of the EINA_TRUE that efl_canvas_object_propagate_events_set() will return
   efl_canvas_object_propagate_events_set(obj, propagate);

Ok. I'll also handle this problem with the same way in D10123 whenever I meet similar problems.

Thank you very much !! :)

zmike closed this task as Resolved.Sep 25 2019, 7:32 AM
zmike claimed this task.

I did a quick check for int and bool values with eolian returns set and it looks like this should be the only case where there was an issue...

For the record, the eolian default values are only returned by eo if an invalid object is provided.
It is completely up to the class implementation to return those default values or not.
We should add unit tests to verify that implementations do honor these default values, as suggested in T8171.