Fix build tests 02/288702/1
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 22 Feb 2023 00:55:08 +0000 (00:55 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Wed, 22 Feb 2023 01:24:09 +0000 (01:24 +0000)
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 <h.jhun@samsung.com>
idlc/gen/version2/c_body_generator_base.cc
idlc/gen/version2/c_proxy_body_generator_cb.hh
tests/build_tests/CMakeLists.txt
tests/build_tests/tidl/DataPort_v2.tidl

index 115baf170cff12b310248b6144db847b03f6170e..26c2d87e940aa4fe1b7a940c392224869f235944 100644 (file)
@@ -1148,14 +1148,13 @@ void CBodyGeneratorBase::AddParameterType(const Interface& iface,
 
 void CBodyGeneratorBase::AddParameterType(
     std::shared_ptr<ParameterType> 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<int>(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());
+            }
           }
         }
 
index 38cbe09555c59b0ad274e33dfff0fc08295001f9..ec64a436a53a3b2df4b1bd05736d3870f164f3e2 100644 (file)
@@ -399,7 +399,7 @@ static void __<PREFIX>_<NAME>_<DELEGATE_NAME>_delegate_handler(GList **delegates
   <PREFIX>_<NAME>_<DELEGATE_NAME>_h handle;
   GList *iter;
   bool once;
-  int ret;
+  int ret_;
   <DELEGATE_ARGS_DECL>
 
   <DELEGATE_UNIT_MAP_READ>
@@ -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_<TYPE_NAME>(map, "<ARG>", &<ARG>);
-if (ret != RPC_PORT_ERROR_NONE) {
-  _E("Failed to read <TYPE_NAME>. error(%d)", ret);
+ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG>", &<ARG>);
+if (ret_ != RPC_PORT_ERROR_NONE) {
+  _E("Failed to read <TYPE_NAME>. 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, "<ARG>", &<ARG>);
-if (ret != RPC_PORT_ERROR_NONE) {
-  _E("Failed to read bundle. error(%d)", ret);
+ret_ = rpc_port_unit_map_read_bundle(map, "<ARG>", &<ARG>);
+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, "<ARG>", &<ARG>);
-if (ret != RPC_PORT_ERROR_NONE) {
-  _E("Failed to read string. error(%d)", ret);
+ret_ = rpc_port_unit_map_read_string(map, "<ARG>", &<ARG>);
+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, "<ARG_NAME>", (int *)&<ARG>);
-if (ret != RPC_PORT_ERROR_NONE) {
-  _E("Failed to read <TYPE_NAME>. error(%d)", ret);
+ret_ = rpc_port_unit_map_read_int(map, "<ARG_NAME>", (int *)&<ARG>);
+if (ret_ != RPC_PORT_ERROR_NONE) {
+  _E("Failed to read <TYPE_NAME>. 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_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
-if (ret != RPC_PORT_ERROR_NONE) {
-  _E("Failed to read <TYPE_NAME>. error(%d)", ret);
+ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
+if (ret_ != RPC_PORT_ERROR_NONE) {
+  _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
   goto out;
 }
 )__c_cb";
index 913fee4cd3953629b4eee705d91db827e7f1e04a..e60f55118a5c1284eadc467b1782f01416aaf1e2 100644 (file)
@@ -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
index 76df6e81eb8a01b6025c5fe118066b7dd0ade4c4..7d7116291a3c27783309f70b421f14e49783c088 100644 (file)
@@ -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 {