This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold patch committed: Avoid unused variable warnings


This patch avoids unused variable warnings from current gcc.  In a few
cases it corrects the test of whether a value was added to a map.
Committed.

Ian


2010-07-13  Philip Herron  <herron.philip@googlemail.com>
	    Ian Lance Taylor  <iant@google.com>

	* output.h (Output_section_lookup_maps::add_merge_section):
	Correct check of whether value was inserted.
	(Output_section_lookup_maps::add_merge_input_section): Likewise.
	(Output_section_lookup_maps::add_relaxed_input_section):
	Likewise.
	* arm.cc (Target_arm::got_section): Remove used local os.
	* i386.cc (Target_i386::got_section): Likewise.
	* x86_64.cc (Target_x86_64::got_section): Likewise.
	* sparc.cc (Target_sparc::got_section): Likewise.
	(Target_sparc::relocate): Remove unused local have_got_offset.
	* powerpc.cc (Target_powerpc::relocate): Likewise.


Index: arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.111
diff -p -u -r1.111 arm.cc
--- arm.cc	30 Jun 2010 06:41:09 -0000	1.111
+++ arm.cc	13 Jul 2010 11:59:59 -0000
@@ -4116,22 +4116,20 @@ Target_arm<big_endian>::got_section(Symb
 
       this->got_ = new Arm_output_data_got<big_endian>(symtab, layout);
 
-      Output_section* os;
-      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
-					   (elfcpp::SHF_ALLOC
-					    | elfcpp::SHF_WRITE),
-					   this->got_, false, false, false,
-					   true);
+      layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
+				      (elfcpp::SHF_ALLOC
+				       | elfcpp::SHF_WRITE),
+				      this->got_, false, false, false, true);
       // The old GNU linker creates a .got.plt section.  We just
       // create another set of data in the .got section.  Note that we
       // always create a PLT if we create a GOT, although the PLT
       // might be empty.
       this->got_plt_ = new Output_data_space(4, "** GOT PLT");
-      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
-					   (elfcpp::SHF_ALLOC
-					    | elfcpp::SHF_WRITE),
-					   this->got_plt_, false, false,
-					   false, false);
+      layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
+				      (elfcpp::SHF_ALLOC
+				       | elfcpp::SHF_WRITE),
+				      this->got_plt_, false, false, false,
+				      false);
 
       // The first three entries are reserved.
       this->got_plt_->set_current_data_size(3 * 4);
Index: i386.cc
===================================================================
RCS file: /cvs/src/src/gold/i386.cc,v
retrieving revision 1.117
diff -p -u -r1.117 i386.cc
--- i386.cc	11 Mar 2010 01:18:26 -0000	1.117
+++ i386.cc	13 Jul 2010 11:59:59 -0000
@@ -494,19 +494,17 @@ Target_i386::got_section(Symbol_table* s
 
       this->got_ = new Output_data_got<32, false>();
 
-      Output_section* os;
-      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
-					   (elfcpp::SHF_ALLOC
-					    | elfcpp::SHF_WRITE),
-					   this->got_, false, true, true,
-					   false);
+      layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
+				      (elfcpp::SHF_ALLOC
+				       | elfcpp::SHF_WRITE),
+				      this->got_, false, true, true, false);
 
       this->got_plt_ = new Output_data_space(4, "** GOT PLT");
-      os = layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
-					   (elfcpp::SHF_ALLOC
-					    | elfcpp::SHF_WRITE),
-					   this->got_plt_, false, false, false,
-					   true);
+      layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
+				      (elfcpp::SHF_ALLOC
+				       | elfcpp::SHF_WRITE),
+				      this->got_plt_, false, false, false,
+				      true);
 
       // The first three entries are reserved.
       this->got_plt_->set_current_data_size(3 * 4);
Index: output.h
===================================================================
RCS file: /cvs/src/src/gold/output.h,v
retrieving revision 1.107
diff -p -u -r1.107 output.h
--- output.h	1 Jun 2010 23:37:58 -0000	1.107
+++ output.h	13 Jul 2010 12:00:00 -0000
@@ -2432,7 +2432,7 @@ class Output_section_lookup_maps
     std::pair<Merge_section_properties, Output_merge_base*> value(msp, pomb);
     std::pair<Merge_sections_by_properties::iterator, bool> result =
       this->merge_sections_by_properties_.insert(value);
-    gold_assert(value.second);
+    gold_assert(result.second);
   }
   
   // Add a mapping from a merged input section in OBJECT with index SHNDX
@@ -2445,7 +2445,7 @@ class Output_section_lookup_maps
     std::pair<Const_section_id, Output_merge_base*> value(csid, pomb);
     std::pair<Merge_sections_by_id::iterator, bool> result =
       this->merge_sections_by_id_.insert(value);
-    gold_assert(value.second);
+    gold_assert(result.second);
   }
 
   // Find a relaxed input section of OBJECT with index SHNDX.
