Compare commits

...

2 Commits

Author SHA1 Message Date
Lauro Moura 26cfe3b8be efl: Make stable single-valued getters consistent.
Instead of a getter with an explicit return type, change it to be a
single-valued property.

The eolian C generator takes care of making this single value the actual
return value of the C function.

This also makes these properties able to be reflected on.

The stack properties returns just a pointer and not a new ref, so no
@move needed.

Beta properties will be handled in a future commit.

Depends on D10601
2019-11-05 15:47:23 -03:00
Lauro Moura b16de1ba11 eolian: Imply @no_unused if @move in return.
Summary:
This makes sure the user is warned if it ignores a return value that
could potentially be a memory leak.

This also makes possible to use `value {}` blocks with `@move` instead
of value-less properties with `@no_unused`.

Also removed the `@move` from canvas_text_async_layout as it is ignored
in the only place it is used.

Reviewers: q66

Subscribers: #reviewers, #committers, bu5hm4n, felipealmeida, cedric, segfaultxavi

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10601
2019-11-05 15:46:59 -03:00
9 changed files with 26 additions and 12 deletions

View File

@ -168,7 +168,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
eina_strbuf_append(buf, "void");
eina_strbuf_append(buf, ")");
if (!eolian_function_return_allow_unused(fid, ftype))
if (!eolian_function_return_allow_unused(fid, ftype) || return_move)
{
if (!flagbuf)
flagbuf = eina_strbuf_new();

View File

@ -26,7 +26,9 @@ class Efl.Loop_Timer extends Efl.Loop_Consumer
@property time_pending {
[[Pending time regarding a timer.]]
get {
return: double; [[Pending time]]
}
values {
pending: double; [[Pending time]]
}
}
timer_reset {

View File

@ -42,7 +42,9 @@ interface Efl.Gfx.Stack
See also @.layer.]]
get {
return: Efl.Gfx.Stack @no_unused; [[The @Efl.Gfx.Stack object directly below $obj, if any,
}
values {
below: Efl.Gfx.Stack; [[The @Efl.Gfx.Stack object directly below $obj, if any,
or $null, if none.]]
}
}
@ -54,7 +56,9 @@ interface Efl.Gfx.Stack
See also @.layer and @.below]]
get {
return: Efl.Gfx.Stack @no_unused; [[The @Efl.Gfx.Stack object directly below $obj, if any,
}
values {
above: Efl.Gfx.Stack; [[The @Efl.Gfx.Stack object directly below $obj, if any,
or $null, if none.]]
}
}

View File

@ -352,7 +352,9 @@ abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity,
See also @.clipper.
]]
get {
return: iterator<Efl.Canvas.Object> @no_unused; [[An iterator over the
}
values {
objects: iterator<Efl.Canvas.Object> @move; [[An iterator over the
list of objects clipped by $obj.]]
}
}

View File

@ -222,7 +222,7 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
Once layout is complete, the result is returned as @Eina.Rect,
with w, h fields set.
]]
return: future<Eina.Rect> @move; [[Future for layout result]]
return: future<Eina.Rect>; [[Future for layout result]]
}
}
implements {

View File

@ -217,12 +217,16 @@ void _dummy_test_object_out_own_string(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Te
void _dummy_test_object_call_in_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const char *str)
{
dummy_test_object_in_string(obj, str);
char *ptr = dummy_test_object_in_string(obj, str);
if (ptr)
free(ptr);
}
void _dummy_test_object_call_in_own_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, char *str)
{
dummy_test_object_in_own_string(obj, str);
char *ptr = dummy_test_object_in_own_string(obj, str);
if (ptr)
free(ptr);
}
const char *_dummy_test_object_call_return_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
@ -252,7 +256,9 @@ char *_dummy_test_object_call_out_own_string(Eo *obj, EINA_UNUSED Dummy_Test_Obj
// Stringshare virtual test helpers
void _dummy_test_object_call_in_stringshare(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Stringshare *str)
{
dummy_test_object_in_stringshare(obj, str);
Eina_Stringshare *ptr = dummy_test_object_in_stringshare(obj, str);
if (ptr)
eina_stringshare_del(ptr);
}
void _dummy_test_object_call_in_own_stringshare(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Stringshare *str)

View File

@ -19,6 +19,6 @@ EWAPI const Efl_Class *function_as_argument_class_get(void);
EOAPI void function_as_argument_set_cb(Eo *obj, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb);
EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP;
EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT;
#endif

View File

@ -38,7 +38,7 @@ EWAPI const Efl_Class *struct_class_get(void);
*
* @ingroup Struct
*/
EOAPI char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP;
EOAPI char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT;
EOAPI Named *struct_bar(Eo *obj);

View File

@ -34,6 +34,6 @@ typedef enum
EWAPI const Efl_Class *typedef_class_get(void);
EOAPI char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP;
EOAPI char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT;
#endif