summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2021-09-16 14:43:03 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-09-17 18:26:24 +0000
commitbe34e602e19cea0c795a0955646e7ce50350b997 (patch)
treee1915e65013ce32b1481bab32cb98917d51d00e0 /src/mongo
parent5055d631241e374963f230c8bfea1cf0022c28f0 (diff)
downloadmongo-be34e602e19cea0c795a0955646e7ce50350b997.tar.gz
SERVER-59234 Fix clang-12 warnings in C++20 mode
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/catalog/collection_catalog.cpp4
-rw-r--r--src/mongo/db/catalog/collection_catalog.h6
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/SConscript10
-rw-r--r--src/mongo/scripting/mozjs/bindata.cpp2
-rw-r--r--src/mongo/util/system_tick_source.cpp2
5 files changed, 16 insertions, 8 deletions
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)
/**