aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2019-01-30 18:09:47 +0100
committerDaniel Kolesa <d.kolesa@samsung.com>2019-02-28 01:09:02 +0100
commit434985f87a981a1e15facb897bc45dfba05c00fd (patch)
tree2b86144d5b82de609c1972fdf21d13cfee33626c
parenteolian_gen: support for iterative freeing of struct fields (diff)
downloadefl-devs/q66/eolian-inlist-inarray.tar.gz
eolian: do not allow owned pointers to builtinsdevs/q66/eolian-inlist-inarray
Ideally we should not allow pointers to builtins at all, but that cannot be done right now.
-rw-r--r--src/lib/eolian/database_validate.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 377efa46ac..a80d59a40b 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -219,6 +219,21 @@ _validate_typedecl(Validate_State *vals, Eolian_Typedecl *tp)
}
static Eina_Bool
+_validate_ptr(Eolian_Type *tp)
+{
+ if (tp->owned && tp->is_ptr)
+ {
+ const Eolian_Type *btp = eolian_type_aliased_base_get(tp);
+ if (eo_lexer_keyword_str_to_id(btp->base.name))
+ {
+ _eo_parser_log(&tp->base, "pointers to primitives cannot be owned");
+ return EINA_FALSE;
+ }
+ }
+ return _validate(&tp->base);
+}
+
+static Eina_Bool
_validate_type(Validate_State *vals, Eolian_Type *tp)
{
const Eolian_Unit *src = tp->base.unit;
@@ -342,7 +357,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
_eo_parser_log(&tp->base, "builtin primitives cannot have a free function");
return EINA_FALSE;
}
- return _validate(&tp->base);
+ return _validate_ptr(tp);
}
/* user defined */
tp->tdecl = database_type_decl_find(src, tp);
@@ -358,7 +373,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
/* to leave out slow checks if possible */
if (!tp->owned)
- return _validate(&tp->base);
+ return _validate_ptr(tp);
/* most builtins are not allowed to have freefuncs, and
* potential ownability has already been validated before
@@ -380,7 +395,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
_eo_parser_log(&tp->base, "type '%s' is not ownable", tp->base.name);
return EINA_FALSE;
}
- return _validate(&tp->base);
+ return _validate_ptr(tp);
}
case EOLIAN_TYPE_CLASS:
{