From 9a7fc46eca3bbe6eabc079cbc435e4ac3289ffb0 Mon Sep 17 00:00:00 2001
From: Botond Baranyi <botond.baranyi@ericsson.com>
Date: Mon, 14 Jan 2019 17:44:50 +0100
Subject: [PATCH] Removed unused variables and import (bug 542610)

Change-Id: I7ed3d2640fe3d83dda517fce632aa4cfd4b00df6
Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com>
---
 compiler2/ttcn3/Ttcnstuff.cc | 24 +-----------------------
 compiler2/ttcn3/Ttcnstuff.hh |  4 +---
 2 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/compiler2/ttcn3/Ttcnstuff.cc b/compiler2/ttcn3/Ttcnstuff.cc
index 7887633ef..edd351a6e 100644
--- a/compiler2/ttcn3/Ttcnstuff.cc
+++ b/compiler2/ttcn3/Ttcnstuff.cc
@@ -1043,7 +1043,7 @@ namespace Ttcn {
     checked(false), attributes_checked(false), legacy(true),
     in_msgs(0), out_msgs(0), in_sigs(0), out_sigs(0),
     testport_type(TP_REGULAR), port_type(PT_REGULAR),
-    provider_refs(), provider_types(), mapper_types(),
+    provider_refs(), provider_types(),
     in_mappings(0), out_mappings(0), vardefs(defs), realtime(p_realtime)
   {
   }
@@ -1062,7 +1062,6 @@ namespace Ttcn {
     }
     provider_refs.clear();
     provider_types.clear();
-    mapper_types.clear();
     delete in_mappings;
     delete out_mappings;
     delete vardefs;
@@ -1504,9 +1503,6 @@ namespace Ttcn {
               provider_types.add(t);
               n_prov_t++;
               provider_body = t->get_PortBody();
-              if (!legacy) {
-                provider_body->add_mapper_type(my_type);
-              }
             }
           } else {
             provider_refs[p]->error("Type reference `%s' does not refer to a port "
@@ -2496,24 +2492,6 @@ namespace Ttcn {
     defPortClass(&pdef, target);
     if (generate_skeleton && testport_type != TP_INTERNAL &&
         (port_type != PT_USER || !legacy)) generateTestPortSkeleton(&pdef);
-    
-    
-    // Add includes for the mapped types if necessary
-    if (port_type == PT_PROVIDER) {
-      for (size_t i = 0; i < mapper_types.size(); i++) {
-        const Identifier& port_mod_name = mapper_types[i]->get_my_scope()->get_scope_mod()->get_modid();
-        const string& my_mod_name = my_type->get_my_scope()->get_scope_mod()->get_modid().get_ttcnname();
-        if (my_mod_name == port_mod_name.get_ttcnname()) {
-          continue;
-        }
-        char * incl = mprintf("#include \"%s.hh\"\n",
-          duplicate_underscores ? port_mod_name.get_name().c_str() : port_mod_name.get_ttcnname().c_str());
-        if (strstr(target->header.includes, incl) == NULL) {
-          target->header.includes = mputstr(target->header.includes, incl);
-        }
-        Free(incl);
-      }
-    }
 
     Free(pdef.msg_in.elements);
     for (size_t i = 0; i < pdef.msg_out.nElements; i++)
diff --git a/compiler2/ttcn3/Ttcnstuff.hh b/compiler2/ttcn3/Ttcnstuff.hh
index 0a5389a3e..add2522aa 100644
--- a/compiler2/ttcn3/Ttcnstuff.hh
+++ b/compiler2/ttcn3/Ttcnstuff.hh
@@ -402,8 +402,6 @@ private:
   PortType_t port_type; // regular|provider|user
   vector<Ttcn::Reference>provider_refs; ///< references to provider ports, for PT_USER
   vector<Common::Type> provider_types; ///< the types that provider_refs refers to, for PT_USER
-  vector<Common::Type> mapper_types; ///< the types that map this port.
-                                     ///< only for PT_USER && !legacy
   TypeMappings *in_mappings, *out_mappings; ///< mappings for PT_USER
   Definitions *vardefs; ///< variable definitions inside the port
   bool realtime;
@@ -480,7 +478,7 @@ public:
   bool connect_can_receive_or_send(PortTypeBody *p_other) const;
   Type* get_my_type() const { return my_type; }
   bool is_legacy() const { return legacy; }
-  void add_mapper_type(Type* t) { mapper_types.add(t); }
+  //void add_mapper_type(Type* t) { mapper_types.add(t); }
   void generate_code(output_struct *target);
   virtual void dump(unsigned level) const;
 };
-- 
GitLab