summaryrefslogtreecommitdiff
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
parentce372ee53476cade560261bd764bbab14916fd80 (diff)
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)
219} 219}
220 220
221static Eina_Bool 221static Eina_Bool
222_validate_ptr(Eolian_Type *tp)
223{
224 if (tp->owned && tp->is_ptr)
225 {
226 const Eolian_Type *btp = eolian_type_aliased_base_get(tp);
227 if (eo_lexer_keyword_str_to_id(btp->base.name))
228 {
229 _eo_parser_log(&tp->base, "pointers to primitives cannot be owned");
230 return EINA_FALSE;
231 }
232 }
233 return _validate(&tp->base);
234}
235
236static Eina_Bool
222_validate_type(Validate_State *vals, Eolian_Type *tp) 237_validate_type(Validate_State *vals, Eolian_Type *tp)
223{ 238{
224 const Eolian_Unit *src = tp->base.unit; 239 const Eolian_Unit *src = tp->base.unit;
@@ -342,7 +357,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
342 _eo_parser_log(&tp->base, "builtin primitives cannot have a free function"); 357 _eo_parser_log(&tp->base, "builtin primitives cannot have a free function");
343 return EINA_FALSE; 358 return EINA_FALSE;
344 } 359 }
345 return _validate(&tp->base); 360 return _validate_ptr(tp);
346 } 361 }
347 /* user defined */ 362 /* user defined */
348 tp->tdecl = database_type_decl_find(src, tp); 363 tp->tdecl = database_type_decl_find(src, tp);
@@ -358,7 +373,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
358 373
359 /* to leave out slow checks if possible */ 374 /* to leave out slow checks if possible */
360 if (!tp->owned) 375 if (!tp->owned)
361 return _validate(&tp->base); 376 return _validate_ptr(tp);
362 377
363 /* most builtins are not allowed to have freefuncs, and 378 /* most builtins are not allowed to have freefuncs, and
364 * potential ownability has already been validated before 379 * potential ownability has already been validated before
@@ -380,7 +395,7 @@ _validate_type(Validate_State *vals, Eolian_Type *tp)
380 _eo_parser_log(&tp->base, "type '%s' is not ownable", tp->base.name); 395 _eo_parser_log(&tp->base, "type '%s' is not ownable", tp->base.name);
381 return EINA_FALSE; 396 return EINA_FALSE;
382 } 397 }
383 return _validate(&tp->base); 398 return _validate_ptr(tp);
384 } 399 }
385 case EOLIAN_TYPE_CLASS: 400 case EOLIAN_TYPE_CLASS:
386 { 401 {