From 0ff3afe5ea8ad6bd7351c4fd7d0155106c5c06f8 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 21 Feb 2014 19:08:54 +0000 Subject: [PATCH] [SCons] Fix warning suppression in external code --- ext/SConscript | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/ext/SConscript b/ext/SConscript index 661a0abca..dea36f0b9 100644 --- a/ext/SConscript +++ b/ext/SConscript @@ -5,17 +5,27 @@ localenv = env.Clone() def prep_default(env): - return env.Clone() + localenv = env.Clone() + + # Suppress warnings from external code and auto-generated code + if 'g++' in localenv['CXX']: + localenv.Append(CCFLAGS=['-Wno-format', '-Wno-format-security', + '-Wno-unused-result']) + + if localenv['CC'] == 'clang': + localenv['CCFLAGS'].append('-w') + + return localenv def prep_fortran(env): - localenv = env.Clone() + localenv = prep_default(env) localenv.Prepend(CPPPATH='#include/cantera/base') # for config.h return localenv def prep_f2c(env): - localenv = env.Clone() + localenv = prep_default(env) localenv.Prepend(CPPPATH=Dir('#ext/f2c_libs')) if not localenv['HAS_TIMES_H']: @@ -26,35 +36,17 @@ def prep_f2c(env): print "INFO 2: prep_f2c: adding MSDOS to CPPDEFINES" print "INFO 2: CPPDEFINES ", localenv['CPPDEFINES'] - # The F2C code generates a lot of warnings designed to catch - # programmer errors, but since this is autogenerated code, those - # warnings are irrelevant. - if '-Wall' in localenv['CCFLAGS']: - localenv['CCFLAGS'].remove('-Wall') - localenv['CCFLAGS'].append('-Wno-format-security') - elif '/W3' in localenv['CCFLAGS']: - localenv['CCFLAGS'].remove('/W3') - elif '-Wcheck' in localenv['CCFLAGS']: - localenv['CCFLAGS'].remove('-Wcheck') - if localenv['CC'] == 'clang': - localenv['CCFLAGS'].append('-w') - return localenv def prep_sundials(env): - localenv = env.Clone() + localenv = prep_default(env) localenv.Prepend(CPPPATH=Dir('#ext/cvode/include')) - - # Suppress warnings from external code - if '-Wall' in localenv['CCFLAGS']: - localenv['CCFLAGS'].append('-Wno-format') - return localenv def prep_gtest(env): - localenv = env.Clone() + localenv = prep_default(env) localenv.Prepend(CPPPATH=[Dir('#ext/gtest'), Dir('#ext/gtest/include')], CPPDEFINES={'GTEST_HAS_PTHREAD': 0})