From 2bc1f786d5b5699d53c4d0777051e90e8b3beca6 Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 20 Jun 2015 03:50:46 +0000 Subject: [PATCH] Test for -Wlogical-op before using it clang does not understand it, so using it unconditionally breaks the clang build. --- SConstruct | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/SConstruct b/SConstruct index 581760f0f..5f05a5d61 100644 --- a/SConstruct +++ b/SConstruct @@ -415,12 +415,6 @@ struct T {}; return raise SCons.Errors.StopError("C++ compiler errors on {} initialization, even with -Wno-missing-field-initializers.") @_custom_test - def check_compiler_visibility_hidden(self,context): - ''' -help:assume compiler accepts -fvisibility=hidden -''' - self.Compile(context, text='', main='', msg='whether compiler accepts -fvisibility=hidden', successflags={'CXXFLAGS' : ['-fvisibility=hidden']}) - @_custom_test def check_attribute_error(self,context): """ help:assume compiler supports __attribute__((error)) @@ -1122,6 +1116,23 @@ help:always wipe certain freed memory ''' self.Compile(context, text='#include ', main=main, msg='for strcasecmp', successflags={'CPPDEFINES' : ['DXX_HAVE_STRCASECMP']}) +def add_compiler_option_tests(): + def define_compiler_option_test(opt, doc=None): + def f(self, context): + self.Compile(context, text='', main='', msg='whether compiler accepts ' + opt, successflags={'CXXFLAGS' : [opt]}) + f.__name__ = n = 'check_compiler_option_' + opt.replace('=', '') + f.__doc__ = doc or ('\nhelp:assume compiler accepts ' + opt + '\n') + setattr(ConfigureTests, n, custom_tests(f)) + custom_tests = ConfigureTests._custom_test + for opt in ( + ('-fvisibility=hidden',), + ('-Wsuggest-attribute=noreturn',), + ('-Wlogical-op',), + ): + define_compiler_option_test(*opt) +add_compiler_option_tests() +del add_compiler_option_tests + class LazyObjectConstructor: def __get_lazy_object(self,srcname,transform_target): env = self.env @@ -1601,12 +1612,10 @@ class DXXCommon(LazyObjectConstructor): Werror + 'missing-braces', Werror + 'missing-include-dirs', Werror + 'unused', - '-Wsuggest-attribute=noreturn', Werror + 'undef', Werror + 'pointer-arith', Werror + 'cast-qual', Werror + 'cast-align', - Werror + 'logical-op', Werror + 'missing-declarations', Werror + 'redundant-decls', Werror + 'vla',