]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: remove unused fields
authorIan Lance Taylor <iant@golang.org>
Wed, 21 Dec 2022 20:00:13 +0000 (12:00 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 22 Dec 2022 22:26:14 +0000 (14:26 -0800)
This avoids clang warnings:

gcc/go/gofrontend/escape.cc:1290:17: warning: private field 'fn_' is not used [-Wunused-private-field]
gcc/go/gofrontend/escape.cc:3478:19: warning: private field 'context_' is not used [-Wunused-private-field]
gcc/go/gofrontend/lex.h:564:15: warning: private field 'input_file_name_' is not used [-Wunused-private-field]
gcc/go/gofrontend/types.cc:5788:20: warning: private field 'call_' is not used [-Wunused-private-field]
gcc/go/gofrontend/wb.cc:206:9: warning: private field 'gogo_' is not used [-Wunused-private-field]

Path by Martin Liška.

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458975

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/escape.cc
gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/gogo.h
gcc/go/gofrontend/lex.h
gcc/go/gofrontend/types.cc
gcc/go/gofrontend/types.h
gcc/go/gofrontend/wb.cc

index d123c746fb25917458bcc2c024f005c6d2e5fe91..4a1a4c8c021b550a7e47ac0cc92cb5a81cb5e0a5 100644 (file)
@@ -1,4 +1,4 @@
-ecc2a2e70e44fa76a75b12d0893bc1702b72a1b4
+8c786f716c58d7973623c2b9293e2ad360877817
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index 6da29edc419f6d40d8690fac9d8c1c079600ec64..89e644278fc73dcfebf02ff65cb08ec8673c9a42 100644 (file)
@@ -990,7 +990,7 @@ Gogo::analyze_escape()
       for (std::vector<Named_object*>::iterator fn = stack.begin();
            fn != stack.end();
            ++fn)
-        this->tag_function(context, *fn);
+       this->tag_function(*fn);
 
       if (this->debug_escape_level() != 0)
        {
@@ -1246,10 +1246,10 @@ Escape_analysis_loop::statement(Block*, size_t*, Statement* s)
 class Escape_analysis_assign : public Traverse
 {
 public:
-  Escape_analysis_assign(Escape_context* context, Named_object* fn)
+  Escape_analysis_assign(Escape_context* context)
     : Traverse(traverse_statements
               | traverse_expressions),
-      context_(context), fn_(fn)
+      context_(context)
   { }
 
   // Model statements within a function as assignments and flows between nodes.
@@ -1286,8 +1286,6 @@ public:
 private:
   // The escape context for this set of functions.
   Escape_context* context_;
-  // The current function being analyzed.
-  Named_object* fn_;
 };
 
 // Helper function to detect self assignment like the following.
@@ -2899,7 +2897,7 @@ Gogo::assign_connectivity(Escape_context* context, Named_object* fn)
   int save_depth = context->loop_depth();
   context->set_loop_depth(1);
 
-  Escape_analysis_assign ea(context, fn);
+  Escape_analysis_assign ea(context);
   Function::Results* res = fn->func_value()->result_variables();
   if (res != NULL)
     {
@@ -3465,17 +3463,13 @@ Gogo::propagate_escape(Escape_context* context, Node* dst)
 class Escape_analysis_tag
 {
  public:
-  Escape_analysis_tag(Escape_context* context)
-    : context_(context)
+  Escape_analysis_tag()
   { }
 
   // Add notes to the function's type about the escape information of its
   // input parameters.
   void
   tag(Named_object* fn);
-
- private:
-  Escape_context* context_;
 };
 
 void
@@ -3580,9 +3574,9 @@ Escape_analysis_tag::tag(Named_object* fn)
 // retain analysis results across imports.
 
 void
-Gogo::tag_function(Escape_context* context, Named_object* fn)
+Gogo::tag_function(Named_object* fn)
 {
-  Escape_analysis_tag eat(context);
+  Escape_analysis_tag eat;
   eat.tag(fn);
 }
 
index 71838b146294e83c11fcc3e1f23d19e19a5f8f4b..53901306ef7d315e25a7467baf13be7a156b5365 100644 (file)
@@ -12500,7 +12500,7 @@ Call_expression::do_type()
   else if (results->size() == 1)
     ret = results->begin()->type();
   else
-    ret = Type::make_call_multiple_result_type(this);
+    ret = Type::make_call_multiple_result_type();
 
   this->type_ = ret;
 
index 433fdaebb66215a17c331a396404fc9e9619fe58..c08a16b74c279cd9dd543aa5a47b43f0ece101d9 100644 (file)
@@ -879,7 +879,7 @@ class Gogo
   // Add notes about the escape level of a function's input and output
   // parameters for exporting and importing top level functions.
   void
-  tag_function(Escape_context*, Named_object*);
+  tag_function(Named_object*);
 
   // Reclaim memory of escape analysis Nodes.
   void
index 1c4cc5bd2a1323a1f1329789dcaae8fbbd22c504..701e5d4b353ba310f847b9d4afb4f5f0a86638ac 100644 (file)
@@ -561,7 +561,7 @@ class Lex
   gather_embed(const char*, const char*);
 
   // The input file name.
-  const char* input_file_name_;
+  const char* input_file_name_ ATTRIBUTE_UNUSED;
   // The input file.
   FILE* input_file_;
   // The object used to keep track of file names and line numbers.
index 9f34801f6950e353da550d07ca8d01d56b1cbbfd..7f471eab428116cd21f7593469e0805f73b37770 100644 (file)
@@ -5747,9 +5747,8 @@ Type::make_nil_type()
 class Call_multiple_result_type : public Type
 {
  public:
-  Call_multiple_result_type(Call_expression* call)
-    : Type(TYPE_CALL_MULTIPLE_RESULT),
-      call_(call)
+  Call_multiple_result_type()
+    : Type(TYPE_CALL_MULTIPLE_RESULT)
   { }
 
  protected:
@@ -5782,18 +5781,14 @@ class Call_multiple_result_type : public Type
   void
   do_mangled_name(Gogo*, std::string*, bool*) const
   { go_assert(saw_errors()); }
-
- private:
-  // The expression being called.
-  Call_expression* call_;
 };
 
 // Make a call result type.
 
 Type*
-Type::make_call_multiple_result_type(Call_expression* call)
+Type::make_call_multiple_result_type()
 {
-  return new Call_multiple_result_type(call);
+  return new Call_multiple_result_type;
 }
 
 // Class Struct_field.
index 49404bd612729c3afdf5f67924ea0a97af2fda31..057fa014cee5d578fd3c56af829be29a03a34017 100644 (file)
@@ -535,7 +535,7 @@ class Type
   make_nil_type();
 
   static Type*
-  make_call_multiple_result_type(Call_expression*);
+  make_call_multiple_result_type();
 
   static Struct_type*
   make_struct_type(Struct_field_list* fields, Location);
index 104c5db0b9bc6d3152ed9ef610b3e85c2106733c..e039c668847a0a357552fcebb26f8e6f6c27d1fd 100644 (file)
@@ -191,9 +191,8 @@ Mark_address_taken::expression(Expression** pexpr)
 class Check_escape : public Traverse
 {
  public:
-  Check_escape(Gogo* gogo)
-    : Traverse(traverse_expressions | traverse_variables),
-      gogo_(gogo)
+  Check_escape()
+    : Traverse(traverse_expressions | traverse_variables)
   { }
 
   int
@@ -201,9 +200,6 @@ class Check_escape : public Traverse
 
   int
   variable(Named_object*);
-
- private:
-  Gogo* gogo_;
 };
 
 int
@@ -664,7 +660,7 @@ Gogo::add_write_barriers()
     {
       this->propagate_writebarrierrec();
 
-      Check_escape chk(this);
+      Check_escape chk;
       this->traverse(&chk);
     }