scons: Add warning for overloaded virtual functions

A derived function with a different signature than a base class
function will result in the base class function of the same name being
hidden. The parameter list and return type for the member function in
the derived class must match those of the member function in the base
class, otherwise the function in the derived class will hide the
function in the base class and no polymorphic behaviour will occur.

This patch addresses these warnings by ensuring a unique function name
to avoid (unintentionally) hiding any functions.
This commit is contained in:
Andreas Hansson
2013-02-19 05:56:06 -05:00
parent d670fa60a1
commit 0acd2a96e5
13 changed files with 53 additions and 3 deletions

View File

@@ -528,7 +528,8 @@ if main['GCC']:
main.Append(CCFLAGS=['-pipe'])
main.Append(CCFLAGS=['-fno-strict-aliasing'])
main.Append(CCFLAGS=['-Wall', '-Wno-sign-compare', '-Wundef'])
main.Append(CXXFLAGS=['-Wmissing-field-initializers'])
main.Append(CXXFLAGS=['-Wmissing-field-initializers',
'-Woverloaded-virtual'])
main.Append(CXXFLAGS=['-std=c++0x'])
# Check for versions with bugs
@@ -578,7 +579,8 @@ elif main['CLANG']:
# Ruby makes frequent use of extraneous parantheses in the printing
# of if-statements
main.Append(CCFLAGS=['-Wno-parentheses'])
main.Append(CXXFLAGS=['-Wmissing-field-initializers'])
main.Append(CXXFLAGS=['-Wmissing-field-initializers',
'-Woverloaded-virtual'])
main.Append(CXXFLAGS=['-std=c++0x'])
# On Mac OS X/Darwin we need to also use libc++ (part of XCode) as
# opposed to libstdc++ to make the transition from TR1 to