summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-05-04 19:29:17 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-04 23:55:07 +0000
commite17313d141f04ef1cb05d290fcdf1fdbbcaa231c (patch)
treecb1bd15f640c817e9b21d3b50d5f912a8d87a06d /src/mongo
parentad37d48cc3f4d01bae5f8b50f0a66e191f146d34 (diff)
downloadmongo-e17313d141f04ef1cb05d290fcdf1fdbbcaa231c.tar.gz
SERVER-56585 replace MONGO_COMPILER_VARIABLE_UNUSED with c++17 attribute maybe_unused (.cpp files only)
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/base/initializer.cpp2
-rw-r--r--src/mongo/bson/mutable/document.cpp4
-rw-r--r--src/mongo/db/index/sort_key_generator_test.cpp2
-rw-r--r--src/mongo/db/index_builds_coordinator.cpp17
-rw-r--r--src/mongo/db/repl/rollback_impl.cpp2
-rw-r--r--src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_init.cpp2
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp3
-rw-r--r--src/mongo/db/timeseries/bucket_catalog.cpp4
-rw-r--r--src/mongo/db/update/push_node.cpp2
-rw-r--r--src/mongo/scripting/mozjs/session.cpp6
-rw-r--r--src/mongo/util/signal_handlers_synchronous.cpp2
11 files changed, 21 insertions, 25 deletions
diff --git a/src/mongo/base/initializer.cpp b/src/mongo/base/initializer.cpp
index 633067784f7..c64e5770049 100644
--- a/src/mongo/base/initializer.cpp
+++ b/src/mongo/base/initializer.cpp
@@ -227,7 +227,7 @@ namespace {
// Make sure that getGlobalInitializer() is called at least once before main(), and so at least
// once in a single-threaded context. Otherwise, static initialization inside
// getGlobalInitializer() won't be thread-safe.
-MONGO_COMPILER_VARIABLE_UNUSED const auto earlyCaller = [] {
+[[maybe_unused]] const auto earlyCaller = [] {
getGlobalInitializer();
return 0;
}();
diff --git a/src/mongo/bson/mutable/document.cpp b/src/mongo/bson/mutable/document.cpp
index 3e7853146a1..b72b9d8f326 100644
--- a/src/mongo/bson/mutable/document.cpp
+++ b/src/mongo/bson/mutable/document.cpp
@@ -2277,14 +2277,14 @@ Document::Document(const BSONObj& value, InPlaceMode inPlaceMode)
void Document::reset() {
_impl->reset(Document::kInPlaceDisabled);
- MONGO_COMPILER_VARIABLE_UNUSED const Element newRoot = makeRootElement();
+ [[maybe_unused]] const Element newRoot = makeRootElement();
dassert(newRoot._repIdx == _root._repIdx);
dassert(_root._repIdx == kRootRepIdx);
}
void Document::reset(const BSONObj& value, InPlaceMode inPlaceMode) {
_impl->reset(inPlaceMode);
- MONGO_COMPILER_VARIABLE_UNUSED const Element newRoot = makeRootElement(value);
+ [[maybe_unused]] const Element newRoot = makeRootElement(value);
dassert(newRoot._repIdx == _root._repIdx);
dassert(_root._repIdx == kRootRepIdx);
}
diff --git a/src/mongo/db/index/sort_key_generator_test.cpp b/src/mongo/db/index/sort_key_generator_test.cpp
index 2e6641f000d..bf5899ead53 100644
--- a/src/mongo/db/index/sort_key_generator_test.cpp
+++ b/src/mongo/db/index/sort_key_generator_test.cpp
@@ -347,7 +347,7 @@ DEATH_TEST_REGEX_F(SortKeyGeneratorWorkingSetTest,
auto sortKeyGen = makeSortKeyGen(pattern, nullptr);
setRecordIdAndIdx(BSON("a" << 1 << "b" << 1), BSON("" << 2 << "" << 3));
member().metadata().setTextScore(9.9);
- MONGO_COMPILER_VARIABLE_UNUSED auto ignored = sortKeyGen->computeSortKey(member());
+ [[maybe_unused]] auto ignored = sortKeyGen->computeSortKey(member());
}
} // namespace
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp
index 732dd8fc237..9e3a9a8f059 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -1400,7 +1400,7 @@ void IndexBuildsCoordinator::restartIndexBuildsForRecovery(
try {
// This spawns a new thread and returns immediately. These index builds will resume and
// wait for a commit or abort to be replicated.
- MONGO_COMPILER_VARIABLE_UNUSED auto fut = uassertStatusOK(resumeIndexBuild(
+ [[maybe_unused]] auto fut = uassertStatusOK(resumeIndexBuild(
opCtx, nss->db().toString(), collUUID, indexSpecs, buildUUID, resumeInfo));
successfullyResumed.insert(buildUUID);
} catch (const DBException& e) {
@@ -1462,14 +1462,13 @@ void IndexBuildsCoordinator::restartIndexBuildsForRecovery(
indexBuildOptions.applicationMode = ApplicationMode::kStartupRepair;
// This spawns a new thread and returns immediately. These index builds will start and wait
// for a commit or abort to be replicated.
- MONGO_COMPILER_VARIABLE_UNUSED auto fut =
- uassertStatusOK(startIndexBuild(opCtx,
- nss->db().toString(),
- build.collUUID,
- build.indexSpecs,
- buildUUID,
- IndexBuildProtocol::kTwoPhase,
- indexBuildOptions));
+ [[maybe_unused]] auto fut = uassertStatusOK(startIndexBuild(opCtx,
+ nss->db().toString(),
+ build.collUUID,
+ build.indexSpecs,
+ buildUUID,
+ IndexBuildProtocol::kTwoPhase,
+ indexBuildOptions));
}
}
diff --git a/src/mongo/db/repl/rollback_impl.cpp b/src/mongo/db/repl/rollback_impl.cpp
index 14be427c59c..faa97126788 100644
--- a/src/mongo/db/repl/rollback_impl.cpp
+++ b/src/mongo/db/repl/rollback_impl.cpp
@@ -347,7 +347,7 @@ void RollbackImpl::_stopAndWaitForIndexBuilds(OperationContext* opCtx) {
invariant(opCtx);
// Aborts all active, two-phase index builds.
- MONGO_COMPILER_VARIABLE_UNUSED auto stoppedIndexBuilds =
+ [[maybe_unused]] auto stoppedIndexBuilds =
IndexBuildsCoordinator::get(opCtx)->stopIndexBuildsForRollback(opCtx);
// Get a list of all databases.
diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_init.cpp b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_init.cpp
index c2deace9fba..d0256805cea 100644
--- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_init.cpp
+++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_init.cpp
@@ -59,7 +59,7 @@ public:
++setupCountForUnitTests;
// Intentionally leaked.
- MONGO_COMPILER_VARIABLE_UNUSED auto leakedSection = new ServerStatusSection(kv.get());
+ [[maybe_unused]] auto leakedSection = new ServerStatusSection(kv.get());
// This allows unit tests to run this code without encountering memory leaks
#if __has_feature(address_sanitizer)
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
index c6c40aaec25..ba3b5894ae8 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
@@ -121,8 +121,7 @@ public:
++setupCountForUnitTests;
// Intentionally leaked.
- MONGO_COMPILER_VARIABLE_UNUSED auto leakedSection =
- new WiredTigerServerStatusSection(kv.get());
+ [[maybe_unused]] auto leakedSection = new WiredTigerServerStatusSection(kv.get());
// This allows unit tests to run this code without encountering memory leaks
#if __has_feature(address_sanitizer)
diff --git a/src/mongo/db/timeseries/bucket_catalog.cpp b/src/mongo/db/timeseries/bucket_catalog.cpp
index 6daf97c95e5..162b98aed97 100644
--- a/src/mongo/db/timeseries/bucket_catalog.cpp
+++ b/src/mongo/db/timeseries/bucket_catalog.cpp
@@ -1237,7 +1237,7 @@ BSONObj BucketCatalog::MinMax::minUpdates() {
BSONObjBuilder builder;
// Return constructed document even if empty.
- MONGO_COMPILER_VARIABLE_UNUSED auto appended = _appendUpdates(&builder, GetMin());
+ [[maybe_unused]] auto appended = _appendUpdates(&builder, GetMin());
return builder.obj();
}
@@ -1246,7 +1246,7 @@ BSONObj BucketCatalog::MinMax::maxUpdates() {
BSONObjBuilder builder;
// Return constructed document even if empty.
- MONGO_COMPILER_VARIABLE_UNUSED auto appended = _appendUpdates(&builder, GetMax());
+ [[maybe_unused]] auto appended = _appendUpdates(&builder, GetMax());
return builder.obj();
}
diff --git a/src/mongo/db/update/push_node.cpp b/src/mongo/db/update/push_node.cpp
index 46b44daa01a..e236f2e9124 100644
--- a/src/mongo/db/update/push_node.cpp
+++ b/src/mongo/db/update/push_node.cpp
@@ -270,7 +270,7 @@ ModifierNode::ModifyResult PushNode::insertElementsWithPosition(
// TODO: The use of std::accumulate here is maybe questionable
// given that we are ignoring the return value. MSVC flagged this,
// and we worked around by tagging the result as unused.
- MONGO_COMPILER_VARIABLE_UNUSED auto ignored =
+ [[maybe_unused]] auto ignored =
std::accumulate(std::next(valuesToPush.begin()),
valuesToPush.end(),
firstElementToInsert,
diff --git a/src/mongo/scripting/mozjs/session.cpp b/src/mongo/scripting/mozjs/session.cpp
index 6aa805ff425..a73e267356d 100644
--- a/src/mongo/scripting/mozjs/session.cpp
+++ b/src/mongo/scripting/mozjs/session.cpp
@@ -124,16 +124,14 @@ void endSession(SessionHolder* holder) {
BSONObj abortObj = BSON("abortTransaction" << 1 << "lsid" << holder->lsid << "txnNumber"
<< holder->txnNumber << "autocommit" << false);
- MONGO_COMPILER_VARIABLE_UNUSED auto ignored =
- holder->client->runCommand("admin", abortObj, out);
+ [[maybe_unused]] auto ignored = holder->client->runCommand("admin", abortObj, out);
}
EndSessions es;
es.setEndSessions({holder->lsid});
- MONGO_COMPILER_VARIABLE_UNUSED auto ignored =
- holder->client->runCommand("admin", es.toBSON(), out);
+ [[maybe_unused]] auto ignored = holder->client->runCommand("admin", es.toBSON(), out);
holder->client.reset();
}
diff --git a/src/mongo/util/signal_handlers_synchronous.cpp b/src/mongo/util/signal_handlers_synchronous.cpp
index b197107c210..8f052ea134b 100644
--- a/src/mongo/util/signal_handlers_synchronous.cpp
+++ b/src/mongo/util/signal_handlers_synchronous.cpp
@@ -268,7 +268,7 @@ extern "C" void abruptQuitAction(int signalNum, siginfo_t*, void*) {
extern "C" void abruptQuitWithAddrSignal(int signalNum, siginfo_t* siginfo, void* ucontext_erased) {
// For convenient debugger access.
- MONGO_COMPILER_VARIABLE_UNUSED auto ucontext = static_cast<const ucontext_t*>(ucontext_erased);
+ [[maybe_unused]] auto ucontext = static_cast<const ucontext_t*>(ucontext_erased);
MallocFreeOStreamGuard lk{};