q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d261dca06c748675add162a0dd1c7bfd992eae1d

commit d261dca06c748675add162a0dd1c7bfd992eae1d
Author: Daniel Kolesa <[email protected]>
Date:   Sun Apr 26 02:29:35 2020 +0200

    eolian: require opaque structs to be used by ref always
    
    For now only in stable API.
---
 src/lib/eolian/database_validate.c | 14 ++++++++++++--
 1 file 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)
 }
 
 static Eina_Bool
-_validate_by_ref(Eolian_Type *tp, Eina_Bool by_ref, Eina_Bool move)
+_validate_by_ref(Validate_State *vals, Eolian_Type *tp, Eina_Bool by_ref,
+                 Eina_Bool move)
 {
    Eina_Bool maybe_ownable =
      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)
    if (tp->btype == EOLIAN_TYPE_BUILTIN_FUTURE)
      return EINA_TRUE;
 
+   if (tp->tdecl && (tp->tdecl->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE))
+     {
+        if (vals->stable && !maybe_ownable && !by_ref)
+          {
+             _eo_parser_log(&tp->base, "opaque structs must be by reference");
+             return EINA_FALSE;
+          }
+     }
+
    /* not marked @move, or marked @by_ref; just validate */
    if (!move || by_ref)
       return EINA_TRUE;
@@ -322,7 +332,7 @@ _validate_type_by_ref(Validate_State *vals, Eolian_Type *tp,
    if (!_validate_type(vals, tp, by_ref, is_ret))
      return EINA_FALSE;
 
-   return _validate_by_ref(tp, by_ref, move);
+   return _validate_by_ref(vals, tp, by_ref, move);
 }
 
 static Eina_Bool

-- 


Reply via email to