summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2020-04-26 02:29:35 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2020-04-26 02:29:35 +0200
commitd261dca06c748675add162a0dd1c7bfd992eae1d (patch)
treeefd08d0a03cb3bc28cd8e04f47a6203b3a00b626
parent680dee1daf2a2942bcc08bc7724ffcc52743202a (diff)
eolian: require opaque structs to be used by ref always
For now only in stable API.
-rw-r--r--src/lib/eolian/database_validate.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 2b6fa24058..91a679bc33 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -285,7 +285,8 @@ _validate_typedecl(Validate_State *vals, Eolian_Typedecl *tp)
285} 285}
286 286
287static Eina_Bool 287static Eina_Bool
288_validate_by_ref(Eolian_Type *tp, Eina_Bool by_ref, Eina_Bool move) 288_validate_by_ref(Validate_State *vals, Eolian_Type *tp, Eina_Bool by_ref,
289 Eina_Bool move)
289{ 290{
290 Eina_Bool maybe_ownable = 291 Eina_Bool maybe_ownable =
291 database_type_is_ownable(tp->base.unit, tp, EINA_FALSE, NULL); 292 database_type_is_ownable(tp->base.unit, tp, EINA_FALSE, NULL);
@@ -301,6 +302,15 @@ _validate_by_ref(Eolian_Type *tp, Eina_Bool by_ref, Eina_Bool move)
301 if (tp->btype == EOLIAN_TYPE_BUILTIN_FUTURE) 302 if (tp->btype == EOLIAN_TYPE_BUILTIN_FUTURE)
302 return EINA_TRUE; 303 return EINA_TRUE;
303 304
305 if (tp->tdecl && (tp->tdecl->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE))
306 {
307 if (vals->stable && !maybe_ownable && !by_ref)
308 {
309 _eo_parser_log(&tp->base, "opaque structs must be by reference");
310 return EINA_FALSE;
311 }
312 }
313
304 /* not marked @move, or marked @by_ref; just validate */ 314 /* not marked @move, or marked @by_ref; just validate */
305 if (!move || by_ref) 315 if (!move || by_ref)
306 return EINA_TRUE; 316 return EINA_TRUE;
@@ -322,7 +332,7 @@ _validate_type_by_ref(Validate_State *vals, Eolian_Type *tp,
322 if (!_validate_type(vals, tp, by_ref, is_ret)) 332 if (!_validate_type(vals, tp, by_ref, is_ret))
323 return EINA_FALSE; 333 return EINA_FALSE;
324 334
325 return _validate_by_ref(tp, by_ref, move); 335 return _validate_by_ref(vals, tp, by_ref, move);
326} 336}
327 337
328static Eina_Bool 338static Eina_Bool