aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Langlois <pierre.langlois@arm.com>2017-05-05 13:14:35 +0100
committerPierre Langlois <pierre.langlois@arm.com>2017-05-08 13:24:01 +0100
commitf7bf65575dd402847c15b566c2873d59cbe6ee30 (patch)
treee7fab589606f6e6473d89da47d98ef1328be202b
parent1cb7144de5478fd860f6d64fad4207730d2e139b (diff)
Silence warnings about throwing from destructors when compiling with negative testing
GCC 6 now warns if one throws from a destructor. However, we need to do it when negative testing is enabled so let's silence warnings for these cases. Change-Id: Ib6e621ed52edd3478bb0113147f46dc92c9e3805
-rw-r--r--SConstruct11
1 files changed, 11 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index e4a56e24..f89274aa 100644
--- a/SConstruct
+++ b/SConstruct
@@ -372,6 +372,17 @@ def ConfigureEnvironmentForCompiler(env):
if compiler == 'gcc-4.8':
env.Append(CPPFLAGS = ['-Wno-maybe-uninitialized'])
+ # GCC 6 and higher is able to detect throwing from inside a destructor and
+ # reports a warning. However, if negative testing is enabled then assertions
+ # will throw exceptions.
+ if env['negative_testing'] == 'on' and env['mode'] == 'debug' \
+ and compiler >= 'gcc-6':
+ env.Append(CPPFLAGS = ['-Wno-terminate'])
+ # The C++11 compatibility warning will also be triggered for this case, as
+ # the behavior of throwing from desctructors has changed.
+ if 'std' in env and env['std'] == 'c++98':
+ env.Append(CPPFLAGS = ['-Wno-c++11-compat'])
+
# When compiling with c++98 (the default), allow long long constants.
if 'std' not in env or env['std'] == 'c++98':
env.Append(CPPFLAGS = ['-Wno-long-long'])