scons: Add warning delete with non-virtual destructor
authorAndreas Hansson <andreas.hansson@arm.com>
Tue, 19 Feb 2013 10:56:07 +0000 (05:56 -0500)
committerAndreas Hansson <andreas.hansson@arm.com>
Tue, 19 Feb 2013 10:56:07 +0000 (05:56 -0500)
This patch enables a warning for deleting derived classes that do not
have a virtual destructor. The patch merely adds additional checks,
and there are currently no cases that had to be fixed.

src/SConscript

index 2abe8b2ad9f85a32288af3323b626a28c3790bfc..465bae70e14625b99fe0eefcb7a4e13b695d1479 100755 (executable)
@@ -903,12 +903,15 @@ def makeEnv(label, objsfx, strip = False, **kwargs):
         # Add additional warnings here that should not be applied to
         # the SWIG generated code
         new_env.Append(CXXFLAGS='-Wmissing-declarations')
+        if compareVersions(env['GCC_VERSION'], '4.7') >= 0:
+            new_env.Append(CXXFLAGS='-Wdelete-non-virtual-dtor')
     if env['CLANG']:
         swig_env.Append(CCFLAGS=['-Wno-unused-label', '-Wno-unused-value'])
 
         # Add additional warnings here that should not be applied to
         # the SWIG generated code
-        new_env.Append(CXXFLAGS='-Wmissing-declarations')
+        new_env.Append(CXXFLAGS=['-Wmissing-declarations',
+                                 '-Wdelete-non-virtual-dtor'])
 
     werror_env = new_env.Clone()
     werror_env.Append(CCFLAGS='-Werror')