summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar/type_function_declaration.hpp
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-08-07 15:49:36 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2019-08-07 16:14:27 -0300
commitccd5441b8f3fae59ddb9d3dcd75cb00340c8278c (patch)
tree405f25d597f13fcb17c23c2a19a33feb5501fb3c /src/lib/eolian_cxx/grammar/type_function_declaration.hpp
parentb6bc80d2da947b858a25a18ed2c084f6ae7e02cf (diff)
cxx: Fix funcptr c_args declaration.
Summary: The internal wrapper was generating the argument types directly instead of passing through the translation generator `grammar::c_type`. This caused the type in the `caller` callback to be different from the actual C type of the declared function pointer, like in `@out` parameters. Reviewers: tasn, felipealmeida Reviewed By: felipealmeida Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9524
Diffstat (limited to '')
-rw-r--r--src/lib/eolian_cxx/grammar/type_function_declaration.hpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/eolian_cxx/grammar/type_function_declaration.hpp b/src/lib/eolian_cxx/grammar/type_function_declaration.hpp
index 71ca630f94..fcd094fdf5 100644
--- a/src/lib/eolian_cxx/grammar/type_function_declaration.hpp
+++ b/src/lib/eolian_cxx/grammar/type_function_declaration.hpp
@@ -56,10 +56,15 @@ struct type_function_declaration_generator {
56 56
57 std::vector<std::string> c_args; 57 std::vector<std::string> c_args;
58 for (auto itr : f.parameters) 58 for (auto itr : f.parameters)
59 c_args.push_back(", " + itr.type.c_type + " " + itr.param_name); 59 {
60 std::string arg;
61 if (!as_generator(grammar::c_type << " " << string).generate(std::back_inserter(arg), std::make_tuple(itr, itr.param_name), ctx))
62 return false;
63 c_args.push_back(arg);
64 }
60 if (!as_generator( 65 if (!as_generator(
61 scope_tab << "static " << string << " caller(void *cxx_call_data" 66 scope_tab << "static " << string << " caller(void *cxx_call_data"
62 << *(string) << ") {\n" 67 << *(", " << string) << ") {\n"
63 << scope_tab << scope_tab << "auto fw = static_cast<function_wrapper<" 68 << scope_tab << scope_tab << "auto fw = static_cast<function_wrapper<"
64 << string << ", F, ::efl::eolian::" << string << "__function_tag>*>(cxx_call_data);\n" 69 << string << ", F, ::efl::eolian::" << string << "__function_tag>*>(cxx_call_data);\n"
65 ).generate(sink, std::make_tuple(f.return_type.c_type, c_args, f.c_name, f.c_name), ctx)) 70 ).generate(sink, std::make_tuple(f.return_type.c_type, c_args, f.c_name, f.c_name), ctx))