eolian: disallow ptr() in containers in stable API

This commit is contained in:
Daniel Kolesa 2019-08-01 16:47:52 +02:00
parent adaea4170a
commit 1bcca58d82
7 changed files with 17 additions and 18 deletions

View File

@ -161,7 +161,7 @@ enum Efl.Gfx.Change_Flag
struct Efl.Gfx.Event.Render_Post struct Efl.Gfx.Event.Render_Post
{ {
[[Data sent along a "render,post" event, after a frame has been rendered.]] [[Data sent along a "render,post" event, after a frame has been rendered.]]
updated_area: list<ptr(Eina.Rect)>; [[A list of rectangles that were updated_area: list<Eina.Rect>; [[A list of rectangles that were
updated in the canvas.]] updated in the canvas.]]
} }

View File

@ -255,6 +255,13 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
/* validate types in brackets so transitive fields get written */ /* validate types in brackets so transitive fields get written */
while (itp) while (itp)
{ {
if (vals->stable && itp->is_ptr)
{
_eo_parser_log(&itp->base,
"pointer types not allowed in '%s' in stable context",
tp->base.name);
return EINA_FALSE;
}
if (!_validate_type(vals, itp)) if (!_validate_type(vals, itp))
return EINA_FALSE; return EINA_FALSE;
itp = itp->next_type; itp = itp->next_type;

View File

@ -1,10 +1,8 @@
struct @free(efl_del) @extern Eo;
class Complex_Type { class Complex_Type {
methods { methods {
@property a { @property a {
set { set {
return: list<array<ptr(Eo) @owned> > @owned; return: list<array<strbuf @owned> > @owned;
} }
get { get {
} }

View File

@ -1,7 +1,3 @@
struct @free(free_a) Test.A {
t : int;
}
class Owning { class Owning {
methods { methods {
test1 { test1 {
@ -14,8 +10,8 @@ class Owning {
} }
test2 { test2 {
params { params {
test1 : list<ptr(Test.A) @owned> @owned; test1 : list<array<int> @owned> @owned;
test2 : hash<string, ptr(Test.A) @owned> @owned; test2 : hash<string, array<int> @owned> @owned;
} }
} }

View File

@ -18,10 +18,10 @@ void _owning_test2(Eo *obj, Owning_Data *pd, Eina_List *test1, Eina_Hash *test2)
static void static void
_owning_test2_ownership_fallback(Eina_List *test1, Eina_Hash *test2) _owning_test2_ownership_fallback(Eina_List *test1, Eina_Hash *test2)
{ {
Test_A *test1_iter; Eina_Array *test1_iter;
EINA_LIST_FREE(test1,test1_iter) EINA_LIST_FREE(test1,test1_iter)
{ {
free_a(test1_iter); eina_array_free(test1_iter);
} }
eina_hash_free_cb_set(test2,NULL); eina_hash_free_cb_set(test2,NULL);
eina_hash_free(test2); eina_hash_free(test2);

View File

@ -1,7 +1,5 @@
struct @extern Eo;
type Evas.Coord: int; /* Simple type definition */ type Evas.Coord: int; /* Simple type definition */
type List_Objects: list<ptr(Eo)>; /* A little more complex */ type List_Objects: list<Typedef>; /* A little more complex */
type Evas.Coord2: Evas.Coord; type Evas.Coord2: Evas.Coord;
type Evas.Coord3: Evas.Coord2; type Evas.Coord3: Evas.Coord2;

View File

@ -383,7 +383,7 @@ EFL_START_TEST(eolian_typedef)
fail_if(!(type = eolian_type_base_type_get(type))); fail_if(!(type = eolian_type_base_type_get(type)));
fail_if(!!eolian_type_next_type_get(type)); fail_if(!!eolian_type_next_type_get(type));
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
fail_if(strcmp(type_name, "Eo *")); fail_if(strcmp(type_name, "Typedef *"));
fail_if(eolian_type_is_owned(type)); fail_if(eolian_type_is_owned(type));
eina_stringshare_del(type_name); eina_stringshare_del(type_name);
@ -446,7 +446,7 @@ EFL_START_TEST(eolian_complex_type)
fail_if(!!eolian_type_next_type_get(type)); fail_if(!!eolian_type_next_type_get(type));
fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT))); fail_if(!(type_name = eolian_type_c_type_get(type, EOLIAN_C_TYPE_DEFAULT)));
fail_if(!eolian_type_is_owned(type)); fail_if(!eolian_type_is_owned(type));
fail_if(strcmp(type_name, "Eo *")); fail_if(strcmp(type_name, "Eina_Strbuf *"));
eina_stringshare_del(type_name); eina_stringshare_del(type_name);
/* Properties parameter type */ /* Properties parameter type */
fail_if(!(iter = eolian_property_values_get(fid, EOLIAN_PROP_GET))); fail_if(!(iter = eolian_property_values_get(fid, EOLIAN_PROP_GET)));