This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch eolian/improvements
in repository efl.

View the commit online.

commit 8b8a3b1308016829ad800057e13423b9b417aa0a
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 21 13:47:01 2026 -0600

    eolian: read the return qualifiers of a function pointer
    
    parse_return() skipped its whole qualifier loop for function pointers,
    and the function pointer path then stored @move, @by_ref, @nullable and
    @no_unused as false. A callback return carrying one of them was not
    refused, as a reader of the parser would expect, nor honoured: the
    .eo failed to parse with "unexpected symbol" and an assert in the lexer
    cleanup, so a callback could never say that it hands ownership of
    what it returns to its caller.
    
    The qualifiers are now read for function pointers as they are for
    methods, and stored on the function.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/lib/eolian/eo_parser.c                 | 15 +++++++++------
 src/tests/eolian/data/function_types.eot   |  5 +++++
 src/tests/eolian/data/function_types_ref.h |  2 ++
 src/tests/eolian/eolian_parsing.c          |  8 ++++++++
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/src/lib/eolian/eo_parser.c b/src/lib/eolian/eo_parser.c
index ed6b888636..c582468b81 100644
--- a/src/lib/eolian/eo_parser.c
+++ b/src/lib/eolian/eo_parser.c
@@ -1031,7 +1031,7 @@ typedef struct _Eo_Ret_Def
 
 static void
 parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void,
-             Eina_Bool allow_def, Eina_Bool is_funcptr)
+             Eina_Bool allow_def)
 {
    eo_lexer_get(ls);
    check_next(ls, ':');
@@ -1056,7 +1056,7 @@ parse_return(Eo_Lexer *ls, Eo_Ret_Def *ret, Eina_Bool allow_void,
      }
    Eina_Bool has_no_unused = EINA_FALSE, has_move = EINA_FALSE,
              has_by_ref = EINA_FALSE, has_nullable = EINA_FALSE;
-   if (!is_funcptr) for (;;) switch (ls->t.kw)
+   for (;;) switch (ls->t.kw)
      {
       case KW_at_no_unused:
         CASE_LOCK(ls, no_unused, "no_unused qualifier");
@@ -1265,7 +1265,7 @@ parse_accessor:
       case KW_return:
         CASE_LOCK(ls, return, "return")
         Eo_Ret_Def ret;
-        parse_return(ls, &ret, is_get, EINA_TRUE, EINA_FALSE);
+        parse_return(ls, &ret, is_get, EINA_TRUE);
         if (ret.default_ret_val)
           eo_lexer_expr_release_ref(ls, ret.default_ret_val);
         if (is_get)
@@ -1496,11 +1496,14 @@ tags_done:
       case KW_return:
         CASE_LOCK(ls, return, "return");
         Eo_Ret_Def ret;
-        parse_return(ls, &ret, EINA_FALSE, EINA_FALSE, EINA_TRUE);
+        parse_return(ls, &ret, EINA_FALSE, EINA_FALSE);
         meth->get_ret_type = eo_lexer_type_release(ls, ret.type);
         meth->get_return_doc = ret.doc;
         meth->get_ret_val = NULL;
-        meth->get_return_no_unused = EINA_FALSE;
+        meth->get_return_no_unused = ret.no_unused;
+        meth->get_return_move = ret.move;
+        meth->get_return_by_ref = ret.by_ref;
+        meth->get_return_nullable = ret.nullable;
         break;
       case KW_params:
         CASE_LOCK(ls, params, "params definition");
@@ -1590,7 +1593,7 @@ body:
       case KW_return:
         CASE_LOCK(ls, return, "return")
         Eo_Ret_Def ret;
-        parse_return(ls, &ret, EINA_FALSE, EINA_TRUE, EINA_FALSE);
+        parse_return(ls, &ret, EINA_FALSE, EINA_TRUE);
         if (ret.default_ret_val)
           eo_lexer_expr_release_ref(ls, ret.default_ret_val);
         meth->get_ret_type = eo_lexer_type_release(ls, ret.type);
diff --git a/src/tests/eolian/data/function_types.eot b/src/tests/eolian/data/function_types.eot
index 5012d2e47b..546b60dc9f 100644
--- a/src/tests/eolian/data/function_types.eot
+++ b/src/tests/eolian/data/function_types.eot
@@ -21,6 +21,11 @@ function ComplexFunc {
   return: double;
 };
 
+// typedef char *(*OwnedFunc)(void *data);
+function OwnedFunc {
+  return: mstring @move @no_unused;
+};
+
 // typedef void (*FuncAsArgFunc)(void *data, VoidFunc cb, SimpleFunc another_cb);
 function FuncAsArgFunc {
   params {
diff --git a/src/tests/eolian/data/function_types_ref.h b/src/tests/eolian/data/function_types_ref.h
index 45564c6893..13a30ba46d 100644
--- a/src/tests/eolian/data/function_types_ref.h
+++ b/src/tests/eolian/data/function_types_ref.h
@@ -10,6 +10,8 @@ typedef const char * (*SimpleFunc)(void *data, int a, double b);
 
 typedef double (*ComplexFunc)(void *data, const char *c, char **d EFL_TRANSFER_OWNERSHIP);
 
+typedef char * (*OwnedFunc)(void *data);
+
 typedef void (*FuncAsArgFunc)(void *data, void *cb_data, VoidFunc cb, Eina_Free_Cb cb_free_cb, void *another_cb_data, SimpleFunc another_cb, Eina_Free_Cb another_cb_free_cb);
 
 
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index bde3934e2a..193ae1ebe4 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -1383,6 +1383,14 @@ EFL_START_TEST(eolian_function_types)
 
    fail_if(eina_iterator_next(iter, &dummy));
 
+   /* Function pointer whose return carries qualifiers */
+   fail_if(!(decl = eolian_unit_alias_by_name_get(unit, "OwnedFunc")));
+   fail_if(!(fid = eolian_typedecl_function_pointer_get(decl)));
+   fail_if(!(type_name = eolian_function_return_c_type_get(fid, EOLIAN_FUNCTION_POINTER)));
+   fail_if(strcmp(type_name, "char *"));
+   fail_if(!eolian_function_return_is_move(fid, EOLIAN_FUNCTION_POINTER));
+   fail_if(eolian_function_return_allow_unused(fid, EOLIAN_FUNCTION_POINTER));
+
    /* Function pointer receiving another function pointer */
    fail_if(!(decl = eolian_unit_alias_by_name_get(unit, "FuncAsArgFunc")));
    fail_if(eolian_typedecl_type_get(decl) != EOLIAN_TYPEDECL_FUNCTION_POINTER);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to