diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2019-01-30 16:52:07 -0500 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2019-02-01 17:06:10 -0500 |
commit | 66430d75e33827da60195deb317058c71f75e03f (patch) | |
tree | 8ca6fcca749a630afca95415638052ed429d2e70 | |
parent | 2dc3359cfe83cafa0f450a0dc7e2815f48ad08b4 (diff) | |
download | mongo-66430d75e33827da60195deb317058c71f75e03f.tar.gz |
SERVER-38176 Compile with /permissive- on MSVC to make the compiler strictly standard conformant.
41 files changed, 171 insertions, 131 deletions
diff --git a/SConstruct b/SConstruct index 6697b787ee9..c2ad08211b4 100644 --- a/SConstruct +++ b/SConstruct @@ -1615,8 +1615,9 @@ elif env.TargetOSIs('windows'): # Temporary fixes to allow compilation with VS2017 env.Append(CPPDEFINES=[ - "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS", - "_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING", + "_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING", + "_SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING", + "_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING", ]) # /EHsc exception handling style for visual studio @@ -2406,7 +2407,7 @@ def doConfigure(myenv): conf.Finish() if myenv.ToolchainIs('msvc'): - myenv.AppendUnique(CXXFLAGS=['/Zc:__cplusplus']) + myenv.AppendUnique(CCFLAGS=['/Zc:__cplusplus', '/permissive-']) if get_option('cxx-std') == "17": myenv.AppendUnique(CCFLAGS=['/std:c++17']) else: diff --git a/site_scons/site_tools/mongo_benchmark.py b/site_scons/site_tools/mongo_benchmark.py index b2a1750e3d2..2064516aa1f 100644 --- a/site_scons/site_tools/mongo_benchmark.py +++ b/site_scons/site_tools/mongo_benchmark.py @@ -22,7 +22,7 @@ def benchmark_list_builder_action(env, target, source): def build_benchmark(env, target, source, **kwargs): bmEnv = env.Clone() - bmEnv.InjectThirdPartyIncludePaths(libraries=['benchmark']) + bmEnv.InjectThirdParty(libraries=['benchmark']) if bmEnv.TargetOSIs('windows'): bmEnv.Append(LIBS=["ShLwApi.lib"]) diff --git a/src/SConscript b/src/SConscript index fbe3157eac5..89ef06baa9c 100644 --- a/src/SConscript +++ b/src/SConscript @@ -15,7 +15,7 @@ env.SConscript('third_party/SConscript', exports=['env']) # and modules. Ideally, pcre wouldn't be here, but enough things require it # now that it seems hopeless to remove it now. env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=[ +env.InjectThirdParty(libraries=[ 'abseil-cpp', 'boost', 'pcre', diff --git a/src/mongo/bson/SConscript b/src/mongo/bson/SConscript index f1d9ab122ea..68a5ba0ad00 100644 --- a/src/mongo/bson/SConscript +++ b/src/mongo/bson/SConscript @@ -96,7 +96,7 @@ env.CppUnitTest( ) asioEnv = env.Clone() -asioEnv.InjectThirdPartyIncludePaths('asio') +asioEnv.InjectThirdParty('asio') asioEnv.CppIntegrationTest( target='ugly_bson_integration_test', diff --git a/src/mongo/client/SConscript b/src/mongo/client/SConscript index 8deaaa5aaec..2a651dd585e 100644 --- a/src/mongo/client/SConscript +++ b/src/mongo/client/SConscript @@ -148,7 +148,7 @@ env.Library( ) clientDriverEnv = env.Clone() -clientDriverEnv.InjectThirdPartyIncludePaths('asio') +clientDriverEnv.InjectThirdParty('asio') clientDriverEnv.Library( target='clientdriver_minimal', diff --git a/src/mongo/client/remote_command_targeter_factory_mock.cpp b/src/mongo/client/remote_command_targeter_factory_mock.cpp index 0b664284788..bb79bda9d80 100644 --- a/src/mongo/client/remote_command_targeter_factory_mock.cpp +++ b/src/mongo/client/remote_command_targeter_factory_mock.cpp @@ -96,7 +96,7 @@ void RemoteCommandTargeterFactoryMock::removeTargeterToReturn(const ConnectionSt MockTargetersMap::iterator it = _mockTargeters.find(connStr); invariant(it != _mockTargeters.end()); - invariant(it->second.unique()); + invariant(it->second.use_count() == 1); _mockTargeters.erase(it); } diff --git a/src/mongo/crypto/SConscript b/src/mongo/crypto/SConscript index ee4c4ff7f03..8f6e35d7b60 100644 --- a/src/mongo/crypto/SConscript +++ b/src/mongo/crypto/SConscript @@ -24,7 +24,7 @@ env.Library('sha256_block', if "tom" in env["MONGO_CRYPTO"]: tomEnv = env.Clone() - tomEnv.InjectThirdPartyIncludePaths(libraries=['tomcrypt']) + tomEnv.InjectThirdParty(libraries=['tomcrypt']) tomEnv.Append( CPPDEFINES=[ 'LTC_NO_PROTOTYPES', diff --git a/src/mongo/crypto/mechanism_scram.h b/src/mongo/crypto/mechanism_scram.h index 2a8cd79e72f..2a8d897f72d 100644 --- a/src/mongo/crypto/mechanism_scram.h +++ b/src/mongo/crypto/mechanism_scram.h @@ -122,7 +122,7 @@ private: return std::tie(_password, _salt, _iterationCount); } - static constexpr auto saltLength() { + static constexpr auto saltLength() -> decltype(HashBlock::kHashLength) { return HashBlock::kHashLength - 4; } diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript index af94c070fc2..5fd17fe7ee3 100644 --- a/src/mongo/db/SConscript +++ b/src/mongo/db/SConscript @@ -7,7 +7,7 @@ env = env.Clone() # Ideally 's2' would be scoped narrowly but it is spammed in all over the place by # db/geo unfortunately. -env.InjectThirdPartyIncludePaths(libraries=[ +env.InjectThirdParty(libraries=[ 's2', ]) @@ -1279,7 +1279,7 @@ env.Library( ) envWithAsio = env.Clone() -envWithAsio.InjectThirdPartyIncludePaths(libraries=['asio']) +envWithAsio.InjectThirdParty(libraries=['asio']) envWithAsio.CppUnitTest( target='logical_session_id_test', @@ -1966,7 +1966,7 @@ env.Library( ) asioEnv = env.Clone() -asioEnv.InjectThirdPartyIncludePaths('asio') +asioEnv.InjectThirdParty('asio') asioEnv.CppIntegrationTest( target='nesting_depth_test', diff --git a/src/mongo/db/auth/SConscript b/src/mongo/db/auth/SConscript index 9c71ac46304..e66d6b4e703 100644 --- a/src/mongo/db/auth/SConscript +++ b/src/mongo/db/auth/SConscript @@ -285,7 +285,7 @@ env.Library( ) yamlEnv = env.Clone() -yamlEnv.InjectThirdPartyIncludePaths(libraries=['yaml']) +yamlEnv.InjectThirdParty(libraries=['yaml']) yamlEnv.Library( target='security_file', source=[ diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript index 547dddc5284..58aa4e3da35 100644 --- a/src/mongo/db/commands/SConscript +++ b/src/mongo/db/commands/SConscript @@ -512,7 +512,7 @@ env.Library( if has_option('use-cpu-profiler'): profEnv = env.Clone() - profEnv.InjectThirdPartyIncludePaths('gperftools') + profEnv.InjectThirdParty('gperftools') profEnv.Library( target='cpuprofiler', source=[ diff --git a/src/mongo/db/free_mon/SConscript b/src/mongo/db/free_mon/SConscript index 0ba806f82a9..cc266679206 100644 --- a/src/mongo/db/free_mon/SConscript +++ b/src/mongo/db/free_mon/SConscript @@ -5,7 +5,7 @@ Import("free_monitoring") env = env.Clone() fmEnv = env.Clone() -fmEnv.InjectThirdPartyIncludePaths(libraries=['snappy']) +fmEnv.InjectThirdParty(libraries=['snappy']) fmEnv.Library( target='free_mon', diff --git a/src/mongo/db/ftdc/SConscript b/src/mongo/db/ftdc/SConscript index 8be42abcbc5..14743514166 100644 --- a/src/mongo/db/ftdc/SConscript +++ b/src/mongo/db/ftdc/SConscript @@ -4,7 +4,7 @@ Import("env") env = env.Clone() ftdcEnv = env.Clone() -ftdcEnv.InjectThirdPartyIncludePaths(libraries=['zlib']) +ftdcEnv.InjectThirdParty(libraries=['zlib']) ftdcEnv.Library( target='ftdc', diff --git a/src/mongo/db/fts/SConscript b/src/mongo/db/fts/SConscript index 1a6d0ce6599..72d3ca6aff8 100644 --- a/src/mongo/db/fts/SConscript +++ b/src/mongo/db/fts/SConscript @@ -37,7 +37,7 @@ generateStopWordsList = env.Command( [ "stop_words_list.h", "stop_words_list.cpp env.Alias('generated-sources', generateStopWordsList) baseEnv=env.Clone() -baseEnv.InjectThirdPartyIncludePaths(libraries=['stemmer']) +baseEnv.InjectThirdParty(libraries=['stemmer']) baseEnv.Library('base_fts', [ 'fts_index_format.cpp', 'fts_matcher.cpp', diff --git a/src/mongo/db/index/SConscript b/src/mongo/db/index/SConscript index 48139514fbd..21490053480 100644 --- a/src/mongo/db/index/SConscript +++ b/src/mongo/db/index/SConscript @@ -94,7 +94,7 @@ env.CppUnitTest( ) serveronlyEnv = env.Clone() -serveronlyEnv.InjectThirdPartyIncludePaths(libraries=['snappy']) +serveronlyEnv.InjectThirdParty(libraries=['snappy']) serveronlyEnv.Library( target="index_access_method", source=[ diff --git a/src/mongo/db/pipeline/SConscript b/src/mongo/db/pipeline/SConscript index f03305d8d53..2480340ea2d 100644 --- a/src/mongo/db/pipeline/SConscript +++ b/src/mongo/db/pipeline/SConscript @@ -357,7 +357,7 @@ env.Library( ) pipelineeEnv = env.Clone() -pipelineeEnv.InjectThirdPartyIncludePaths(libraries=['snappy']) +pipelineeEnv.InjectThirdParty(libraries=['snappy']) pipelineeEnv.Library( target='pipeline', source=[ diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h index d02df48f9d7..3e1f1268a57 100644 --- a/src/mongo/db/pipeline/expression.h +++ b/src/mongo/db/pipeline/expression.h @@ -597,10 +597,10 @@ public: * off the timezone if not specified. */ Value serialize(bool explain) const final { + auto timezone = _timeZone ? _timeZone->serialize(explain) : Value(); return Value(Document{ {_opName, - Document{{"date", _date->serialize(explain)}, - {"timezone", _timeZone ? _timeZone->serialize(explain) : Value()}}}}); + Document{{"date", _date->serialize(explain)}, {"timezone", std::move(timezone)}}}}); } boost::intrusive_ptr<Expression> optimize() final { diff --git a/src/mongo/db/query/collation/SConscript b/src/mongo/db/query/collation/SConscript index 6813ecb940f..6d5b61c660b 100644 --- a/src/mongo/db/query/collation/SConscript +++ b/src/mongo/db/query/collation/SConscript @@ -126,7 +126,7 @@ env.CppUnitTest( icuEnv = env.Clone() if not use_system_version_of_library("icu"): - icuEnv.InjectThirdPartyIncludePaths("icu") + icuEnv.InjectThirdParty("icu") # Since we are injecting the third-party ICU headers, we must also copy the same defines that we # use to configure ICU when building ICU sources. See comment in # src/third_party/icu4c-57.1/source/SConscript. diff --git a/src/mongo/db/query/datetime/SConscript b/src/mongo/db/query/datetime/SConscript index a9f8bb87746..69171d52c83 100644 --- a/src/mongo/db/query/datetime/SConscript +++ b/src/mongo/db/query/datetime/SConscript @@ -5,7 +5,7 @@ Import('env') env = env.Clone() timeZoneEnv = env.Clone() -timeZoneEnv.InjectThirdPartyIncludePaths(libraries=['timelib']) +timeZoneEnv.InjectThirdParty(libraries=['timelib']) timeZoneEnv.Library( target='date_time_support', source=[ diff --git a/src/mongo/db/sorter/SConscript b/src/mongo/db/sorter/SConscript index 7b5dd0bdd6e..2f0014755a2 100644 --- a/src/mongo/db/sorter/SConscript +++ b/src/mongo/db/sorter/SConscript @@ -3,7 +3,7 @@ Import("env") env = env.Clone() sorterEnv = env.Clone() -sorterEnv.InjectThirdPartyIncludePaths(libraries=['snappy']) +sorterEnv.InjectThirdParty(libraries=['snappy']) sorterEnv.CppUnitTest('sorter_test', 'sorter_test.cpp', LIBDEPS=['$BUILD_DIR/mongo/db/service_context', diff --git a/src/mongo/db/storage/mobile/SConscript b/src/mongo/db/storage/mobile/SConscript index 2ce89806410..5276dfd2382 100644 --- a/src/mongo/db/storage/mobile/SConscript +++ b/src/mongo/db/storage/mobile/SConscript @@ -3,7 +3,7 @@ Import("mobile_se") env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=['sqlite']) +env.InjectThirdParty(libraries=['sqlite']) env.Library( target='storage_mobile_core', diff --git a/src/mongo/db/storage/wiredtiger/SConscript b/src/mongo/db/storage/wiredtiger/SConscript index 373931db88f..d7f1eb61b96 100644 --- a/src/mongo/db/storage/wiredtiger/SConscript +++ b/src/mongo/db/storage/wiredtiger/SConscript @@ -26,9 +26,9 @@ env.Library( if wiredtiger: wtEnv = env.Clone() - wtEnv.InjectThirdPartyIncludePaths(libraries=['wiredtiger']) - wtEnv.InjectThirdPartyIncludePaths(libraries=['zlib']) - wtEnv.InjectThirdPartyIncludePaths(libraries=['valgrind']) + wtEnv.InjectThirdParty(libraries=['wiredtiger']) + wtEnv.InjectThirdParty(libraries=['zlib']) + wtEnv.InjectThirdParty(libraries=['valgrind']) # This is the smallest possible set of files that wraps WT wtEnv.Library( diff --git a/src/mongo/embedded/SConscript b/src/mongo/embedded/SConscript index 88fc6370203..bd704448dc2 100644 --- a/src/mongo/embedded/SConscript +++ b/src/mongo/embedded/SConscript @@ -58,7 +58,7 @@ env.SConscript( ) yamlEnv = env.Clone() -yamlEnv.InjectThirdPartyIncludePaths(libraries=['yaml']) +yamlEnv.InjectThirdParty(libraries=['yaml']) env.Library( target='embedded', diff --git a/src/mongo/embedded/mongo_embedded/SConscript b/src/mongo/embedded/mongo_embedded/SConscript index 402d5b1bbf7..0db8345b57e 100644 --- a/src/mongo/embedded/mongo_embedded/SConscript +++ b/src/mongo/embedded/mongo_embedded/SConscript @@ -88,7 +88,7 @@ if get_option('install-mode') == 'hygienic': ) yamlEnv = env.Clone() -yamlEnv.InjectThirdPartyIncludePaths(libraries=['yaml']) +yamlEnv.InjectThirdParty(libraries=['yaml']) if get_option('link-model') != 'dynamic-sdk': mongoEmbeddedTest = yamlEnv.Program( diff --git a/src/mongo/embedded/mongoc_embedded/SConscript b/src/mongo/embedded/mongoc_embedded/SConscript index 5679e997521..17943186a37 100644 --- a/src/mongo/embedded/mongoc_embedded/SConscript +++ b/src/mongo/embedded/mongoc_embedded/SConscript @@ -87,7 +87,7 @@ if get_option('install-mode') == 'hygienic': ) yamlEnv = env.Clone() -yamlEnv.InjectThirdPartyIncludePaths(libraries=['yaml']) +yamlEnv.InjectThirdParty(libraries=['yaml']) if get_option('link-model') != 'dynamic-sdk': mongocEmbeddedTestEnv = create_mongoc_env(yamlEnv) diff --git a/src/mongo/scripting/SConscript b/src/mongo/scripting/SConscript index edbc90ce365..47b61c50823 100644 --- a/src/mongo/scripting/SConscript +++ b/src/mongo/scripting/SConscript @@ -59,15 +59,20 @@ env.Library( if usemozjs: scriptingEnv = env.Clone() - scriptingEnv.InjectThirdPartyIncludePaths(libraries=['mozjs']) + scriptingEnv.InjectThirdParty(libraries=['mozjs']) # TODO: get rid of all of this /FI and -include stuff and migrate to a shim # header we include in all of our files. if env.TargetOSIs('windows'): - scriptingEnv.Append(CCFLAGS=[ - '/FI', 'js-config.h', - '/FI', 'js/RequiredDefines.h', - ]) + scriptingEnv.Append( + CCFLAGS=[ + '/FI', 'js-config.h', + '/FI', 'js/RequiredDefines.h', + ], + CPPDEFINES=[ + '_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING', + ] + ) else: scriptingEnv.Append( CCFLAGS=[ diff --git a/src/mongo/tools/SConscript b/src/mongo/tools/SConscript index ec512743904..e27673dd9b4 100644 --- a/src/mongo/tools/SConscript +++ b/src/mongo/tools/SConscript @@ -6,7 +6,7 @@ Import('get_option') env = env.Clone() yamlEnv = env.Clone() -yamlEnv.InjectThirdPartyIncludePaths(libraries=['yaml']) +yamlEnv.InjectThirdParty(libraries=['yaml']) mongobridge = env.Program( target="mongobridge", diff --git a/src/mongo/transport/SConscript b/src/mongo/transport/SConscript index a8a2bb3776d..6ca36ed7916 100644 --- a/src/mongo/transport/SConscript +++ b/src/mongo/transport/SConscript @@ -30,7 +30,7 @@ env.Library( ) tlEnv = env.Clone() -tlEnv.InjectThirdPartyIncludePaths(libraries=['asio']) +tlEnv.InjectThirdParty(libraries=['asio']) tlEnv.Library( target='transport_layer_manager', @@ -208,7 +208,7 @@ env.CppUnitTest( ) zlibEnv = env.Clone() -zlibEnv.InjectThirdPartyIncludePaths(libraries=['zlib', 'zstd', 'snappy']) +zlibEnv.InjectThirdParty(libraries=['zlib', 'zstd', 'snappy']) zlibEnv.Library( target='message_compressor', source=[ diff --git a/src/mongo/unittest/SConscript b/src/mongo/unittest/SConscript index 21bb594a835..253744b6de6 100644 --- a/src/mongo/unittest/SConscript +++ b/src/mongo/unittest/SConscript @@ -53,7 +53,7 @@ env.Library( ) bmEnv = env.Clone() -bmEnv.InjectThirdPartyIncludePaths(libraries=['benchmark']) +bmEnv.InjectThirdParty(libraries=['benchmark']) bmEnv.Library( target='benchmark_main', source=[ diff --git a/src/mongo/util/SConscript b/src/mongo/util/SConscript index 6c218980a0e..a5674b3eb18 100644 --- a/src/mongo/util/SConscript +++ b/src/mongo/util/SConscript @@ -8,7 +8,7 @@ Import("use_system_version_of_library") env = env.Clone() -env.InjectThirdPartyIncludePaths('asio') +env.InjectThirdParty('asio') env.SConscript( dirs=[ @@ -380,7 +380,7 @@ if env['MONGO_ALLOCATOR'] == 'tcmalloc': if not use_system_version_of_library('tcmalloc'): # Add in the include path for our vendored tcmalloc. - tcmspEnv.InjectThirdPartyIncludePaths('gperftools') + tcmspEnv.InjectThirdParty('gperftools') # If our changes to tcmalloc are ever upstreamed, this should become set based on a top # level configure check, though its effects should still be scoped just to these files. @@ -393,7 +393,7 @@ if env['MONGO_ALLOCATOR'] == 'tcmalloc': if not use_system_version_of_library('valgrind'): # Include valgrind since tcmalloc disables itself while running under valgrind - tcmspEnv.InjectThirdPartyIncludePaths('valgrind') + tcmspEnv.InjectThirdParty('valgrind') tcmspEnv.Library( target='tcmalloc_set_parameter', @@ -512,7 +512,7 @@ if has_option('use-cpu-profiler'): ) if not use_system_version_of_library('tcmalloc'): - quick_exit_env.InjectThirdPartyIncludePaths( + quick_exit_env.InjectThirdParty( 'gperftools' ) @@ -822,7 +822,7 @@ if not use_system_version_of_library("icu"): ) icuEnv.Alias("generated-sources", generateICUInit) - icuEnv.InjectThirdPartyIncludePaths("icu") + icuEnv.InjectThirdParty("icu") # Since we are injecting the third-party ICU headers, we must also copy the same defines that we # use to configure ICU when building ICU sources. See comment in # src/third_party/icu4c-57.1/source/SConscript. diff --git a/src/mongo/util/dns_query_windows-impl.h b/src/mongo/util/dns_query_windows-impl.h index 65395da16b4..ba2940196d5 100644 --- a/src/mongo/util/dns_query_windows-impl.h +++ b/src/mongo/util/dns_query_windows-impl.h @@ -154,8 +154,14 @@ public: explicit DNSResponse(std::string service, PDNS_RECORDA initialResults) : _service(std::move(service)), _results(initialResults, freeDnsRecord) {} - class iterator : public std::iterator<std::forward_iterator_tag, ResourceRecord> { + class iterator { public: + using iterator_category = std::forward_iterator_tag; + using value_type = ResourceRecord; + using difference_type = std::ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; + const ResourceRecord& operator*() { this->_populate(); return this->_storage; diff --git a/src/mongo/util/future.h b/src/mongo/util/future.h index c32731c1986..3ad43982591 100644 --- a/src/mongo/util/future.h +++ b/src/mongo/util/future.h @@ -1710,8 +1710,8 @@ inline auto makePromiseFuture() { * FutureContinuationResult<std::function<int(bool)>, NotBool> SFINAE-safe substitution failure. */ template <typename Func, typename... Args> -using FutureContinuationResult = - typename future_details::FutureContinuationResultImpl<std::result_of_t<Func(Args&&...)>>::type; +using FutureContinuationResult = typename future_details::FutureContinuationResultImpl< + std::invoke_result_t<Func, Args&&...>>::type; // // Implementations of methods that couldn't be defined in the class due to ordering requirements. @@ -1719,12 +1719,14 @@ using FutureContinuationResult = template <typename T> inline Future<T> Promise<T>::getFuture() noexcept { + using namespace future_details; _sharedState->threadUnsafeIncRefCountTo(2); return Future<T>(boost::intrusive_ptr<SharedState<T>>(_sharedState.get(), /*add ref*/ false)); } template <typename T> inline void Promise<T>::setFrom(Future<T>&& future) noexcept { + using namespace future_details; setImpl([&](boost::intrusive_ptr<SharedState<T>>&& sharedState) { future.propagateResultTo(sharedState.get()); }); @@ -1743,6 +1745,7 @@ template <typename T> template <typename T> inline SharedSemiFuture<T> Future<T>::share() && noexcept { + using namespace future_details; if (!_immediate) return SharedSemiFuture<T>(std::move(_shared)); diff --git a/src/mongo/util/options_parser/SConscript b/src/mongo/util/options_parser/SConscript index ce5083bd1e8..03c7882bfe1 100644 --- a/src/mongo/util/options_parser/SConscript +++ b/src/mongo/util/options_parser/SConscript @@ -5,7 +5,7 @@ Import("env") env = env.Clone() optsEnv = env.Clone() -optsEnv.InjectThirdPartyIncludePaths(libraries=['yaml']) +optsEnv.InjectThirdParty(libraries=['yaml']) optsEnv.Library( target='options_parser', diff --git a/src/third_party/SConscript b/src/third_party/SConscript index 1a153bc6110..3858e7360ba 100644 --- a/src/third_party/SConscript +++ b/src/third_party/SConscript @@ -20,107 +20,130 @@ tomcryptSuffix = '-1.18.2' benchmarkSuffix = '-1.4.1' sqliteSuffix = '-amalgamation-3260000' -thirdPartyIncludePathList = [ - ('s2', '#/src/third_party/s2'), - ('timelib', '#/src/third_party/timelib' + timelibSuffix), -] +thirdPartyEnvironmentModifications = { + 's2' : { + 'CPPPATH' : ['#src/third_party/s2'], + }, + 'timelib' : { + 'CPPPATH' : ['#/src/third_party/timelib' + timelibSuffix], + } +} if not use_system_version_of_library('tcmalloc'): - thirdPartyIncludePathList.append( - ('gperftools', '#/src/third_party/gperftools' + gperftoolsSuffix + '/src')) + thirdPartyEnvironmentModifications['gperftools'] = { + 'CPPPATH' : ['#/src/third_party/gperftools' + gperftoolsSuffix + '/src'], + } if not use_system_version_of_library('pcre'): - thirdPartyIncludePathList.append( - ('pcre', '#/src/third_party/pcre' + pcreSuffix)) + thirdPartyEnvironmentModifications['pcre'] = { + 'CPPPATH' : ['#/src/third_party/pcre' + pcreSuffix], + } if not use_system_version_of_library('boost'): - thirdPartyIncludePathList.append( - ('boost', '#/src/third_party/boost' + boostSuffix)) + thirdPartyEnvironmentModifications['boost'] = { + 'CPPPATH' : ['#/src/third_party/boost' + boostSuffix], + } if not use_system_version_of_library('abseil-cpp'): - thirdPartyIncludePathList.append( - ('abseil-cpp', '#/src/third_party/abseil-cpp-master/abseil-cpp')) + thirdPartyEnvironmentModifications['abseil-cpp'] = { + 'CPPPATH' : ['#/src/third_party/abseil-cpp-master/abseil-cpp'], + } if not use_system_version_of_library('snappy'): - thirdPartyIncludePathList.append( - ('snappy', '#/src/third_party/snappy' + snappySuffix)) + thirdPartyEnvironmentModifications['snappy'] = { + 'CPPPATH' : ['#/src/third_party/snappy' + snappySuffix], + } # Valgrind is a header only include as valgrind.h includes everything we need if not use_system_version_of_library('valgrind'): - thirdPartyIncludePathList.append( - ('valgrind', '#/src/third_party/valgrind-3.14.0/include')) + thirdPartyEnvironmentModifications['valgrind'] = { + 'CPPPATH' : ['#/src/third_party/valgrind-3.14.0/include'], + } if not use_system_version_of_library('zlib'): - thirdPartyIncludePathList.append( - ('zlib', '#/src/third_party/zlib' + zlibSuffix)) + thirdPartyEnvironmentModifications['zlib'] = { + 'CPPPATH' : ['#/src/third_party/zlib' + zlibSuffix], + } if not use_system_version_of_library('zstd'): - thirdPartyIncludePathList.append( - ('zstd', '#/src/third_party/zstandard' + zstdSuffix + '/zstd/lib')) + thirdPartyEnvironmentModifications['zstd'] = { + 'CPPPATH' : ['#/src/third_party/zstandard' + zstdSuffix + '/zstd/lib'], + } if not use_system_version_of_library('sqlite'): - thirdPartyIncludePathList.append( - ('sqlite', '#/src/third_party/sqlite' + sqliteSuffix + '/sqlite')) + thirdPartyEnvironmentModifications['sqlite'] = { + 'CPPPATH' : ['#/src/third_party/sqlite' + sqliteSuffix + '/sqlite'], + } if not use_system_version_of_library('google-benchmark'): - thirdPartyIncludePathList.append( - ('benchmark', '#/src/third_party/benchmark' + benchmarkSuffix + '/benchmark/include')) + thirdPartyEnvironmentModifications['benchmark'] = { + 'CPPPATH' : ['#/src/third_party/benchmark' + benchmarkSuffix + '/benchmark/include'], + } # TODO: figure out if we want to offer system versions of mozjs. Mozilla # hasn't offered a source tarball since 24, but in theory they could. # #if not use_system_version_of_library('mozjs'): if True: - thirdPartyIncludePathList.append( - ('mozjs', ['#/src/third_party/mozjs' + mozjsSuffix + '/include', - '#/src/third_party/mozjs' + mozjsSuffix + '/mongo_sources', - '#/src/third_party/mozjs' + mozjsSuffix + '/platform/' + env["TARGET_ARCH"] + "/" + env["TARGET_OS"] + "/include", - ])) + thirdPartyEnvironmentModifications['mozjs'] = { + 'CPPPATH' : [ + '#/src/third_party/mozjs' + mozjsSuffix + '/include', + '#/src/third_party/mozjs' + mozjsSuffix + '/mongo_sources', + '#/src/third_party/mozjs' + mozjsSuffix + '/platform/' + env["TARGET_ARCH"] + "/" + env["TARGET_OS"] + "/include", + ], + } if "tom" in env["MONGO_CRYPTO"]: - thirdPartyIncludePathList.append( - ('tomcrypt', ['#/src/third_party/tomcrypt' + tomcryptSuffix + '/src/headers', - ])) - + thirdPartyEnvironmentModifications['tomcrypt'] = { + 'CPPPATH' : ['#/src/third_party/tomcrypt' + tomcryptSuffix + '/src/headers'], + } if not use_system_version_of_library('stemmer'): - thirdPartyIncludePathList.append( - ('stemmer', '#/src/third_party/libstemmer_c/include')) + thirdPartyEnvironmentModifications['stemmer'] = { + 'CPPPATH' : ['#/src/third_party/libstemmer_c/include'], + } # Note that the wiredtiger.h header is generated, so # we want to look for it in the build directory not # the source directory. if wiredtiger and not use_system_version_of_library('wiredtiger'): - thirdPartyIncludePathList.append( - ('wiredtiger', '$BUILD_DIR/third_party/wiredtiger')) + thirdPartyEnvironmentModifications['wiredtiger'] = { + 'CPPPATH' : ['$BUILD_DIR/third_party/wiredtiger'], + } if not use_system_version_of_library('yaml'): - thirdPartyIncludePathList.append( - ('yaml', '#/src/third_party/yaml-cpp' + yamlSuffix + '/include')) + thirdPartyEnvironmentModifications['yaml'] = { + 'CPPPATH' : ['#/src/third_party/yaml-cpp' + yamlSuffix + '/include'], + 'CPPDEFINES' : ['_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING'] if env.ToolchainIs('msvc') else [], + } if not use_system_version_of_library('asio'): - thirdPartyIncludePathList.append( - ('asio', '#/src/third_party/asio-master/asio/include')) + thirdPartyEnvironmentModifications['asio'] = { + 'CPPPATH' : ['#/src/third_party/asio-master/asio/include'], + } if not use_system_version_of_library('intel_decimal128'): - thirdPartyIncludePathList.append( - ('intel_decimal128', '#/src/third_party/IntelRDFPMathLib20U1/LIBRARY')) + thirdPartyEnvironmentModifications['intel_decimal128'] = { + 'CPPPATH' : ['#/src/third_party/IntelRDFPMathLib20U1/LIBRARY'], + } if not use_system_version_of_library('icu'): - thirdPartyIncludePathList.append( - ('icu', '#/src/third_party/icu4c' + icuSuffix + '/source/common')) - thirdPartyIncludePathList.append( - ('icu', '#/src/third_party/icu4c' + icuSuffix + '/source/i18n')) - -def injectAllThirdPartyIncludePaths(thisEnv): - thisEnv.PrependUnique(CPPPATH=[entry[1] for entry in thirdPartyIncludePathList]) - -def injectThirdPartyIncludePaths(thisEnv, libraries): - thisEnv.PrependUnique(CPPPATH=[ - entry[1] for entry in thirdPartyIncludePathList if entry[0] in libraries]) - -env.AddMethod(injectAllThirdPartyIncludePaths, 'InjectAllThirdPartyIncludePaths') -env.AddMethod(injectThirdPartyIncludePaths, 'InjectThirdPartyIncludePaths') + thirdPartyEnvironmentModifications['icu'] = { + 'CPPPATH' : ['#/src/third_party/icu4c' + icuSuffix + '/source/common', + '#/src/third_party/icu4c' + icuSuffix + '/source/i18n'], + } + +def injectThirdParty(thisEnv, libraries=[], parts=[]): + libraries = thisEnv.Flatten([libraries]) + parts = thisEnv.Flatten([parts]) + for lib in libraries: + if not parts: + thisEnv.PrependUnique(**thirdPartyEnvironmentModifications[lib]) + else: + for part in parts: + thisEnv.PrependUnique({part : thirdPartyEnvironmentModifications[lib][part]}) + +env.AddMethod(injectThirdParty, 'InjectThirdParty') env = env.Clone() @@ -129,7 +152,7 @@ murmurEnv.SConscript('murmurhash3/SConscript', exports={ 'env' : murmurEnv }) s2Env = env.Clone() -s2Env.InjectThirdPartyIncludePaths(libraries=['s2', 'boost', 'abseil-cpp']) +s2Env.InjectThirdParty(libraries=['s2', 'boost', 'abseil-cpp']) s2Env.InjectMongoIncludePaths() s2Env.SConscript('s2/SConscript', exports={'env' : s2Env}) @@ -142,7 +165,7 @@ if use_system_version_of_library("pcre"): ]) else: pcreEnv = env.Clone() - pcreEnv.InjectThirdPartyIncludePaths(libraries=['pcre']) + pcreEnv.InjectThirdParty(libraries=['pcre']) pcreEnv.SConscript('pcre' + pcreSuffix + '/SConscript', exports={ 'env' : pcreEnv }) pcreEnv = pcreEnv.Clone( LIBDEPS_INTERFACE=[ @@ -171,7 +194,7 @@ if use_system_version_of_library("boost"): else: boostDirectory = 'boost' + boostSuffix boostEnv = env.Clone() - boostEnv.InjectThirdPartyIncludePaths(libraries=['boost']) + boostEnv.InjectThirdParty(libraries=['boost']) boostEnv.SConscript(boostDirectory + '/SConscript', exports={ 'env' : boostEnv }) boostEnv = boostEnv.Clone( LIBDEPS_INTERFACE=[ @@ -197,7 +220,7 @@ if use_system_version_of_library("abseil-cpp"): else: abseilDirectory = 'abseil-cpp-master' abseilEnv = env.Clone() - abseilEnv.InjectThirdPartyIncludePaths(libraries=['abseil-cpp']) + abseilEnv.InjectThirdParty(libraries=['abseil-cpp']) abseilEnv.SConscript(abseilDirectory + '/SConscript', exports={ 'env' : abseilEnv }) abseilEnv = abseilEnv.Clone( LIBDEPS_INTERFACE=[ @@ -218,7 +241,7 @@ if use_system_version_of_library("snappy"): ]) else: snappyEnv = env.Clone() - snappyEnv.InjectThirdPartyIncludePaths(libraries=['snappy']) + snappyEnv.InjectThirdParty(libraries=['snappy']) snappyEnv.InjectMongoIncludePaths() snappyEnv.SConscript('snappy' + snappySuffix + '/SConscript', exports={ 'env' : snappyEnv }) snappyEnv = snappyEnv.Clone( @@ -239,7 +262,7 @@ if use_system_version_of_library("zlib"): ]) else: zlibEnv = env.Clone() - zlibEnv.InjectThirdPartyIncludePaths(libraries=['zlib']) + zlibEnv.InjectThirdParty(libraries=['zlib']) zlibEnv.SConscript('zlib' + zlibSuffix + '/SConscript', exports={ 'env' : zlibEnv }) zlibEnv = zlibEnv.Clone( LIBDEPS_INTERFACE=[ @@ -259,7 +282,7 @@ if use_system_version_of_library("zstd"): ]) else: zstdEnv = env.Clone() - zstdEnv.InjectThirdPartyIncludePaths(libraries=['zstd']) + zstdEnv.InjectThirdParty(libraries=['zstd']) zstdEnv.SConscript('zstandard' + zstdSuffix + '/SConscript', exports={ 'env' : zstdEnv }) zstdEnv = zstdEnv.Clone( LIBDEPS_INTERFACE=[ @@ -279,7 +302,7 @@ if use_system_version_of_library("google-benchmark"): ]) else: benchmarkEnv = env.Clone() - benchmarkEnv.InjectThirdPartyIncludePaths(libraries=['benchmark']) + benchmarkEnv.InjectThirdParty(libraries=['benchmark']) benchmarkEnv.SConscript( 'benchmark' + benchmarkSuffix + '/SConscript', exports={ 'env' : benchmarkEnv }) @@ -332,7 +355,7 @@ if (gperftoolsEnv['MONGO_ALLOCATOR'] in ["tcmalloc", "tcmalloc-experimental"]): ]) else: gperftoolsEnv = env.Clone() - gperftoolsEnv.InjectThirdPartyIncludePaths(libraries=['gperftools']) + gperftoolsEnv.InjectThirdParty(libraries=['gperftools']) gperftoolsEnv.SConscript('gperftools' + gperftoolsSuffix + '/SConscript', exports={ 'env' : gperftoolsEnv }) gperftoolsEnv = gperftoolsEnv.Clone( LIBDEPS_INTERFACE=[ @@ -353,7 +376,7 @@ if use_system_version_of_library("stemmer"): ]) else: stemmerEnv = env.Clone() - stemmerEnv.InjectThirdPartyIncludePaths(libraries=['stemmer']) + stemmerEnv.InjectThirdParty(libraries=['stemmer']) stemmerEnv.SConscript('libstemmer_c/SConscript', exports={ 'env' : stemmerEnv }) stemmerEnv = stemmerEnv.Clone( LIBDEPS_INTERFACE=[ @@ -374,7 +397,7 @@ if use_system_version_of_library("yaml"): ]) else: yamlEnv = env.Clone() - yamlEnv.InjectThirdPartyIncludePaths(libraries=['yaml', 'boost']) + yamlEnv.InjectThirdParty(libraries=['yaml', 'boost']) yamlEnv.SConscript('yaml-cpp' + yamlSuffix + '/SConscript', exports={ 'env' : yamlEnv }) yamlEnv = yamlEnv.Clone( LIBDEPS_INTERFACE=[ @@ -388,7 +411,7 @@ yamlEnv.Library( ]) timelibEnv = env.Clone(); -timelibEnv.InjectThirdPartyIncludePaths(libraries=['timelib']) +timelibEnv.InjectThirdParty(libraries=['timelib']) timelibEnv.SConscript('timelib' + timelibSuffix + '/SConscript', exports={ 'env' : timelibEnv }) timelibEnv = timelibEnv.Clone( LIBDEPS_INTERFACE=[ @@ -409,7 +432,7 @@ if wiredtiger: ]) else: wiredtigerEnv = env.Clone() - wiredtigerEnv.InjectThirdPartyIncludePaths(libraries=['wiredtiger']) + wiredtigerEnv.InjectThirdParty(libraries=['wiredtiger']) wiredtigerEnv.SConscript('wiredtiger/SConscript', exports={ 'env' : wiredtigerEnv }) wiredtigerEnv = wiredtigerEnv.Clone( LIBDEPS_INTERFACE=[ @@ -429,7 +452,7 @@ if use_system_version_of_library("sqlite"): ]) else: sqliteEnv = env.Clone() - sqliteEnv.InjectThirdPartyIncludePaths(libraries=['sqlite']) + sqliteEnv.InjectThirdParty(libraries=['sqlite']) sqliteEnv.SConscript('sqlite' + sqliteSuffix + '/SConscript', exports={ 'env' : sqliteEnv }) sqliteEnv = sqliteEnv.Clone( LIBDEPS_INTERFACE=[ @@ -449,7 +472,7 @@ if use_system_version_of_library("asio"): asioEnv = env.Clone() else: asioEnv = env.Clone() - asioEnv.InjectThirdPartyIncludePaths(libraries=['asio']) + asioEnv.InjectThirdParty(libraries=['asio']) asioEnv.SConscript('asio-master/SConscript', exports={ 'env' : asioEnv }) asioEnv = asioEnv.Clone( LIBDEPS_INTERFACE=[ @@ -469,7 +492,7 @@ if use_system_version_of_library("intel_decimal128"): ]) else: intelDecimal128Env = env.Clone() - intelDecimal128Env.InjectThirdPartyIncludePaths(libraries=['intel_decimal128']) + intelDecimal128Env.InjectThirdParty(libraries=['intel_decimal128']) intelDecimal128Env.SConscript('IntelRDFPMathLib20U1/SConscript', exports={ 'env' : intelDecimal128Env }) intelDecimal128Env = intelDecimal128Env.Clone( LIBDEPS_INTERFACE=[ @@ -491,7 +514,7 @@ if use_system_version_of_library("icu"): ]) else: icuEnv = env.Clone() - icuEnv.InjectThirdPartyIncludePaths(libraries=['icu']) + icuEnv.InjectThirdParty(libraries=['icu']) icuEnv.SConscript('icu4c' + icuSuffix + '/source/SConscript', exports={ 'env' : icuEnv }) icuEnv = icuEnv.Clone( LIBDEPS_INTERFACE=[ diff --git a/src/third_party/abseil-cpp-master/SConscript b/src/third_party/abseil-cpp-master/SConscript index 1eefdc0ccfd..3229e391f70 100644 --- a/src/third_party/abseil-cpp-master/SConscript +++ b/src/third_party/abseil-cpp-master/SConscript @@ -2,7 +2,7 @@ Import("env") env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=['abseil-cpp']) +env.InjectThirdParty(libraries=['abseil-cpp']) env.Library( target="absl_hash", diff --git a/src/third_party/asio-master/SConscript b/src/third_party/asio-master/SConscript index 43df059f59b..e0c423ce5b4 100644 --- a/src/third_party/asio-master/SConscript +++ b/src/third_party/asio-master/SConscript @@ -7,7 +7,7 @@ asio_src = [ "asio/src/asio.cpp", ] -env.InjectThirdPartyIncludePaths(libraries=['boost']) +env.InjectThirdParty(libraries=['boost']) env.Library( target="asio", diff --git a/src/third_party/mozjs-45/SConscript b/src/third_party/mozjs-45/SConscript index 747edfe8021..225c9b0ad54 100644 --- a/src/third_party/mozjs-45/SConscript +++ b/src/third_party/mozjs-45/SConscript @@ -6,7 +6,7 @@ Import([ ]) env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=['zlib']) +env.InjectThirdParty(libraries=['zlib']) def removeIfPresent(lst, item): try: diff --git a/src/third_party/mozjs-60/SConscript b/src/third_party/mozjs-60/SConscript index 425f4bef6b2..dbf79864fb5 100644 --- a/src/third_party/mozjs-60/SConscript +++ b/src/third_party/mozjs-60/SConscript @@ -6,7 +6,7 @@ Import([ ]) env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=['zlib']) +env.InjectThirdParty(libraries=['zlib']) def removeIfPresent(lst, item): try: diff --git a/src/third_party/murmurhash3/SConscript b/src/third_party/murmurhash3/SConscript index 9a879856f84..09ed6c1e6ae 100644 --- a/src/third_party/murmurhash3/SConscript +++ b/src/third_party/murmurhash3/SConscript @@ -2,7 +2,7 @@ Import("env") env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=['boost']) +env.InjectThirdParty(libraries=['boost']) if env.TargetOSIs('windows'): # C4141: 'inline': used more than once diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript index c315166275e..cdd090b0b63 100644 --- a/src/third_party/wiredtiger/SConscript +++ b/src/third_party/wiredtiger/SConscript @@ -8,7 +8,7 @@ Import("endian") env = env.Clone() -env.InjectThirdPartyIncludePaths(libraries=['snappy', 'zlib', 'zstd']) +env.InjectThirdParty(libraries=['snappy', 'zlib', 'zstd']) if endian == "big": env.Append(CPPDEFINES=[('WORDS_BIGENDIAN', 1)]) @@ -53,7 +53,7 @@ if env.TargetOSIs('windows'): "/wd4090" # Ignore warning about mismatched const qualifiers ]) if env['MONGO_ALLOCATOR'] in ['tcmalloc', 'tcmalloc-experimental']: - env.InjectThirdPartyIncludePaths(libraries=['gperftools']) + env.InjectThirdParty(libraries=['gperftools']) env.Append(CPPDEFINES=['HAVE_LIBTCMALLOC']) elif env.TargetOSIs('darwin'): env.Append(CPPPATH=["build_darwin"]) diff --git a/src/third_party/yaml-cpp-0.6.2/SConscript b/src/third_party/yaml-cpp-0.6.2/SConscript index c147f5a54e4..72ddf3ecdb8 100644 --- a/src/third_party/yaml-cpp-0.6.2/SConscript +++ b/src/third_party/yaml-cpp-0.6.2/SConscript @@ -9,6 +9,8 @@ try: except ValueError: pass +env.InjectThirdParty('yaml', 'CPPDEFINES') + env.Library("yaml", [ "src/binary.cpp", |