diff options
author | Andrew Morrow <acm@mongodb.com> | 2021-09-16 14:43:03 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-17 18:26:24 +0000 |
commit | be34e602e19cea0c795a0955646e7ce50350b997 (patch) | |
tree | e1915e65013ce32b1481bab32cb98917d51d00e0 | |
parent | 5055d631241e374963f230c8bfea1cf0022c28f0 (diff) | |
download | mongo-be34e602e19cea0c795a0955646e7ce50350b997.tar.gz |
SERVER-59234 Fix clang-12 warnings in C++20 mode
-rw-r--r-- | etc/evergreen.yml | 2 | ||||
-rw-r--r-- | src/mongo/db/catalog/collection_catalog.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/catalog/collection_catalog.h | 6 | ||||
-rw-r--r-- | src/mongo/db/storage/ephemeral_for_test/SConscript | 10 | ||||
-rw-r--r-- | src/mongo/scripting/mozjs/bindata.cpp | 2 | ||||
-rw-r--r-- | src/mongo/util/system_tick_source.cpp | 2 |
6 files changed, 17 insertions, 9 deletions
diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 66426b6943b..3b9e8591cee 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -7864,7 +7864,7 @@ buildvariants: display_name: "~ Shared Library Enterprise Ubuntu 21.04 clang12 C++20 DEBUG" expansions: <<: *enterprise-ubuntu2104-dynamic-gcc11-debug-experimental-expansions - compile_flags: --dbg=on --opt=on -j$(grep -c ^processor /proc/cpuinfo) --link-model=dynamic CC=/usr/bin/clang-12 CXX=/usr/bin/clang++-12 --disable-warnings-as-errors --cxx-std=20 + compile_flags: --dbg=on --opt=on -j$(grep -c ^processor /proc/cpuinfo) --link-model=dynamic CC=/usr/bin/clang-12 CXX=/usr/bin/clang++-12 --cxx-std=20 - name: enterprise-linux-64-amazon-ami display_name: "Enterprise Amazon Linux" diff --git a/src/mongo/db/catalog/collection_catalog.cpp b/src/mongo/db/catalog/collection_catalog.cpp index 645ccea7312..aca202437d7 100644 --- a/src/mongo/db/catalog/collection_catalog.cpp +++ b/src/mongo/db/catalog/collection_catalog.cpp @@ -376,7 +376,7 @@ CollectionCatalog::iterator CollectionCatalog::iterator::operator++(int) { return oldPosition; } -bool CollectionCatalog::iterator::operator==(const iterator& other) { +bool CollectionCatalog::iterator::operator==(const iterator& other) const { invariant(_catalog == other._catalog); if (other._mapIter == _catalog->_orderedCollections.end()) { return _uuid == boost::none; @@ -385,7 +385,7 @@ bool CollectionCatalog::iterator::operator==(const iterator& other) { return _uuid == other._uuid; } -bool CollectionCatalog::iterator::operator!=(const iterator& other) { +bool CollectionCatalog::iterator::operator!=(const iterator& other) const { return !(*this == other); } diff --git a/src/mongo/db/catalog/collection_catalog.h b/src/mongo/db/catalog/collection_catalog.h index 5eed6683a7d..5c8f4c03107 100644 --- a/src/mongo/db/catalog/collection_catalog.h +++ b/src/mongo/db/catalog/collection_catalog.h @@ -89,8 +89,8 @@ public: * Equality operators == and != do not attempt to reposition the iterators being compared. * The behavior for comparing invalid iterators is undefined. */ - bool operator==(const iterator& other); - bool operator!=(const iterator& other); + bool operator==(const iterator& other) const; + bool operator!=(const iterator& other) const; private: bool _exhausted(); @@ -118,7 +118,7 @@ public: ProfileSettings() = default; - bool operator==(const ProfileSettings& other) { + bool operator==(const ProfileSettings& other) const { return level == other.level && filter == other.filter; } }; diff --git a/src/mongo/db/storage/ephemeral_for_test/SConscript b/src/mongo/db/storage/ephemeral_for_test/SConscript index 2779d423dc2..27655b355db 100644 --- a/src/mongo/db/storage/ephemeral_for_test/SConscript +++ b/src/mongo/db/storage/ephemeral_for_test/SConscript @@ -4,6 +4,16 @@ Import("env") env = env.Clone() +env.Append( + # TODO(SERVER-60031): Remove these warning suppressions once + # RadixStore::radix_iterator declares its [in]equality methods as + # const. + CXXFLAGS=[] if not env.ToolchainIs('clang') else [ + '-Wno-unknown-warning-option', + '-Wno-ambiguous-reversed-operator', + ], +) + env.Library( target='storage_ephemeral_for_test_core', source=[ diff --git a/src/mongo/scripting/mozjs/bindata.cpp b/src/mongo/scripting/mozjs/bindata.cpp index 36c37700e20..6182aac28c1 100644 --- a/src/mongo/scripting/mozjs/bindata.cpp +++ b/src/mongo/scripting/mozjs/bindata.cpp @@ -164,7 +164,7 @@ void BinDataInfo::Functions::toString::call(JSContext* cx, JS::CallArgs args) { auto str = getEncoded(args.thisv()); str::stream ss; - auto binType = o.getNumber(InternedString::type); + auto binType = o.getNumberInt(InternedString::type); if (binType == newUUID) { auto decoded = mongo::base64::decode(*str); diff --git a/src/mongo/util/system_tick_source.cpp b/src/mongo/util/system_tick_source.cpp index a11de88fd16..ee5f24d4e83 100644 --- a/src/mongo/util/system_tick_source.cpp +++ b/src/mongo/util/system_tick_source.cpp @@ -72,8 +72,6 @@ TickSource::Tick _timerNowGeneric() { // Overridden in initTickSource() with better implementation where available. TickSource::Tick (*_timerNow)() = &_timerNowGeneric; -SystemTickSource globalSystemTickSource; - #if defined(_WIN32) /** |