From a2d69514a4ebf111cab43953af45759e9f2a02b0 Mon Sep 17 00:00:00 2001 From: Mark Benvenuto Date: Thu, 12 Jun 2014 16:49:57 -0400 Subject: [PATCH] SERVER-8994: Boost 1.55 MacOS X fixes 1. Move swap from std to mongo namespace. Fixed C++ build on 10.9 with XCode 5.1 2. Add check to see if no-null-conversion needs to be enabled for C++ build on 10.8 with Xcode 4.2 --- SConstruct | 25 +++++++++++++++++++++++++ src/mongo/db/pipeline/document.h | 6 ------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index 3978c197cdb..893ec7f4194 100644 --- a/SConstruct +++ b/SConstruct @@ -1165,6 +1165,31 @@ def doConfigure(myenv): # primary mongo sources as well. AddToCCFLAGSIfSupported(myenv, "-Wno-unused-const-variable") + # Check if we need to disable null-conversion warnings + if using_clang(): + def CheckNullConversion(context): + + test_body = """ + #include + struct TestType { int value; bool boolValue; }; + bool foo() { + boost::shared_ptr sp(new TestType); + return NULL != sp; + } + """ + + context.Message('Checking if implicit boost::shared_ptr null conversion is supported... ') + ret = context.TryCompile(textwrap.dedent(test_body), ".cpp") + context.Result(ret) + return ret + + conf = Configure(myenv, help=False, custom_tests = { + 'CheckNullConversion' : CheckNullConversion, + }) + if conf.CheckNullConversion() == False: + env.Append( CCFLAGS="-Wno-null-conversion" ) + conf.Finish() + # This needs to happen before we check for libc++, since it affects whether libc++ is available. if darwin and has_option('osx-version-min'): min_version = get_option('osx-version-min') diff --git a/src/mongo/db/pipeline/document.h b/src/mongo/db/pipeline/document.h index 1ee358b434c..168f550eda1 100644 --- a/src/mongo/db/pipeline/document.h +++ b/src/mongo/db/pipeline/document.h @@ -544,16 +544,10 @@ namespace mongo { std::vector _array; }; -} - -namespace std { - template<> inline void swap(mongo::Document& lhs, mongo::Document& rhs) { lhs.swap(rhs); } -} /* ======================= INLINED IMPLEMENTATIONS ========================== */ -namespace mongo { inline FieldIterator Document::fieldIterator() const { return FieldIterator(*this); }