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
This commit is contained in:
Lauro Moura 2019-08-07 15:49:36 -03:00 committed by Felipe Magno de Almeida
parent b6bc80d2da
commit ccd5441b8f
1 changed files with 7 additions and 2 deletions

View File

@ -56,10 +56,15 @@ struct type_function_declaration_generator {
std::vector<std::string> c_args;
for (auto itr : f.parameters)
c_args.push_back(", " + itr.type.c_type + " " + itr.param_name);
{
std::string arg;
if (!as_generator(grammar::c_type << " " << string).generate(std::back_inserter(arg), std::make_tuple(itr, itr.param_name), ctx))
return false;
c_args.push_back(arg);
}
if (!as_generator(
scope_tab << "static " << string << " caller(void *cxx_call_data"
<< *(string) << ") {\n"
<< *(", " << string) << ") {\n"
<< scope_tab << scope_tab << "auto fw = static_cast<function_wrapper<"
<< string << ", F, ::efl::eolian::" << string << "__function_tag>*>(cxx_call_data);\n"
).generate(sink, std::make_tuple(f.return_type.c_type, c_args, f.c_name, f.c_name), ctx))