summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-11-05 11:59:46 -0300
committerLauro Moura <lauromoura@expertisesolutions.com.br>2019-11-05 16:54:17 -0300
commitd4d9ecc92fe897e29a7c14c5856db617e8a16340 (patch)
tree561fdb0f16bafb97e7d8ef890a516cc9814b4080 /src
parent714478cbf3ba6630e2f3255ae56f1d2af4ac7312 (diff)
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 Reviewed By: q66 Subscribers: #reviewers, #committers, bu5hm4n, felipealmeida, cedric, segfaultxavi Tags: #efl Differential Revision: https://phab.enlightenment.org/D10601
Diffstat (limited to 'src')
-rw-r--r--src/bin/eolian/headers.c2
-rw-r--r--src/lib/evas/canvas/efl_canvas_text.eo2
-rw-r--r--src/tests/efl_mono/dummy_test_object.c12
-rw-r--r--src/tests/eolian/data/function_as_argument_ref.h2
-rw-r--r--src/tests/eolian/data/struct_ref.h2
-rw-r--r--src/tests/eolian/data/typedef_ref.h2
6 files changed, 14 insertions, 8 deletions
diff --git a/src/bin/eolian/headers.c b/src/bin/eolian/headers.c
index 3a84e0a..ead40d8 100644
--- a/src/bin/eolian/headers.c
+++ b/src/bin/eolian/headers.c
@@ -168,7 +168,7 @@ _gen_func(const Eolian_State *state, const Eolian_Function *fid,
168 eina_strbuf_append(buf, "void"); 168 eina_strbuf_append(buf, "void");
169 169
170 eina_strbuf_append(buf, ")"); 170 eina_strbuf_append(buf, ")");
171 if (!eolian_function_return_allow_unused(fid, ftype)) 171 if (!eolian_function_return_allow_unused(fid, ftype) || return_move)
172 { 172 {
173 if (!flagbuf) 173 if (!flagbuf)
174 flagbuf = eina_strbuf_new(); 174 flagbuf = eina_strbuf_new();
diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo
index 511dec2..9bac9fe 100644
--- a/src/lib/evas/canvas/efl_canvas_text.eo
+++ b/src/lib/evas/canvas/efl_canvas_text.eo
@@ -222,7 +222,7 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
222 Once layout is complete, the result is returned as @Eina.Rect, 222 Once layout is complete, the result is returned as @Eina.Rect,
223 with w, h fields set. 223 with w, h fields set.
224 ]] 224 ]]
225 return: future<Eina.Rect> @move; [[Future for layout result]] 225 return: future<Eina.Rect>; [[Future for layout result]]
226 } 226 }
227 } 227 }
228 implements { 228 implements {
diff --git a/src/tests/efl_mono/dummy_test_object.c b/src/tests/efl_mono/dummy_test_object.c
index 54a2c2c..fb87a8c 100644
--- a/src/tests/efl_mono/dummy_test_object.c
+++ b/src/tests/efl_mono/dummy_test_object.c
@@ -217,12 +217,16 @@ void _dummy_test_object_out_own_string(EINA_UNUSED Eo *obj, EINA_UNUSED Dummy_Te
217 217
218void _dummy_test_object_call_in_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const char *str) 218void _dummy_test_object_call_in_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const char *str)
219{ 219{
220 dummy_test_object_in_string(obj, str); 220 char *ptr = dummy_test_object_in_string(obj, str);
221 if (ptr)
222 free(ptr);
221} 223}
222 224
223void _dummy_test_object_call_in_own_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, char *str) 225void _dummy_test_object_call_in_own_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, char *str)
224{ 226{
225 dummy_test_object_in_own_string(obj, str); 227 char *ptr = dummy_test_object_in_own_string(obj, str);
228 if (ptr)
229 free(ptr);
226} 230}
227 231
228const char *_dummy_test_object_call_return_string(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd) 232const 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
252// Stringshare virtual test helpers 256// Stringshare virtual test helpers
253void _dummy_test_object_call_in_stringshare(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Stringshare *str) 257void _dummy_test_object_call_in_stringshare(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Stringshare *str)
254{ 258{
255 dummy_test_object_in_stringshare(obj, str); 259 Eina_Stringshare *ptr = dummy_test_object_in_stringshare(obj, str);
260 if (ptr)
261 eina_stringshare_del(ptr);
256} 262}
257 263
258void _dummy_test_object_call_in_own_stringshare(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Stringshare *str) 264void _dummy_test_object_call_in_own_stringshare(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, Eina_Stringshare *str)
diff --git a/src/tests/eolian/data/function_as_argument_ref.h b/src/tests/eolian/data/function_as_argument_ref.h
index 2b677ae..b93a3e0 100644
--- a/src/tests/eolian/data/function_as_argument_ref.h
+++ b/src/tests/eolian/data/function_as_argument_ref.h
@@ -19,6 +19,6 @@ EWAPI const Efl_Class *function_as_argument_class_get(void);
19 19
20EOAPI void function_as_argument_set_cb(Eo *obj, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb); 20EOAPI void function_as_argument_set_cb(Eo *obj, void *cb_data, SimpleFunc cb, Eina_Free_Cb cb_free_cb);
21 21
22EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP; 22EOAPI char *function_as_argument_call_cb(Eo *obj, int a, double b) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT;
23 23
24#endif 24#endif
diff --git a/src/tests/eolian/data/struct_ref.h b/src/tests/eolian/data/struct_ref.h
index ddcb20a..ec7ea52 100644
--- a/src/tests/eolian/data/struct_ref.h
+++ b/src/tests/eolian/data/struct_ref.h
@@ -38,7 +38,7 @@ EWAPI const Efl_Class *struct_class_get(void);
38 * 38 *
39 * @ingroup Struct 39 * @ingroup Struct
40 */ 40 */
41EOAPI char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP; 41EOAPI char *struct_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT;
42 42
43EOAPI Named *struct_bar(Eo *obj); 43EOAPI Named *struct_bar(Eo *obj);
44 44
diff --git a/src/tests/eolian/data/typedef_ref.h b/src/tests/eolian/data/typedef_ref.h
index 524f803..dd3f3ad 100644
--- a/src/tests/eolian/data/typedef_ref.h
+++ b/src/tests/eolian/data/typedef_ref.h
@@ -34,6 +34,6 @@ typedef enum
34 34
35EWAPI const Efl_Class *typedef_class_get(void); 35EWAPI const Efl_Class *typedef_class_get(void);
36 36
37EOAPI char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP; 37EOAPI char *typedef_foo(Eo *obj, int idx) EFL_TRANSFER_OWNERSHIP EINA_WARN_UNUSED_RESULT;
38 38
39#endif 39#endif