From 91d6fa6a035cc7d0b7be5c99c194a64cb80924b0 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 11 Dec 2009 13:42:17 +0000 Subject: Add -Wshadow to the gcc command line options used when compiling the binutils. Fix up all warnings generated by the addition of this switch. --- gold/fileread.cc | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'gold/fileread.cc') diff --git a/gold/fileread.cc b/gold/fileread.cc index ac30769..ebc6e23 100644 --- a/gold/fileread.cc +++ b/gold/fileread.cc @@ -754,14 +754,14 @@ File_view::~File_view() // Create a file for testing. -Input_file::Input_file(const Task* task, const char* name, +Input_file::Input_file(const Task* task, const char* iname, const unsigned char* contents, off_t size) : file_() { this->input_argument_ = - new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE, + new Input_file_argument(iname, Input_file_argument::INPUT_FILE_TYPE_FILE, "", false, Position_dependent_options()); - bool ok = this->file_.open(task, name, contents, size); + bool ok = this->file_.open(task, iname, contents, size); gold_assert(ok); } @@ -843,7 +843,7 @@ File_read::get_mtime() bool Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) { - std::string name; + std::string iname; // Case 1: name is an absolute file, just try to open it // Case 2: name is relative but is_lib is false, is_searched_file is false, @@ -853,8 +853,8 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) && !this->input_argument_->is_searched_file() && this->input_argument_->extra_search_path() == NULL)) { - name = this->input_argument_->name(); - this->found_name_ = name; + iname = this->input_argument_->name(); + this->found_name_ = iname; } // Case 3: is_lib is true or is_searched_file is true else if (this->input_argument_->is_lib() @@ -878,15 +878,15 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) } else n1 = this->input_argument_->name(); - name = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex); - if (name.empty()) + iname = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex); + if (iname.empty()) { gold_error(_("cannot find %s%s"), this->input_argument_->is_lib() ? "-l" : "", this->input_argument_->name()); return false; } - if (n2.empty() || name[name.length() - 1] == 'o') + if (n2.empty() || iname[iname.length() - 1] == 'o') this->found_name_ = n1; else this->found_name_ = n2; @@ -897,20 +897,20 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) gold_assert(this->input_argument_->extra_search_path() != NULL); // First, check extra_search_path. - name = this->input_argument_->extra_search_path(); - if (!IS_DIR_SEPARATOR (name[name.length() - 1])) - name += '/'; - name += this->input_argument_->name(); + iname = this->input_argument_->extra_search_path(); + if (!IS_DIR_SEPARATOR (iname[iname.length() - 1])) + iname += '/'; + iname += this->input_argument_->name(); struct stat dummy_stat; - if (*pindex > 0 || ::stat(name.c_str(), &dummy_stat) < 0) + if (*pindex > 0 || ::stat(iname.c_str(), &dummy_stat) < 0) { // extra_search_path failed, so check the normal search-path. int index = *pindex; if (index > 0) --index; - name = dirpath.find(this->input_argument_->name(), "", - &this->is_in_sysroot_, &index); - if (name.empty()) + iname = dirpath.find(this->input_argument_->name(), "", + &this->is_in_sysroot_, &index); + if (iname.empty()) { gold_error(_("cannot find %s"), this->input_argument_->name()); @@ -927,17 +927,17 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) this->input_argument_->options().format_enum(); bool ok; if (format == General_options::OBJECT_FORMAT_ELF) - ok = this->file_.open(task, name); + ok = this->file_.open(task, iname); else { gold_assert(format == General_options::OBJECT_FORMAT_BINARY); - ok = this->open_binary(task, name); + ok = this->open_binary(task, iname); } if (!ok) { gold_error(_("cannot open %s: %s"), - name.c_str(), strerror(errno)); + iname.c_str(), strerror(errno)); return false; } @@ -947,7 +947,7 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex) // Open a file for --format binary. bool -Input_file::open_binary(const Task* task, const std::string& name) +Input_file::open_binary(const Task* task, const std::string& iname) { // 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 @@ -958,10 +958,10 @@ Input_file::open_binary(const Task* task, const std::string& name) Binary_to_elf binary_to_elf(target.machine_code(), target.get_size(), target.is_big_endian(), - name); + iname); if (!binary_to_elf.convert(task)) return false; - return this->file_.open(task, name, binary_to_elf.converted_data_leak(), + return this->file_.open(task, iname, binary_to_elf.converted_data_leak(), binary_to_elf.converted_size()); } -- cgit v1.1