@@ -2469,7 +2469,7 @@ class Output_section_lookup_maps
       value(csid, poris);
     std::pair<Relaxed_input_sections_by_id::iterator, bool> result =
       this->relaxed_input_sections_by_id_.insert(value);
-    gold_assert(value.second);
+    gold_assert(result.second);
   }
 
  private:
Index: powerpc.cc
===================================================================
RCS file: /cvs/src/src/gold/powerpc.cc,v
retrieving revision 1.29
diff -p -u -r1.29 powerpc.cc
--- powerpc.cc	13 Feb 2010 02:04:20 -0000	1.29
+++ powerpc.cc	13 Jul 2010 12:00:00 -0000
@@ -1636,7 +1636,6 @@ Target_powerpc<size, big_endian>::Reloca
   // Get the GOT offset if needed.  Unlike i386 and x86_64, our GOT
   // pointer points to the beginning, not the end, of the table.
   // So we just use the plain offset.
-  bool have_got_offset = false;
   unsigned int got_offset = 0;
   unsigned int got2_offset = 0;
   switch (r_type)
@@ -1668,7 +1667,6 @@ Target_powerpc<size, big_endian>::Reloca
           gold_assert(object->local_has_got_offset(r_sym, GOT_TYPE_STANDARD));
           got_offset = object->local_got_offset(r_sym, GOT_TYPE_STANDARD);
         }
-      have_got_offset = true;
       break;
 
       // R_PPC_PLTREL24 is rather special.  If non-zero,
@@ -1681,7 +1679,6 @@ Target_powerpc<size, big_endian>::Reloca
 	  got2_offset = got2->offset();
 	  addend += got2_offset;
 	}
-      have_got_offset = true;
       break;
 
     default:
Index: sparc.cc
===================================================================
RCS file: /cvs/src/src/gold/sparc.cc,v
retrieving revision 1.38
diff -p -u -r1.38 sparc.cc
--- sparc.cc	10 Mar 2010 17:07:26 -0000	1.38
+++ sparc.cc	13 Jul 2010 12:00:00 -0000
@@ -1045,12 +1045,10 @@ Target_sparc<size, big_endian>::got_sect
 
       this->got_ = new Output_data_got<size, big_endian>();
 
-      Output_section* os;
-      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
-					   (elfcpp::SHF_ALLOC
-					    | elfcpp::SHF_WRITE),
-					   this->got_, false, true, false,
-					   false);
+      layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
+				      (elfcpp::SHF_ALLOC
+				       | elfcpp::SHF_WRITE),
+				      this->got_, false, true, false, false);
 
       // Define _GLOBAL_OFFSET_TABLE_ at the start of the .got section.
       symtab->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL,
@@ -2474,7 +2472,6 @@ Target_sparc<size, big_endian>::Relocate
   // Get the GOT offset if needed.  Unlike i386 and x86_64, our GOT
   // pointer points to the beginning, not the end, of the table.
   // So we just use the plain offset.
-  bool have_got_offset = false;
   unsigned int got_offset = 0;
   switch (r_type)
     {
@@ -2495,7 +2492,6 @@ Target_sparc<size, big_endian>::Relocate
           gold_assert(object->local_has_got_offset(r_sym, GOT_TYPE_STANDARD));
           got_offset = object->local_got_offset(r_sym, GOT_TYPE_STANDARD);
         }
-      have_got_offset = true;
       break;
 
     default:
Index: x86_64.cc
===================================================================
RCS file: /cvs/src/src/gold/x86_64.cc,v
retrieving revision 1.108
diff -p -u -r1.108 x86_64.cc
--- x86_64.cc	20 Apr 2010 21:13:30 -0000	1.108
+++ x86_64.cc	13 Jul 2010 12:00:00 -0000
@@ -547,19 +547,17 @@ Target_x86_64::got_section(Symbol_table*
 
       this->got_ = new Output_data_got<64, false>();
 
-      Output_section* os;
-      os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
-					   (elfcpp::SHF_ALLOC
-					    | elfcpp::SHF_WRITE),
-					   this->got_, false, true, true,
-					   false);
+      layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
+				      (elfcpp::SHF_ALLOC
+				       | elfcpp::SHF_WRITE),
+				      this->got_, false, true, true, false);
 
       this->got_plt_ = new Output_data_space(8, "** GOT PLT");
-      os = layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
-					   (elfcpp::SHF_ALLOC
-					    | elfcpp::SHF_WRITE),
-					   this->got_plt_, false, false,
-					   false, true);
+      layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
+				      (elfcpp::SHF_ALLOC
+				       | elfcpp::SHF_WRITE),
+				      this->got_plt_, false, false, false,
+				      true);
 
       // The first three entries are reserved.
       this->got_plt_->set_current_data_size(3 * 8);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]