diff options
author | Waley Chen <waleycz@gmail.com> | 2016-06-22 10:55:52 -0400 |
---|---|---|
committer | Waley Chen <waleycz@gmail.com> | 2016-06-22 11:03:20 -0400 |
commit | 2f708de73326bfa6aef14169888c23ccdd3345d1 (patch) | |
tree | 9e29ecd42a9e28d9b12b751dc2611714ed196c2f /SConstruct | |
parent | a009f41df2c3609b3c8dfd19ddc97ddbeef86984 (diff) | |
download | mongo-2f708de73326bfa6aef14169888c23ccdd3345d1.tar.gz |
SERVER-23974 Add clang 3.4 with libc++ canary builder
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct index 3af8e126bac..9963c67b489 100644 --- a/SConstruct +++ b/SConstruct @@ -1494,7 +1494,7 @@ if env.TargetOSIs('posix'): if not has_option("disable-warnings-as-errors"): env.Append( CCFLAGS=["-Werror"] ) - env.Append( CXXFLAGS=["-Wnon-virtual-dtor", "-Woverloaded-virtual"] ) + env.Append( CXXFLAGS=["-Woverloaded-virtual"] ) env.Append( LINKFLAGS=["-pthread"] ) # SERVER-9761: Ensure early detection of missing symbols in dependent libraries at program @@ -1836,6 +1836,40 @@ def doConfigure(myenv): # see: http://stackoverflow.com/questions/21755206/how-to-get-around-gcc-void-b-4-may-be-used-uninitialized-in-this-funct AddToCXXFLAGSIfSupported(myenv, "-Wno-maybe-uninitialized") + # Check if we can set "-Wnon-virtual-dtor" when "-Werror" is set. The only time we can't set it is on + # clang 3.4, where a class with virtual function(s) and a non-virtual destructor throws a warning when + # it shouldn't. + def CheckNonVirtualDtor(context): + + test_body = """ + class Base { + public: + virtual void foo() const = 0; + protected: + ~Base() {}; + }; + + class Derived : public Base { + public: + virtual void foo() const {} + }; + """ + + context.Message('Checking -Wnon-virtual-dtor for false positives... ') + ret = context.TryCompile(textwrap.dedent(test_body), ".cpp") + context.Result(ret) + return ret + + myenvClone = myenv.Clone() + myenvClone.Append( CCFLAGS=['-Werror'] ) + myenvClone.Append( CXXFLAGS=["-Wnon-virtual-dtor"] ) + conf = Configure(myenvClone, help=False, custom_tests = { + 'CheckNonVirtualDtor' : CheckNonVirtualDtor, + }) + if conf.CheckNonVirtualDtor(): + myenv.Append( CXXFLAGS=["-Wnon-virtual-dtor"] ) + conf.Finish() + if get_option('runtime-hardening') == "on": # Clang honors these flags, but doesn't actually do anything with them for compatibility, so we # need to only do this for GCC. On clang, we do things differently. Note that we need to add |