From 3decc47f0e6d90491a0b4d442f12559c7c542534 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 22 Feb 2023 00:55:08 +0000 Subject: [PATCH] Fix build tests To test generated codes, the codes should be set in the CMakeLists.txt file. This patch fixes the build failure issues. Change-Id: I7c77c4d457e2307bfc6ff10f113ee9dc3850c51b Signed-off-by: Hwankyu Jhun --- idlc/gen/version2/c_body_generator_base.cc | 17 ++++++++++---- idlc/gen/version2/c_proxy_body_generator_cb.hh | 32 +++++++++++++------------- tests/build_tests/CMakeLists.txt | 10 ++++++++ tests/build_tests/tidl/DataPort_v2.tidl | 2 +- 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/idlc/gen/version2/c_body_generator_base.cc b/idlc/gen/version2/c_body_generator_base.cc index 115baf1..26c2d87 100644 --- a/idlc/gen/version2/c_body_generator_base.cc +++ b/idlc/gen/version2/c_body_generator_base.cc @@ -1148,14 +1148,13 @@ void CBodyGeneratorBase::AddParameterType(const Interface& iface, void CBodyGeneratorBase::AddParameterType( std::shared_ptr param_type) { - if (param_type->GetBaseType().GetUserDefinedType() == BaseType::UserType::ENUM) + auto& type = param_type->GetBaseType(); + if (type.GetUserDefinedType() == BaseType::UserType::ENUM) return; std::string key = param_type->GetBaseType().GetFullName(true) + std::to_string(static_cast(param_type->GetDirection())); - key = GetEnumTypeString(key); - if (param_types_.find(key) != param_types_.end()) return; @@ -1212,8 +1211,16 @@ void CBodyGeneratorBase::GenParameterMap() { if (decl->GetMethodType() == Declaration::MethodType::DELEGATE) { AddParameterType(iface, type, ParameterType::Direction::OUT); } else { - AddParameterType(iface, type, - param->GetParameterType().GetDirection()); + auto direction = param->GetParameterType().GetDirection(); + if (direction == ParameterType::Direction::REF) { + AddParameterType(iface, type, + ParameterType::Direction::IN); + AddParameterType(iface, type, + ParameterType::Direction::OUT); + } else { + AddParameterType(iface, type, + param->GetParameterType().GetDirection()); + } } } diff --git a/idlc/gen/version2/c_proxy_body_generator_cb.hh b/idlc/gen/version2/c_proxy_body_generator_cb.hh index 38cbe09..ec64a43 100644 --- a/idlc/gen/version2/c_proxy_body_generator_cb.hh +++ b/idlc/gen/version2/c_proxy_body_generator_cb.hh @@ -399,7 +399,7 @@ static void _____delegate_handler(GList **delegates ___h handle; GList *iter; bool once; - int ret; + int ret_; @@ -437,9 +437,9 @@ out: */ constexpr const char CB_INTERFACE_DELEGATE_USER_DEFINED_UNIT_MAP_READ[] = R"__c_cb( -ret = rpc_port_unit_map_read_(map, "", &); -if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read . error(%d)", ret); +ret_ = rpc_port_unit_map_read_(map, "", &); +if (ret_ != RPC_PORT_ERROR_NONE) { + _E("Failed to read . error(%d)", ret_); goto out; } )__c_cb"; @@ -449,9 +449,9 @@ if (ret != RPC_PORT_ERROR_NONE) { */ constexpr const char CB_INTERFACE_DELEGATE_BUNDLE_UNIT_MAP_READ[] = R"__c_cb( -ret = rpc_port_unit_map_read_bundle(map, "", &); -if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read bundle. error(%d)", ret); +ret_ = rpc_port_unit_map_read_bundle(map, "", &); +if (ret_ != RPC_PORT_ERROR_NONE) { + _E("Failed to read bundle. error(%d)", ret_); goto out; } )__c_cb"; @@ -461,9 +461,9 @@ if (ret != RPC_PORT_ERROR_NONE) { */ constexpr const char CB_INTERFACE_DELEGATE_STRING_UNIT_MAP_READ[] = R"__c_cb( -ret = rpc_port_unit_map_read_string(map, "", &); -if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read string. error(%d)", ret); +ret_ = rpc_port_unit_map_read_string(map, "", &); +if (ret_ != RPC_PORT_ERROR_NONE) { + _E("Failed to read string. error(%d)", ret_); goto out; } )__c_cb"; @@ -474,9 +474,9 @@ if (ret != RPC_PORT_ERROR_NONE) { */ constexpr const char CB_INTERFACE_DELEGATE_ENUM_UNIT_MAP_READ[] = R"__c_cb( -ret = rpc_port_unit_map_read_int(map, "", (int *)&); -if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read . error(%d)", ret); +ret_ = rpc_port_unit_map_read_int(map, "", (int *)&); +if (ret_ != RPC_PORT_ERROR_NONE) { + _E("Failed to read . error(%d)", ret_); goto out; } )__c_cb"; @@ -488,9 +488,9 @@ if (ret != RPC_PORT_ERROR_NONE) { */ constexpr const char CB_INTERFACE_DELEGATE_BASE_UNIT_MAP_READ[] = R"__c_cb( -ret = rpc_port_unit_map_read_(map, "", &); -if (ret != RPC_PORT_ERROR_NONE) { - _E("Failed to read . error(%d)", ret); +ret_ = rpc_port_unit_map_read_(map, "", &); +if (ret_ != RPC_PORT_ERROR_NONE) { + _E("Failed to read . error(%d)", ret_); goto out; } )__c_cb"; diff --git a/tests/build_tests/CMakeLists.txt b/tests/build_tests/CMakeLists.txt index 913fee4..e60f551 100644 --- a/tests/build_tests/CMakeLists.txt +++ b/tests/build_tests/CMakeLists.txt @@ -95,6 +95,16 @@ SET(TIDL_GEN_SRCS FooPubsubGroupC.c FooPubsubCionGroup.cc FooPubsubCionGroupC.c + Message_v2ProxyC.c + Message_v2StubC.c + Buffer_v2ProxyC.c + Buffer_v2StubC.c + Ex_v2ProxyC.c + Ex_v2StubC.c + DataPort_v2ProxyC.c + DataPort_v2StubC.c + Foo_v2ProxyC.c + Foo_v2StubC.c ) ADD_CUSTOM_COMMAND(OUTPUT ${TIDL_GEN_SRCS} PRE_BUILD diff --git a/tests/build_tests/tidl/DataPort_v2.tidl b/tests/build_tests/tidl/DataPort_v2.tidl index 76df6e8..7d71162 100644 --- a/tests/build_tests/tidl/DataPort_v2.tidl +++ b/tests/build_tests/tidl/DataPort_v2.tidl @@ -1,7 +1,6 @@ protocol 2 struct CursorContext { - int Handle; enum position { LEFT, RIGHT, @@ -9,6 +8,7 @@ struct CursorContext { TOP, BOTTOM, } + int Handle; } struct Pair { -- 2.7.4