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] |
After checking with Nick, I've reverted the -Wshadow patches in the gold and elfcpp directories. The problem is that gcc's current -Wshadow warning is much too aggressive for C++. A lot of code in gold looks like this: class C { public: C(const std::string& name) : name_(name) { } const std::string& name() const { return this->name_; } private: std::string name_; }; This code is fine, and the same value is consistently named "name" which makes it clearer throughout. However, -Wshadow warns about the use of "name" as the parameter to the constructor, because it shadows the accessor function "name()" in the function. This warning is pointless, because there is no possible confusion between a local variable "name" and a method "name". Any attempt to use one for the other will be a type error. Changing the name of the parameter to avoid the pointless warning makes the code less clear. In fact there is no good way to avoid the -Wshadow warning. So I have simply reverted the patch. Ian gold/ChangeLog: 2009-12-14 Ian Lance Taylor <iant@google.com> Revert -Wshadow changes, all changes from: 2009-12-11 Doug Kwan <dougkwan@google.com> 2009-12-11 Nick Clifton <nickc@redhat.com> * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS. elfcpp/ChangeLog: 2009-12-14 Ian Lance Taylor <iant@google.com> * elfcpp_file.h: Revert last patch.
Attachment:
foo.patch.bz2
Description: revert
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |