From: Felipe Magno de Almeida Date: Tue, 26 Sep 2017 00:57:25 +0000 (-0300) Subject: eolian-cxx: Fix compilation errors with new any_value_ptr and mstring types X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~2509 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb887f9869c3dd9eca72c8e65f335d148f9dbdd3;p=platform%2Fupstream%2Fefl.git eolian-cxx: Fix compilation errors with new any_value_ptr and mstring types --- diff --git a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh index d5f31d3..2f9b638 100644 --- a/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh +++ b/src/bindings/cxx/eo_cxx/eo_cxx_interop.hh @@ -394,7 +394,11 @@ inline char* convert_to_c_impl( ::efl::eina::string_view v, tag) +inline char** convert_to_c_impl(efl::eina::string_view& /*view*/, tag) +{ + std::abort(); +} +inline const char** convert_to_c_impl(efl::eina::string_view& /*view*/, tag) { std::abort(); } diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp index bb61980..fb78c1e 100644 --- a/src/lib/eolian_cxx/grammar/type_impl.hpp +++ b/src/lib/eolian_cxx/grammar/type_impl.hpp @@ -110,6 +110,24 @@ struct visitor_generate r.base_qualifier.qualifier ^= qualifier_info::is_ref; return replace_base_type(r, " ::efl::eina::string_view"); }} + , {"mstring", false, nullptr, nullptr, [&] + { + regular_type_def r = regular; + r.base_qualifier.qualifier |= qualifier_info::is_ref; + // r.base_qualifier.qualifier ^= qualifier_info::is_const; + if(is_out || is_return) + return replace_base_type(r, " ::std::string"); + return replace_base_type(r, " ::efl::eina::string_view"); + }} + , {"mstring", true, nullptr, nullptr, [&] + { + regular_type_def r = regular; + r.base_qualifier.qualifier ^= qualifier_info::is_ref; + // r.base_qualifier.qualifier ^= qualifier_info::is_const; + if(is_out || is_return) + return replace_base_type(r, " ::std::string"); + return replace_base_type(r, " ::efl::eina::string_view"); + }} , {"stringshare", nullptr, nullptr, nullptr, [&] { regular_type_def r = regular; @@ -124,6 +142,13 @@ struct visitor_generate , {"any_value", false, nullptr, nullptr, [&] { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier, {}}; }} + , {"any_value_ptr", true, nullptr, nullptr, [&] + { + return regular_type_def{" ::efl::eina::value", regular.base_qualifier ^ qualifier_info::is_ref, {}}; + }} + , {"any_value_ptr", false, nullptr, nullptr, [&] + { return regular_type_def{" ::efl::eina::value_view", regular.base_qualifier ^ qualifier_info::is_ref, {}}; + }} }; if(regular.base_type == "void_ptr") { diff --git a/src/tests/eolian_cxx/name1_name2_type_generation.c b/src/tests/eolian_cxx/name1_name2_type_generation.c index 26dc899..2517bcd 100644 --- a/src/tests/eolian_cxx/name1_name2_type_generation.c +++ b/src/tests/eolian_cxx/name1_name2_type_generation.c @@ -102,7 +102,7 @@ void _name1_name2_type_generation_instringshareown(Eo *obj EINA_UNUSED, Type_Gen eina_stringshare_del(v); } -void _name1_name2_type_generation_instringptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, char * *v) +void _name1_name2_type_generation_instringptrown(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED, const char * *v) { ck_assert_str_eq(*v, "foobar"); free((void*)*v); @@ -197,7 +197,7 @@ char * _name1_name2_type_generation_returnstringown(Eo *obj EINA_UNUSED, Type_Ge return p; } -char * * _name1_name2_type_generation_returnstringownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) +const char * * _name1_name2_type_generation_returnstringownptr(Eo *obj EINA_UNUSED, Type_Generation_Data *pd EINA_UNUSED) { const char foobar[] = "foobar"; char** p1 = malloc(sizeof(const char*));