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: Remove some unnecessary options arguments


In the old days the options structure was not available from the
parameters global variable, and so it was passed around a lot.  I
committed this patch to gold to remove it from a few places.

Ian


2009-03-13  Ian Lance Taylor  <iant@google.com>

	* fileread.cc (Input_file::open): Remove options parameter.
	Change all callers.
	(Input_file::open_binary): Likewise.
	* script.cc (read_input_script): Likewise.
	* readsyms.h (class Read_symbols): Remove options_ field.  Remove
	options parameter from constructor.  Change all callers.
	(class Read_script): Likewise.
	* fileread.h (class Input_file): Update declarations.
	* script.h (read_input_script): Update declaration.


Index: archive.cc
===================================================================
RCS file: /cvs/src/src/gold/archive.cc,v
retrieving revision 1.39
diff -p -u -r1.39 archive.cc
--- archive.cc	13 Feb 2009 19:04:44 -0000	1.39
+++ archive.cc	13 Mar 2009 21:24:44 -0000
@@ -482,8 +482,7 @@ Archive::get_file_and_offset(off_t off, 
             new Input_file_argument(member_name->c_str(), false, "", false,
                                     parameters->options());
           *input_file = new Input_file(input_file_arg);
-          if (!(*input_file)->open(parameters->options(), *this->dirpath_,
-                                   this->task_))
+          if (!(*input_file)->open(*this->dirpath_, this->task_))
             return false;
           arch = new Archive(*member_name, *input_file, false, this->dirpath_,
                              this->task_);
@@ -502,8 +501,7 @@ Archive::get_file_and_offset(off_t off, 
       new Input_file_argument(member_name->c_str(), false, "", false,
                               this->input_file_->options());
   *input_file = new Input_file(input_file_arg);
-  if (!(*input_file)->open(parameters->options(), *this->dirpath_,
-                           this->task_))
+  if (!(*input_file)->open(*this->dirpath_, this->task_))
     return false;
 
   *memoff = 0;
Index: fileread.cc
===================================================================
RCS file: /cvs/src/src/gold/fileread.cc,v
retrieving revision 1.48
diff -p -u -r1.48 fileread.cc
--- fileread.cc	28 Feb 2009 04:39:57 -0000	1.48
+++ fileread.cc	13 Mar 2009 21:24:44 -0000
@@ -766,8 +766,7 @@ Input_file::just_symbols() const
 // the file location, rather than the current directory.
 
 bool
-Input_file::open(const General_options& options, const Dirsearch& dirpath,
-		 const Task* task)
+Input_file::open(const Dirsearch& dirpath, const Task* task)
 {
   std::string name;
 
@@ -789,7 +788,7 @@ Input_file::open(const General_options& 
       std::string n1("lib");
       n1 += this->input_argument_->name();
       std::string n2;
-      if (options.is_static()
+      if (parameters->options().is_static()
 	  || !this->input_argument_->options().Bdynamic())
 	n1 += ".a";
       else
@@ -845,7 +844,7 @@ Input_file::open(const General_options& 
   else
     {
       gold_assert(format == General_options::OBJECT_FORMAT_BINARY);
-      ok = this->open_binary(options, task, name);
+      ok = this->open_binary(task, name);
     }
 
   if (!ok)
@@ -861,8 +860,7 @@ Input_file::open(const General_options& 
 // Open a file for --format binary.
 
 bool
-Input_file::open_binary(const General_options&,
-			const Task* task, const std::string& name)
+Input_file::open_binary(const Task* task, const std::string& name)
 {
   // In order to open a binary file, we need machine code, size, and
   // endianness.  We may not have a valid target at this point, in
Index: fileread.h
===================================================================
RCS file: /cvs/src/src/gold/fileread.h,v
retrieving revision 1.33
diff -p -u -r1.33 fileread.h
--- fileread.h	28 Feb 2009 04:39:57 -0000	1.33
+++ fileread.h	13 Mar 2009 21:24:44 -0000
@@ -434,7 +434,7 @@ class Input_file
   // Open the file.  If the open fails, this will report an error and
   // return false.
   bool
-  open(const General_options&, const Dirsearch&, const Task*);
+  open(const Dirsearch&, const Task*);
 
   // Return the name given by the user.  For -lc this will return "c".
   const char*
@@ -485,8 +485,7 @@ class Input_file
 
   // Open a binary file.
   bool
-  open_binary(const General_options&, const Task* task,
-	      const std::string& name);
+  open_binary(const Task* task, const std::string& name);
 
   // The argument from the command line.
   const Input_file_argument* input_argument_;
Index: gold.cc
===================================================================
RCS file: /cvs/src/src/gold/gold.cc,v
retrieving revision 1.61
diff -p -u -r1.61 gold.cc
--- gold.cc	28 Jan 2009 02:25:33 -0000	1.61
+++ gold.cc	13 Mar 2009 21:24:44 -0000
@@ -182,7 +182,7 @@ queue_initial_tasks(const General_option
     {
       Task_token* next_blocker = new Task_token(true);
       next_blocker->add_blocker();
-      workqueue->queue(new Read_symbols(options, input_objects, symtab, layout,
+      workqueue->queue(new Read_symbols(input_objects, symtab, layout,
 					&search_path, mapfile, &*p, NULL,
 					this_blocker, next_blocker));
       this_blocker = next_blocker;
Index: plugin.cc
===================================================================
RCS file: /cvs/src/src/gold/plugin.cc,v
retrieving revision 1.12
diff -p -u -r1.12 plugin.cc
--- plugin.cc	1 Mar 2009 22:22:02 -0000	1.12
+++ plugin.cc	13 Mar 2009 21:24:44 -0000
@@ -407,8 +407,7 @@ Plugin_manager::add_input_file(char *pat
   Input_argument* input_argument = new Input_argument(file);
   Task_token* next_blocker = new Task_token(true);
   next_blocker->add_blocker();
-  this->workqueue_->queue_soon(new Read_symbols(this->options_,
-                                                this->input_objects_,
+  this->workqueue_->queue_soon(new Read_symbols(this->input_objects_,
                                                 this->symtab_,
                                                 this->layout_,
                                                 this->dirpath_,
Index: readsyms.cc
===================================================================
RCS file: /cvs/src/src/gold/readsyms.cc,v
retrieving revision 1.33
diff -p -u -r1.33 readsyms.cc
--- readsyms.cc	13 Feb 2009 19:04:45 -0000	1.33
+++ readsyms.cc	13 Mar 2009 21:24:44 -0000
@@ -139,7 +139,7 @@ Read_symbols::do_read_symbols(Workqueue*
     }
 
   Input_file* input_file = new Input_file(&this->input_argument_->file());
-  if (!input_file->open(this->options_, *this->dirpath_, this))
+  if (!input_file->open(*this->dirpath_, this))
     return false;
 
   // Read enough of the file to pick up the entire ELF header.
@@ -258,8 +258,7 @@ Read_symbols::do_read_symbols(Workqueue*
   // read multiple scripts simultaneously, which could lead to
   // unpredictable changes to the General_options structure.
 
-  workqueue->queue_soon(new Read_script(this->options_,
-					this->symtab_,
+  workqueue->queue_soon(new Read_script(this->symtab_,
 					this->layout_,
 					this->dirpath_,
 					this->input_objects_,
@@ -296,8 +295,7 @@ Read_symbols::do_group(Workqueue* workqu
 
       Task_token* next_blocker = new Task_token(true);
       next_blocker->add_blocker();
-      workqueue->queue_soon(new Read_symbols(this->options_,
-					     this->input_objects_,
+      workqueue->queue_soon(new Read_symbols(this->input_objects_,
 					     this->symtab_, this->layout_,
 					     this->dirpath_, this->mapfile_,
 					     arg, input_group,
@@ -491,8 +489,8 @@ void
 Read_script::run(Workqueue* workqueue)
 {
   bool used_next_blocker;
-  if (!read_input_script(workqueue, this->options_, this->symtab_,
-			 this->layout_, this->dirpath_, this->input_objects_,
+  if (!read_input_script(workqueue, this->symtab_, this->layout_,
+			 this->dirpath_, this->input_objects_,
 			 this->mapfile_, this->input_group_,
 			 this->input_argument_, this->input_file_,
 			 this->next_blocker_, &used_next_blocker))
Index: readsyms.h
===================================================================
RCS file: /cvs/src/src/gold/readsyms.h,v
retrieving revision 1.16
diff -p -u -r1.16 readsyms.h
--- readsyms.h	21 May 2008 21:37:44 -0000	1.16
+++ readsyms.h	13 Mar 2009 21:24:44 -0000
@@ -54,15 +54,15 @@ class Read_symbols : public Task
   // one has completed; it will be NULL for the first task.
   // NEXT_BLOCKER is used to block the next input file from adding
   // symbols.
-  Read_symbols(const General_options& options, Input_objects* input_objects,
-	       Symbol_table* symtab, Layout* layout, Dirsearch* dirpath,
-	       Mapfile* mapfile, const Input_argument* input_argument,
+  Read_symbols(Input_objects* input_objects, Symbol_table* symtab,
+	       Layout* layout, Dirsearch* dirpath, Mapfile* mapfile,
+	       const Input_argument* input_argument,
 	       Input_group* input_group, Task_token* this_blocker,
 	       Task_token* next_blocker)
-    : options_(options), input_objects_(input_objects), symtab_(symtab),
-      layout_(layout), dirpath_(dirpath), mapfile_(mapfile),
-      input_argument_(input_argument), input_group_(input_group),
-      this_blocker_(this_blocker), next_blocker_(next_blocker)
+    : input_objects_(input_objects), symtab_(symtab), layout_(layout),
+      dirpath_(dirpath), mapfile_(mapfile), input_argument_(input_argument),
+      input_group_(input_group), this_blocker_(this_blocker),
+      next_blocker_(next_blocker)
   { }
 
   ~Read_symbols();
@@ -90,7 +90,6 @@ class Read_symbols : public Task
   bool
   do_read_symbols(Workqueue*);
 
-  const General_options& options_;
   Input_objects* input_objects_;
   Symbol_table* symtab_;
   Layout* layout_;
@@ -230,13 +229,12 @@ class Finish_group : public Task
 class Read_script : public Task
 {
  public:
-  Read_script(const General_options& options, Symbol_table* symtab,
-	      Layout* layout, Dirsearch* dirpath, Input_objects* input_objects,
-	      Mapfile* mapfile, Input_group* input_group,
-	      const Input_argument* input_argument,
+  Read_script(Symbol_table* symtab, Layout* layout, Dirsearch* dirpath,
+	      Input_objects* input_objects, Mapfile* mapfile,
+	      Input_group* input_group, const Input_argument* input_argument,
 	      Input_file* input_file, Task_token* this_blocker,
 	      Task_token* next_blocker)
-    : options_(options), symtab_(symtab), layout_(layout), dirpath_(dirpath),
+    : symtab_(symtab), layout_(layout), dirpath_(dirpath),
       input_objects_(input_objects), mapfile_(mapfile),
       input_group_(input_group), input_argument_(input_argument),
       input_file_(input_file), this_blocker_(this_blocker),
@@ -260,7 +258,6 @@ class Read_script : public Task
   get_name() const;
 
  private:
-  const General_options& options_;
   Symbol_table* symtab_;
   Layout* layout_;
   Dirsearch* dirpath_;
Index: script.cc
===================================================================
RCS file: /cvs/src/src/gold/script.cc,v
retrieving revision 1.49
diff -p -u -r1.49 script.cc
--- script.cc	1 Feb 2009 00:45:28 -0000	1.49
+++ script.cc	13 Mar 2009 21:24:44 -0000
@@ -1321,8 +1321,7 @@ class Parser_closure
 // as a script.  Return true if the file was handled.
 
 bool
-read_input_script(Workqueue* workqueue, const General_options& options,
-		  Symbol_table* symtab, Layout* layout,
+read_input_script(Workqueue* workqueue, Symbol_table* symtab, Layout* layout,
 		  Dirsearch* dirsearch, Input_objects* input_objects,
 		  Mapfile* mapfile, Input_group* input_group,
 		  const Input_argument* input_argument,
@@ -1363,7 +1362,7 @@ read_input_script(Workqueue* workqueue, 
 	  nb = new Task_token(true);
 	  nb->add_blocker();
 	}
-      workqueue->queue_soon(new Read_symbols(options, input_objects, symtab,
+      workqueue->queue_soon(new Read_symbols(input_objects, symtab,
 					     layout, dirsearch, mapfile, &*p,
 					     input_group, this_blocker, nb));
       this_blocker = nb;
@@ -1398,7 +1397,7 @@ read_script_file(const char* filename, C
     posdep.set_format_enum(General_options::OBJECT_FORMAT_ELF);
   Input_file_argument input_argument(filename, false, "", false, posdep);
   Input_file input_file(&input_argument);
-  if (!input_file.open(cmdline->options(), dirsearch, task))
+  if (!input_file.open(dirsearch, task))
     return false;
 
   std::string input_string;
Index: script.h
===================================================================
RCS file: /cvs/src/src/gold/script.h,v
retrieving revision 1.22
diff -p -u -r1.22 script.h
--- script.h	6 Nov 2008 07:23:31 -0000	1.22
+++ script.h	13 Mar 2009 21:24:44 -0000
@@ -389,8 +389,8 @@ class Script_options
 // whether the function took over NEXT_BLOCKER.
 
 bool
-read_input_script(Workqueue*, const General_options&, Symbol_table*, Layout*,
-		  Dirsearch*, Input_objects*, Mapfile*, Input_group*,
+read_input_script(Workqueue*, Symbol_table*, Layout*, Dirsearch*,
+		  Input_objects*, Mapfile*, Input_group*,
 		  const Input_argument*, Input_file*,
 		  Task_token* next_blocker, bool* used_next_blocker);
 

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