[llvm] r218059 - Disable GCC's -Woverloaded-virtual in the configure+make build. Clang's is better.

David Blaikie dblaikie at gmail.com
Thu Sep 18 09:34:25 PDT 2014


Author: dblaikie
Date: Thu Sep 18 11:34:25 2014
New Revision: 218059

URL: http://llvm.org/viewvc/llvm-project?rev=218059&view=rev
Log:
Disable GCC's -Woverloaded-virtual in the configure+make build. Clang's is better.

Turns out Clang's -Woverloaded-virtual is enabled by -Wall in both CMake
and Configure builds. We were only explicitly specifying it (thus
enabling GCC's version of the warning) in the Configure build.

The specific case of interest is:

  struct base {
    virtual void func();
    virtual void func(int);
  };
  struct derived: base {
    virtual void func(); // GCC warns here, because this causes
                         // func(int) to be hidden
  };

I don't think that's worth getting fussed about (& Clang (indirectly
me... since I improved this warning in Clang) agrees or we would've made
the warning catch these cases.

Technically this could still lead to bugs/confusion if base had
func(int) and func(bool), derived overrode func(bool) and then a caller
with a derived object tried to call func(42) - it would silently call
func(bool). We should probably improve clang's warnings to catch this at
the call site at some point.

Modified:
    llvm/trunk/Makefile.rules

Modified: llvm/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.rules?rev=218059&r1=218058&r2=218059&view=diff
==============================================================================
--- llvm/trunk/Makefile.rules (original)
+++ llvm/trunk/Makefile.rules Thu Sep 18 11:34:25 2014
@@ -449,7 +449,6 @@ ifeq ($(HOST_OS),MingW)
   endif
 endif
 
-CXX.Flags     += -Woverloaded-virtual
 CPP.BaseFlags += $(CPP.Defines)
 AR.Flags      := cru
 





More information about the llvm-commits mailing list