summaryrefslogtreecommitdiff
path: root/src/mongo/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util')
-rw-r--r--src/mongo/util/alarm.h2
-rw-r--r--src/mongo/util/alarm_test.cpp12
-rw-r--r--src/mongo/util/assert_util.cpp11
-rw-r--r--src/mongo/util/assert_util_test.cpp16
-rw-r--r--src/mongo/util/boost_assert_impl.cpp7
-rw-r--r--src/mongo/util/bson_util.h2
-rw-r--r--src/mongo/util/bufreader.h2
-rw-r--r--src/mongo/util/checksum.h2
-rw-r--r--src/mongo/util/clock_source_mock_test.cpp21
-rw-r--r--src/mongo/util/cmdline_utils/censor_cmdline.cpp2
-rw-r--r--src/mongo/util/cmdline_utils/censor_cmdline.h2
-rw-r--r--src/mongo/util/concurrency/idle_thread_block.cpp4
-rw-r--r--src/mongo/util/concurrency/mutex.h2
-rw-r--r--src/mongo/util/concurrency/thread_name.cpp4
-rw-r--r--src/mongo/util/concurrency/thread_pool.cpp4
-rw-r--r--src/mongo/util/concurrency/ticketholder.cpp5
-rw-r--r--src/mongo/util/concurrency/value.h2
-rw-r--r--src/mongo/util/debugger.cpp2
-rw-r--r--src/mongo/util/decimal_counter.h2
-rw-r--r--src/mongo/util/diagnostic_info.cpp2
-rw-r--r--src/mongo/util/diagnostic_info.h2
-rw-r--r--src/mongo/util/diagnostic_info_test.cpp2
-rw-r--r--src/mongo/util/dns_name.h4
-rw-r--r--src/mongo/util/dns_query_test.cpp9
-rw-r--r--src/mongo/util/exception_filter_win32.cpp4
-rw-r--r--src/mongo/util/exit.cpp5
-rw-r--r--src/mongo/util/fail_point.cpp2
-rw-r--r--src/mongo/util/fail_point_test.cpp7
-rw-r--r--src/mongo/util/file.cpp21
-rw-r--r--src/mongo/util/file.h2
-rw-r--r--src/mongo/util/future.h2
-rw-r--r--src/mongo/util/future_impl.h11
-rw-r--r--src/mongo/util/future_test_edge_cases.cpp2
-rw-r--r--src/mongo/util/future_test_executor_future.cpp52
-rw-r--r--src/mongo/util/future_test_future_int.cpp22
-rw-r--r--src/mongo/util/future_test_future_move_only.cpp10
-rw-r--r--src/mongo/util/future_test_future_void.cpp22
-rw-r--r--src/mongo/util/future_test_shared_future.cpp5
-rw-r--r--src/mongo/util/future_test_utils.h5
-rw-r--r--src/mongo/util/hex.cpp2
-rw-r--r--src/mongo/util/hex.h2
-rw-r--r--src/mongo/util/if_constexpr.h4
-rw-r--r--src/mongo/util/intrusive_counter.cpp3
-rw-r--r--src/mongo/util/log.h58
-rw-r--r--src/mongo/util/log_and_backoff.cpp4
-rw-r--r--src/mongo/util/lru_cache_test.cpp5
-rw-r--r--src/mongo/util/map_util.h2
-rw-r--r--src/mongo/util/md5_test.cpp2
-rw-r--r--src/mongo/util/md5main.cpp4
-rw-r--r--src/mongo/util/net/cidr.cpp4
-rw-r--r--src/mongo/util/net/hostandport.cpp25
-rw-r--r--src/mongo/util/net/http_client_none.cpp2
-rw-r--r--src/mongo/util/net/http_client_winhttp.cpp6
-rw-r--r--src/mongo/util/net/private/socket_poll.cpp2
-rw-r--r--src/mongo/util/net/private/socket_poll.h2
-rw-r--r--src/mongo/util/net/sock.cpp6
-rw-r--r--src/mongo/util/net/ssl/context_schannel.hpp44
-rw-r--r--src/mongo/util/net/ssl/detail/impl/engine_apple.ipp8
-rw-r--r--src/mongo/util/net/ssl/detail/io.hpp2
-rw-r--r--src/mongo/util/net/ssl_manager.cpp23
-rw-r--r--src/mongo/util/net/ssl_manager.h6
-rw-r--r--src/mongo/util/net/ssl_manager_apple.cpp11
-rw-r--r--src/mongo/util/net/ssl_manager_openssl.cpp30
-rw-r--r--src/mongo/util/net/ssl_manager_test.cpp14
-rw-r--r--src/mongo/util/net/ssl_manager_windows.cpp74
-rw-r--r--src/mongo/util/net/ssl_options.cpp13
-rw-r--r--src/mongo/util/net/ssl_options.h24
-rw-r--r--src/mongo/util/net/ssl_parameters.cpp9
-rw-r--r--src/mongo/util/net/ssl_parameters_auth.cpp16
-rw-r--r--src/mongo/util/net/ssl_stream.cpp6
-rw-r--r--src/mongo/util/ntservice.cpp2
-rw-r--r--src/mongo/util/options_parser/constraints.h7
-rw-r--r--src/mongo/util/options_parser/environment_test.cpp9
-rw-r--r--src/mongo/util/options_parser/option_section.cpp6
-rw-r--r--src/mongo/util/options_parser/options_parser.cpp27
-rw-r--r--src/mongo/util/options_parser/options_parser_test.cpp3
-rw-r--r--src/mongo/util/perfctr_collect.cpp4
-rw-r--r--src/mongo/util/perfctr_collect_test.cpp20
-rw-r--r--src/mongo/util/periodic_runner.h2
-rw-r--r--src/mongo/util/periodic_runner_factory.cpp2
-rw-r--r--src/mongo/util/periodic_runner_impl.cpp4
-rw-r--r--src/mongo/util/polymorphic_scoped.h4
-rw-r--r--src/mongo/util/processinfo.h2
-rw-r--r--src/mongo/util/processinfo_linux.cpp38
-rw-r--r--src/mongo/util/processinfo_openbsd.cpp2
-rw-r--r--src/mongo/util/processinfo_osx.cpp2
-rw-r--r--src/mongo/util/processinfo_solaris.cpp2
-rw-r--r--src/mongo/util/processinfo_test.cpp4
-rw-r--r--src/mongo/util/processinfo_unknown.cpp2
-rw-r--r--src/mongo/util/processinfo_windows.cpp2
-rw-r--r--src/mongo/util/procparser.cpp17
-rw-r--r--src/mongo/util/procparser.h12
-rw-r--r--src/mongo/util/procparser_test.cpp14
-rw-r--r--src/mongo/util/producer_consumer_queue.h9
-rw-r--r--src/mongo/util/producer_consumer_queue_test.cpp4
-rw-r--r--src/mongo/util/progress_meter.cpp2
-rw-r--r--src/mongo/util/progress_meter.h2
-rw-r--r--src/mongo/util/queue.h2
-rw-r--r--src/mongo/util/regex_util.cpp10
-rw-r--r--src/mongo/util/regex_util.h4
-rw-r--r--src/mongo/util/safe_num.h2
-rw-r--r--src/mongo/util/safe_num_test.cpp2
-rw-r--r--src/mongo/util/scopeguard.h2
-rw-r--r--src/mongo/util/shared_buffer.h2
-rw-r--r--src/mongo/util/signal_handlers.cpp2
-rw-r--r--src/mongo/util/signal_win32.cpp2
-rw-r--r--src/mongo/util/signal_win32.h2
-rw-r--r--src/mongo/util/stack_introspect.h2
-rw-r--r--src/mongo/util/stacktrace_posix.cpp4
-rw-r--r--src/mongo/util/stacktrace_unwind.cpp4
-rw-r--r--src/mongo/util/stacktrace_windows.cpp2
-rw-r--r--src/mongo/util/string_map_test.cpp7
-rw-r--r--src/mongo/util/summation_test.cpp60
-rw-r--r--src/mongo/util/tcmalloc_set_parameter.cpp12
-rw-r--r--src/mongo/util/text.cpp8
-rw-r--r--src/mongo/util/tick_source_test.cpp2
-rw-r--r--src/mongo/util/unique_function_test.cpp2
-rw-r--r--src/mongo/util/unowned_ptr_test.cpp2
118 files changed, 502 insertions, 545 deletions
diff --git a/src/mongo/util/alarm.h b/src/mongo/util/alarm.h
index aa46c01f924..449284a3b21 100644
--- a/src/mongo/util/alarm.h
+++ b/src/mongo/util/alarm.h
@@ -192,4 +192,4 @@ private:
AlarmMap _alarms;
};
-} // namespace
+} // namespace mongo
diff --git a/src/mongo/util/alarm_test.cpp b/src/mongo/util/alarm_test.cpp
index 1fc29b1b5f9..f450284fc2a 100644
--- a/src/mongo/util/alarm_test.cpp
+++ b/src/mongo/util/alarm_test.cpp
@@ -112,12 +112,12 @@ TEST(AlarmRunner, BasicTest) {
AtomicWord<bool> future2Filled{false};
auto pf = makePromiseFuture<void>();
- std::move(alarm2.future).getAsync([&future2Filled,
- promise = std::move(pf.promise) ](Status status) mutable {
- ASSERT_OK(status);
- future2Filled.store(true);
- promise.emplaceValue();
- });
+ std::move(alarm2.future)
+ .getAsync([&future2Filled, promise = std::move(pf.promise)](Status status) mutable {
+ ASSERT_OK(status);
+ future2Filled.store(true);
+ promise.emplaceValue();
+ });
clockSource->advance(Milliseconds(11));
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index dcf2b580d42..cb9188590b7 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -241,12 +241,11 @@ Status exceptionToStatus() noexcept {
} catch (const std::exception& ex) {
return Status(ErrorCodes::UnknownError,
str::stream() << "Caught std::exception of type " << demangleName(typeid(ex))
- << ": "
- << ex.what());
+ << ": " << ex.what());
} catch (const boost::exception& ex) {
- return Status(
- ErrorCodes::UnknownError,
- str::stream() << "Caught boost::exception of type " << demangleName(typeid(ex)) << ": "
+ return Status(ErrorCodes::UnknownError,
+ str::stream()
+ << "Caught boost::exception of type " << demangleName(typeid(ex)) << ": "
<< boost::diagnostic_information(ex));
} catch (...) {
@@ -254,4 +253,4 @@ Status exceptionToStatus() noexcept {
std::terminate();
}
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/assert_util_test.cpp b/src/mongo/util/assert_util_test.cpp
index 25dcb159ba0..05b33ea3e4b 100644
--- a/src/mongo/util/assert_util_test.cpp
+++ b/src/mongo/util/assert_util_test.cpp
@@ -311,8 +311,8 @@ DEATH_TEST(InvariantTerminationTest,
DEATH_TEST(InvariantTerminationTest,
invariantWithStdStringMsg,
"Terminating with std::string invariant message: 12345") {
- const std::string msg = str::stream() << "Terminating with std::string invariant message: "
- << 12345;
+ const std::string msg = str::stream()
+ << "Terminating with std::string invariant message: " << 12345;
invariant(false, msg);
}
@@ -326,8 +326,8 @@ DEATH_TEST(InvariantTerminationTest,
DEATH_TEST(InvariantTerminationTest,
invariantOverloadWithStdStringMsg,
"Terminating with std::string invariant message: 12345") {
- const std::string msg = str::stream() << "Terminating with std::string invariant message: "
- << 12345;
+ const std::string msg = str::stream()
+ << "Terminating with std::string invariant message: " << 12345;
invariant(Status(ErrorCodes::InternalError, "Terminating with invariant"), msg);
}
@@ -341,8 +341,8 @@ DEATH_TEST(InvariantTerminationTest,
DEATH_TEST(InvariantTerminationTest,
invariantStatusWithOverloadWithStdStringMsg,
"Terminating with std::string invariant message: 12345") {
- const std::string msg = str::stream() << "Terminating with std::string invariant message: "
- << 12345;
+ const std::string msg = str::stream()
+ << "Terminating with std::string invariant message: " << 12345;
invariant(StatusWith<std::string>(ErrorCodes::InternalError, "Terminating with invariant"),
msg);
}
@@ -367,8 +367,8 @@ DEATH_TEST(DassertTerminationTest,
DEATH_TEST(DassertTerminationTest,
dassertWithStdStringMsg,
"Terminating with std::string dassert message: 12345") {
- const std::string msg = str::stream() << "Terminating with std::string dassert message: "
- << 12345;
+ const std::string msg = str::stream()
+ << "Terminating with std::string dassert message: " << 12345;
dassert(false, msg);
}
#endif // defined(MONGO_CONFIG_DEBUG_BUILD)
diff --git a/src/mongo/util/boost_assert_impl.cpp b/src/mongo/util/boost_assert_impl.cpp
index a541f7993da..f77ed7f2b0e 100644
--- a/src/mongo/util/boost_assert_impl.cpp
+++ b/src/mongo/util/boost_assert_impl.cpp
@@ -40,8 +40,11 @@ struct BoostAssertImpl {
invariantFailed(expr, file, line);
};
- BoostAssertFuncs::global().assertMsgFunc = [](
- char const* expr, char const* msg, char const* function, char const* file, long line) {
+ BoostAssertFuncs::global().assertMsgFunc = [](char const* expr,
+ char const* msg,
+ char const* function,
+ char const* file,
+ long line) {
invariantFailedWithMsg(expr, msg, file, line);
};
}
diff --git a/src/mongo/util/bson_util.h b/src/mongo/util/bson_util.h
index f4f3440318d..ab6c8459889 100644
--- a/src/mongo/util/bson_util.h
+++ b/src/mongo/util/bson_util.h
@@ -45,4 +45,4 @@ void bsonArrToNumVector(BSONElement el, std::vector<T>& results) {
results.push_back((T)el.Number());
}
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/bufreader.h b/src/mongo/util/bufreader.h
index 90e270e7f90..8c30070bada 100644
--- a/src/mongo/util/bufreader.h
+++ b/src/mongo/util/bufreader.h
@@ -136,4 +136,4 @@ private:
const char* _pos;
const char* _end;
};
-}
+} // namespace mongo
diff --git a/src/mongo/util/checksum.h b/src/mongo/util/checksum.h
index c1e8aa73628..8d612c03e21 100644
--- a/src/mongo/util/checksum.h
+++ b/src/mongo/util/checksum.h
@@ -67,4 +67,4 @@ struct Checksum {
return words[0] != rhs.words[0] || words[1] != rhs.words[1];
}
};
-}
+} // namespace mongo
diff --git a/src/mongo/util/clock_source_mock_test.cpp b/src/mongo/util/clock_source_mock_test.cpp
index 3861dbae4c5..f8dbdc343df 100644
--- a/src/mongo/util/clock_source_mock_test.cpp
+++ b/src/mongo/util/clock_source_mock_test.cpp
@@ -129,11 +129,10 @@ TEST(ClockSourceMockTest, AlarmScheudlesExpiredAlarmWhenSignaled) {
ClockSourceMock cs;
const auto beginning = cs.now();
int alarmFiredCount = 0;
- ASSERT_OK(cs.setAlarm(beginning + Seconds{1},
- [&] {
- ++alarmFiredCount;
- ASSERT_OK(cs.setAlarm(beginning, [&] { ++alarmFiredCount; }));
- }));
+ ASSERT_OK(cs.setAlarm(beginning + Seconds{1}, [&] {
+ ++alarmFiredCount;
+ ASSERT_OK(cs.setAlarm(beginning, [&] { ++alarmFiredCount; }));
+ }));
ASSERT_EQ(0, alarmFiredCount);
cs.advance(Seconds{1});
ASSERT_EQ(2, alarmFiredCount);
@@ -154,17 +153,15 @@ TEST(ClockSourceMockTest, AlarmScheudlesAlarmWhenSignaled) {
ClockSourceMock cs;
const auto beginning = cs.now();
int alarmFiredCount = 0;
- ASSERT_OK(cs.setAlarm(beginning + Seconds{1},
- [&] {
- ++alarmFiredCount;
- ASSERT_OK(
- cs.setAlarm(beginning + Seconds{2}, [&] { ++alarmFiredCount; }));
- }));
+ ASSERT_OK(cs.setAlarm(beginning + Seconds{1}, [&] {
+ ++alarmFiredCount;
+ ASSERT_OK(cs.setAlarm(beginning + Seconds{2}, [&] { ++alarmFiredCount; }));
+ }));
ASSERT_EQ(0, alarmFiredCount);
cs.advance(Seconds{1});
ASSERT_EQ(1, alarmFiredCount);
cs.advance(Seconds{1});
ASSERT_EQ(2, alarmFiredCount);
}
-}
+} // namespace
} // namespace mongo
diff --git a/src/mongo/util/cmdline_utils/censor_cmdline.cpp b/src/mongo/util/cmdline_utils/censor_cmdline.cpp
index 746daf24b2d..526414b21e9 100644
--- a/src/mongo/util/cmdline_utils/censor_cmdline.cpp
+++ b/src/mongo/util/cmdline_utils/censor_cmdline.cpp
@@ -233,4 +233,4 @@ void censorArgvArray(int argc, char** argv) {
}
}
} // namespace cmdline_utils
-}
+} // namespace mongo
diff --git a/src/mongo/util/cmdline_utils/censor_cmdline.h b/src/mongo/util/cmdline_utils/censor_cmdline.h
index df9ef9d1729..806b5d1ef60 100644
--- a/src/mongo/util/cmdline_utils/censor_cmdline.h
+++ b/src/mongo/util/cmdline_utils/censor_cmdline.h
@@ -46,4 +46,4 @@ void censorArgsVector(std::vector<std::string>* args);
void censorBSONObj(BSONObj* params);
} // namespace cmdline_utils
-}
+} // namespace mongo
diff --git a/src/mongo/util/concurrency/idle_thread_block.cpp b/src/mongo/util/concurrency/idle_thread_block.cpp
index 2886a24edd7..64426a47774 100644
--- a/src/mongo/util/concurrency/idle_thread_block.cpp
+++ b/src/mongo/util/concurrency/idle_thread_block.cpp
@@ -36,7 +36,7 @@ namespace mongo {
namespace for_debuggers {
// This needs external linkage to ensure that debuggers can use it.
thread_local const char* idleThreadLocation = nullptr;
-}
+} // namespace for_debuggers
using for_debuggers::idleThreadLocation;
void IdleThreadBlock::beginIdleThreadBlock(const char* location) {
@@ -48,4 +48,4 @@ void IdleThreadBlock::endIdleThreadBlock() {
invariant(idleThreadLocation);
idleThreadLocation = nullptr;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/concurrency/mutex.h b/src/mongo/util/concurrency/mutex.h
index 30ee48f8a30..f252fe14cd8 100644
--- a/src/mongo/util/concurrency/mutex.h
+++ b/src/mongo/util/concurrency/mutex.h
@@ -44,7 +44,7 @@ namespace mongo {
* timeout). Thus it can be implemented using OS-specific
* facilities in all environments (if desired). On Windows,
* the implementation below is faster than boost mutex.
-*/
+ */
#if defined(_WIN32)
class SimpleMutex {
diff --git a/src/mongo/util/concurrency/thread_name.cpp b/src/mongo/util/concurrency/thread_name.cpp
index 7aa58a3b6f4..03a6ab181c4 100644
--- a/src/mongo/util/concurrency/thread_name.cpp
+++ b/src/mongo/util/concurrency/thread_name.cpp
@@ -145,8 +145,8 @@ void setThreadName(StringData name) {
// limit, it's best to shorten long names.
int error = 0;
if (threadName.size() > 15) {
- std::string shortName = str::stream() << threadName.substr(0, 7) << '.'
- << threadName.substr(threadName.size() - 7);
+ std::string shortName = str::stream()
+ << threadName.substr(0, 7) << '.' << threadName.substr(threadName.size() - 7);
error = pthread_setname_np(pthread_self(), shortName.c_str());
} else {
error = pthread_setname_np(pthread_self(), threadName.rawData());
diff --git a/src/mongo/util/concurrency/thread_pool.cpp b/src/mongo/util/concurrency/thread_pool.cpp
index 69e4e0f64b3..fd8d23377ea 100644
--- a/src/mongo/util/concurrency/thread_pool.cpp
+++ b/src/mongo/util/concurrency/thread_pool.cpp
@@ -173,8 +173,8 @@ void ThreadPool::_drainPendingTasks() {
// Tasks cannot be run inline because they can create OperationContexts and the join() caller
// may already have one associated with the thread.
stdx::thread cleanThread = stdx::thread([&] {
- const std::string threadName = str::stream() << _options.threadNamePrefix
- << _nextThreadId++;
+ const std::string threadName = str::stream()
+ << _options.threadNamePrefix << _nextThreadId++;
setThreadName(threadName);
_options.onCreateThread(threadName);
stdx::unique_lock<stdx::mutex> lock(_mutex);
diff --git a/src/mongo/util/concurrency/ticketholder.cpp b/src/mongo/util/concurrency/ticketholder.cpp
index d836f977b67..e30746807ae 100644
--- a/src/mongo/util/concurrency/ticketholder.cpp
+++ b/src/mongo/util/concurrency/ticketholder.cpp
@@ -137,8 +137,7 @@ Status TicketHolder::resize(int newSize) {
if (newSize > SEM_VALUE_MAX)
return Status(ErrorCodes::BadValue,
str::stream() << "Maximum value for semaphore is " << SEM_VALUE_MAX
- << "; given "
- << newSize);
+ << "; given " << newSize);
while (_outof.load() < newSize) {
release();
@@ -254,4 +253,4 @@ bool TicketHolder::_tryAcquire() {
return true;
}
#endif
-}
+} // namespace mongo
diff --git a/src/mongo/util/concurrency/value.h b/src/mongo/util/concurrency/value.h
index b2759be742a..a0a03d9d260 100644
--- a/src/mongo/util/concurrency/value.h
+++ b/src/mongo/util/concurrency/value.h
@@ -79,4 +79,4 @@ public:
// multiple operations
bool operator==(const std::string& s) const;
};
-}
+} // namespace mongo
diff --git a/src/mongo/util/debugger.cpp b/src/mongo/util/debugger.cpp
index 16a319e87f3..53cbeedbe09 100644
--- a/src/mongo/util/debugger.cpp
+++ b/src/mongo/util/debugger.cpp
@@ -122,4 +122,4 @@ void setupSIGTRAPforGDB() {
#else
void setupSIGTRAPforGDB() {}
#endif
-}
+} // namespace mongo
diff --git a/src/mongo/util/decimal_counter.h b/src/mongo/util/decimal_counter.h
index a85d23f3dd9..b090989792f 100644
--- a/src/mongo/util/decimal_counter.h
+++ b/src/mongo/util/decimal_counter.h
@@ -101,4 +101,4 @@ private:
uint8_t _lastDigitIndex = 0; // Indicates the last digit in _digits.
T _counter = 0;
};
-}
+} // namespace mongo
diff --git a/src/mongo/util/diagnostic_info.cpp b/src/mongo/util/diagnostic_info.cpp
index 1a19f29ac8d..fbf84aff8cf 100644
--- a/src/mongo/util/diagnostic_info.cpp
+++ b/src/mongo/util/diagnostic_info.cpp
@@ -121,7 +121,7 @@ public:
DiagnosticInfo::StackFrame getFrame(void* instructionPtr) const {
auto it = --_map.upper_bound(instructionPtr);
- auto & [ objectPtr, frame ] = *it;
+ auto& [objectPtr, frame] = *it;
ptrdiff_t instructionOffset =
static_cast<char*>(instructionPtr) - static_cast<char*>(objectPtr);
return DiagnosticInfo::StackFrame{
diff --git a/src/mongo/util/diagnostic_info.h b/src/mongo/util/diagnostic_info.h
index 160ec11e40c..ebfb50885aa 100644
--- a/src/mongo/util/diagnostic_info.h
+++ b/src/mongo/util/diagnostic_info.h
@@ -94,4 +94,4 @@ private:
* Captures the diagnostic information based on the caller's context.
*/
DiagnosticInfo takeDiagnosticInfo(const StringData& captureName);
-} // namespace monogo
+} // namespace mongo
diff --git a/src/mongo/util/diagnostic_info_test.cpp b/src/mongo/util/diagnostic_info_test.cpp
index c12155b98d2..9c9b9524a38 100644
--- a/src/mongo/util/diagnostic_info_test.cpp
+++ b/src/mongo/util/diagnostic_info_test.cpp
@@ -59,4 +59,4 @@ TEST(DiagnosticInfo, BasicSingleThread) {
clockSourcePointer->advance(Seconds(1));
ASSERT_LT(capture2.getTimestamp(), clockSourcePointer->now());
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/dns_name.h b/src/mongo/util/dns_name.h
index 023bee10516..8b913cadd21 100644
--- a/src/mongo/util/dns_name.h
+++ b/src/mongo/util/dns_name.h
@@ -402,7 +402,7 @@ private:
void streamCore(StreamLike& os) const {
std::for_each(rbegin(_nameComponents),
rend(_nameComponents),
- [ first = true, &os ](const auto& component) mutable {
+ [first = true, &os](const auto& component) mutable {
if (!first)
os << '.';
first = false;
@@ -439,7 +439,7 @@ private:
// FQDNs and Relative Names are discriminated by this field.
Qualification fullyQualified;
};
-} // detail_dns_host_name
+} // namespace detail_dns_host_name
// The `operator==` function has to be defined out-of-line, because it uses `make_equality_lens`
// which is an auto-deduced return type function defined later in the class body.
diff --git a/src/mongo/util/dns_query_test.cpp b/src/mongo/util/dns_query_test.cpp
index b7dac331a12..8c6330b1557 100644
--- a/src/mongo/util/dns_query_test.cpp
+++ b/src/mongo/util/dns_query_test.cpp
@@ -110,11 +110,13 @@ TEST(MongoDnsQuery, srvRecords) {
} tests[] = {
{"test1.test.build.10gen.cc.",
{
- {"localhost.test.build.10gen.cc.", 27017}, {"localhost.test.build.10gen.cc.", 27018},
+ {"localhost.test.build.10gen.cc.", 27017},
+ {"localhost.test.build.10gen.cc.", 27018},
}},
{"test2.test.build.10gen.cc.",
{
- {"localhost.test.build.10gen.cc.", 27018}, {"localhost.test.build.10gen.cc.", 27019},
+ {"localhost.test.build.10gen.cc.", 27018},
+ {"localhost.test.build.10gen.cc.", 27019},
}},
{"test3.test.build.10gen.cc.",
{
@@ -174,7 +176,8 @@ TEST(MongoDnsQuery, txtRecords) {
}},
{"test6.test.build.10gen.cc",
{
- "authSource=otherDB", "replicaSet=repl0",
+ "authSource=otherDB",
+ "replicaSet=repl0",
}},
};
diff --git a/src/mongo/util/exception_filter_win32.cpp b/src/mongo/util/exception_filter_win32.cpp
index 5f404d2bf8a..b3a6ebec0b6 100644
--- a/src/mongo/util/exception_filter_win32.cpp
+++ b/src/mongo/util/exception_filter_win32.cpp
@@ -178,7 +178,7 @@ LONG WINAPI exceptionFilter(struct _EXCEPTION_POINTERS* excPointers) {
// We won't reach here
return EXCEPTION_EXECUTE_HANDLER;
}
-}
+} // namespace
LPTOP_LEVEL_EXCEPTION_FILTER filtLast = 0;
@@ -192,6 +192,6 @@ void setWindowsUnhandledExceptionFilter() {
namespace mongo {
void setWindowsUnhandledExceptionFilter() {}
-}
+} // namespace mongo
#endif // _WIN32
diff --git a/src/mongo/util/exit.cpp b/src/mongo/util/exit.cpp
index b08545f8c2d..b92b59253ea 100644
--- a/src/mongo/util/exit.cpp
+++ b/src/mongo/util/exit.cpp
@@ -114,8 +114,9 @@ void shutdown(ExitCode code, const ShutdownTaskArgs& shutdownArgs) {
ExitCode originallyRequestedCode = shutdownExitCode.get();
if (code != originallyRequestedCode) {
log() << "While running shutdown tasks with the intent to exit with code "
- << originallyRequestedCode << ", an additional shutdown request arrived with "
- "the intent to exit with a different exit code "
+ << originallyRequestedCode
+ << ", an additional shutdown request arrived with "
+ "the intent to exit with a different exit code "
<< code << "; ignoring the conflicting exit code";
}
diff --git a/src/mongo/util/fail_point.cpp b/src/mongo/util/fail_point.cpp
index 9582a0e4939..d5af18f318f 100644
--- a/src/mongo/util/fail_point.cpp
+++ b/src/mongo/util/fail_point.cpp
@@ -267,4 +267,4 @@ BSONObj FailPoint::toBSON() const {
return builder.obj();
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/fail_point_test.cpp b/src/mongo/util/fail_point_test.cpp
index 2a759a5216a..0a32ec45777 100644
--- a/src/mongo/util/fail_point_test.cpp
+++ b/src/mongo/util/fail_point_test.cpp
@@ -43,10 +43,10 @@
#include "mongo/util/log.h"
#include "mongo/util/time_support.h"
-using mongo::getGlobalFailPointRegistry;
using mongo::BSONObj;
using mongo::FailPoint;
using mongo::FailPointEnableBlock;
+using mongo::getGlobalFailPointRegistry;
namespace stdx = mongo::stdx;
namespace mongo_test {
@@ -398,8 +398,7 @@ TEST(FailPoint, parseBSONInvalidDataFails) {
TEST(FailPoint, parseBSONValidDataSucceeds) {
auto swTuple = FailPoint::parseBSON(BSON("mode"
<< "alwaysOn"
- << "data"
- << BSON("a" << 1)));
+ << "data" << BSON("a" << 1)));
ASSERT_TRUE(swTuple.isOK());
}
@@ -448,4 +447,4 @@ TEST(FailPoint, FailPointBlockIfBasicTest) {
ASSERT(!"shouldn't get here");
}
}
-}
+} // namespace mongo_test
diff --git a/src/mongo/util/file.cpp b/src/mongo/util/file.cpp
index 9096a11b23e..b3c85b4c34e 100644
--- a/src/mongo/util/file.cpp
+++ b/src/mongo/util/file.cpp
@@ -139,12 +139,8 @@ void File::read(fileofs o, char* data, unsigned len) {
_bad = true;
msgasserted(10438,
str::stream() << "In File::read(), ReadFile for '" << _name << "' read "
- << bytesRead
- << " bytes while trying to read "
- << len
- << " bytes starting at offset "
- << o
- << ", truncated file?");
+ << bytesRead << " bytes while trying to read " << len
+ << " bytes starting at offset " << o << ", truncated file?");
}
}
@@ -242,8 +238,7 @@ void File::open(const char* filename, bool readOnly, bool direct) {
_fd = ::open(filename,
(readOnly ? O_RDONLY : (O_CREAT | O_RDWR | O_NOATIME))
#if defined(O_DIRECT)
- |
- (direct ? O_DIRECT : 0)
+ | (direct ? O_DIRECT : 0)
#endif
,
S_IRUSR | S_IWUSR);
@@ -264,12 +259,8 @@ void File::read(fileofs o, char* data, unsigned len) {
_bad = true;
msgasserted(16569,
str::stream() << "In File::read(), ::pread for '" << _name << "' read "
- << bytesRead
- << " bytes while trying to read "
- << len
- << " bytes starting at offset "
- << o
- << ", truncated file?");
+ << bytesRead << " bytes while trying to read " << len
+ << " bytes starting at offset " << o << ", truncated file?");
}
}
@@ -297,4 +288,4 @@ void File::write(fileofs o, const char* data, unsigned len) {
}
#endif // _WIN32
-}
+} // namespace mongo
diff --git a/src/mongo/util/file.h b/src/mongo/util/file.h
index 6676ee21bd4..10511465142 100644
--- a/src/mongo/util/file.h
+++ b/src/mongo/util/file.h
@@ -69,4 +69,4 @@ private:
#endif
std::string _name;
};
-}
+} // namespace mongo
diff --git a/src/mongo/util/future.h b/src/mongo/util/future.h
index f46f3c541e1..5bef6ff3209 100644
--- a/src/mongo/util/future.h
+++ b/src/mongo/util/future.h
@@ -1131,7 +1131,7 @@ NOINLINE_DECL auto ExecutorFuture<T>::wrapCBHelper(unique_function<Sig>&& func)
exec = _exec // can't move this!
](auto&&... args) mutable noexcept
->Future<UnwrappedType<decltype(func(std::forward<decltype(args)>(args)...))>> {
- auto[promise, future] = makePromiseFuture<
+ auto [promise, future] = makePromiseFuture<
UnwrappedType<decltype(func(std::forward<decltype(args)>(args)...))>>();
exec->schedule([
diff --git a/src/mongo/util/future_impl.h b/src/mongo/util/future_impl.h
index fe810446392..5650cf9fb90 100644
--- a/src/mongo/util/future_impl.h
+++ b/src/mongo/util/future_impl.h
@@ -1069,8 +1069,7 @@ public:
// TODO in C++17 with constexpr if this can be done cleaner and more efficiently by not
// throwing.
- return std::move(*this).onError([func =
- std::forward<Func>(func)](Status && status) mutable {
+ return std::move(*this).onError([func = std::forward<Func>(func)](Status&& status) mutable {
if (status != code)
uassertStatusOK(status);
return throwingCall(func, std::move(status));
@@ -1087,8 +1086,7 @@ public:
if (_immediate || (isReady() && _shared->status.isOK()))
return std::move(*this);
- return std::move(*this).onError([func =
- std::forward<Func>(func)](Status && status) mutable {
+ return std::move(*this).onError([func = std::forward<Func>(func)](Status&& status) mutable {
if (!ErrorCodes::isA<category>(status))
uassertStatusOK(status);
return throwingCall(func, std::move(status));
@@ -1110,9 +1108,8 @@ public:
static_assert(std::is_void<decltype(call(func, std::declval<const Status&>()))>::value,
"func passed to tapError must return void");
- return tapImpl(std::forward<Func>(func),
- [](Func && func, const T& val) noexcept {},
- [](Func && func, const Status& status) noexcept { call(func, status); });
+ return tapImpl(std::forward<Func>(func), [](Func && func, const T& val) noexcept {}, [
+ ](Func && func, const Status& status) noexcept { call(func, status); });
}
template <typename Func>
diff --git a/src/mongo/util/future_test_edge_cases.cpp b/src/mongo/util/future_test_edge_cases.cpp
index 53b4a837e9e..b81a049f94f 100644
--- a/src/mongo/util/future_test_edge_cases.cpp
+++ b/src/mongo/util/future_test_edge_cases.cpp
@@ -323,7 +323,7 @@ TEST(Future_EdgeCases, Racing_SharedPromise_getFuture_and_setError) {
TEST(Future_EdgeCases, SharedPromise_CompleteWithUnreadyFuture) {
SharedSemiFuture<void> sf;
- auto[promise, future] = makePromiseFuture<void>();
+ auto [promise, future] = makePromiseFuture<void>();
{
SharedPromise<void> sp;
diff --git a/src/mongo/util/future_test_executor_future.cpp b/src/mongo/util/future_test_executor_future.cpp
index 564d0e69cda..1c6dc09224c 100644
--- a/src/mongo/util/future_test_executor_future.cpp
+++ b/src/mongo/util/future_test_executor_future.cpp
@@ -37,36 +37,34 @@
namespace mongo {
namespace {
TEST(Executor_Future, Success_getAsync) {
- FUTURE_SUCCESS_TEST(
- [] {},
- [](/*Future<void>*/ auto&& fut) {
- auto exec = InlineCountingExecutor::make();
- auto pf = makePromiseFuture<void>();
- ExecutorFuture<void>(exec).thenRunOn(exec).getAsync([outside = std::move(pf.promise)](
- Status status) mutable {
- ASSERT_OK(status);
- outside.emplaceValue();
- });
- ASSERT_EQ(std::move(pf.future).getNoThrow(), Status::OK());
- ASSERT_EQ(exec->tasksRun.load(), 1);
- });
+ FUTURE_SUCCESS_TEST([] {},
+ [](/*Future<void>*/ auto&& fut) {
+ auto exec = InlineCountingExecutor::make();
+ auto pf = makePromiseFuture<void>();
+ ExecutorFuture<void>(exec).thenRunOn(exec).getAsync(
+ [outside = std::move(pf.promise)](Status status) mutable {
+ ASSERT_OK(status);
+ outside.emplaceValue();
+ });
+ ASSERT_EQ(std::move(pf.future).getNoThrow(), Status::OK());
+ ASSERT_EQ(exec->tasksRun.load(), 1);
+ });
}
TEST(Executor_Future, Reject_getAsync) {
- FUTURE_SUCCESS_TEST(
- [] {},
- [](/*Future<void>*/ auto&& fut) {
- auto exec = RejectingExecutor::make();
- auto pf = makePromiseFuture<void>();
- std::move(fut).thenRunOn(exec).getAsync([promise = std::move(pf.promise)](
- Status status) mutable {
- promise.emplaceValue(); // shouldn't be run anyway.
- FAIL("how did I run!?!?!");
- });
-
- // Promise is destroyed without calling the callback.
- ASSERT_EQ(std::move(pf.future).getNoThrow(), ErrorCodes::BrokenPromise);
- });
+ FUTURE_SUCCESS_TEST([] {},
+ [](/*Future<void>*/ auto&& fut) {
+ auto exec = RejectingExecutor::make();
+ auto pf = makePromiseFuture<void>();
+ std::move(fut).thenRunOn(exec).getAsync(
+ [promise = std::move(pf.promise)](Status status) mutable {
+ promise.emplaceValue(); // shouldn't be run anyway.
+ FAIL("how did I run!?!?!");
+ });
+
+ // Promise is destroyed without calling the callback.
+ ASSERT_EQ(std::move(pf.future).getNoThrow(), ErrorCodes::BrokenPromise);
+ });
}
TEST(Executor_Future, Success_then) {
diff --git a/src/mongo/util/future_test_future_int.cpp b/src/mongo/util/future_test_future_int.cpp
index 60691aca811..96023b210d3 100644
--- a/src/mongo/util/future_test_future_int.cpp
+++ b/src/mongo/util/future_test_future_int.cpp
@@ -77,16 +77,16 @@ TEST(Future, Success_semi_get) {
}
TEST(Future, Success_getAsync) {
- FUTURE_SUCCESS_TEST(
- [] { return 1; },
- [](/*Future<int>*/ auto&& fut) {
- auto pf = makePromiseFuture<int>();
- std::move(fut).getAsync([outside = std::move(pf.promise)](StatusWith<int> sw) mutable {
- ASSERT_OK(sw);
- outside.emplaceValue(sw.getValue());
- });
- ASSERT_EQ(std::move(pf.future).get(), 1);
- });
+ FUTURE_SUCCESS_TEST([] { return 1; },
+ [](/*Future<int>*/ auto&& fut) {
+ auto pf = makePromiseFuture<int>();
+ std::move(fut).getAsync(
+ [outside = std::move(pf.promise)](StatusWith<int> sw) mutable {
+ ASSERT_OK(sw);
+ outside.emplaceValue(sw.getValue());
+ });
+ ASSERT_EQ(std::move(pf.future).get(), 1);
+ });
}
TEST(Future, Fail_getLvalue) {
@@ -144,7 +144,6 @@ TEST(Future, Success_isReady) {
ASSERT_EQ(stdx::this_thread::get_id(), id);
ASSERT_EQ(status, 1);
});
-
});
}
@@ -157,7 +156,6 @@ TEST(Future, Fail_isReady) {
ASSERT_EQ(stdx::this_thread::get_id(), id);
ASSERT_NOT_OK(status);
});
-
});
}
diff --git a/src/mongo/util/future_test_future_move_only.cpp b/src/mongo/util/future_test_future_move_only.cpp
index 5c03813679b..7fd124b61c5 100644
--- a/src/mongo/util/future_test_future_move_only.cpp
+++ b/src/mongo/util/future_test_future_move_only.cpp
@@ -130,11 +130,11 @@ TEST(Future_MoveOnly, Success_getAsync) {
FUTURE_SUCCESS_TEST([] { return Widget(1); },
[](/*Future<Widget>*/ auto&& fut) {
auto pf = makePromiseFuture<Widget>();
- std::move(fut).getAsync([outside = std::move(pf.promise)](
- StatusWith<Widget> sw) mutable {
- ASSERT_OK(sw);
- outside.emplaceValue(std::move(sw.getValue()));
- });
+ std::move(fut).getAsync(
+ [outside = std::move(pf.promise)](StatusWith<Widget> sw) mutable {
+ ASSERT_OK(sw);
+ outside.emplaceValue(std::move(sw.getValue()));
+ });
ASSERT_EQ(std::move(pf.future).get(), 1);
});
}
diff --git a/src/mongo/util/future_test_future_void.cpp b/src/mongo/util/future_test_future_void.cpp
index 5281d1a15d3..c9e9f5dfa51 100644
--- a/src/mongo/util/future_test_future_void.cpp
+++ b/src/mongo/util/future_test_future_void.cpp
@@ -73,16 +73,16 @@ TEST(Future_Void, Success_semi_get) {
}
TEST(Future_Void, Success_getAsync) {
- FUTURE_SUCCESS_TEST(
- [] {},
- [](/*Future<void>*/ auto&& fut) {
- auto pf = makePromiseFuture<void>();
- std::move(fut).getAsync([outside = std::move(pf.promise)](Status status) mutable {
- ASSERT_OK(status);
- outside.emplaceValue();
- });
- ASSERT_EQ(std::move(pf.future).getNoThrow(), Status::OK());
- });
+ FUTURE_SUCCESS_TEST([] {},
+ [](/*Future<void>*/ auto&& fut) {
+ auto pf = makePromiseFuture<void>();
+ std::move(fut).getAsync(
+ [outside = std::move(pf.promise)](Status status) mutable {
+ ASSERT_OK(status);
+ outside.emplaceValue();
+ });
+ ASSERT_EQ(std::move(pf.future).getNoThrow(), Status::OK());
+ });
}
TEST(Future_Void, Fail_getLvalue) {
@@ -141,7 +141,6 @@ TEST(Future_Void, Success_isReady) {
ASSERT_EQ(stdx::this_thread::get_id(), id);
ASSERT_OK(status);
});
-
});
}
@@ -154,7 +153,6 @@ TEST(Future_Void, Fail_isReady) {
ASSERT_EQ(stdx::this_thread::get_id(), id);
ASSERT_NOT_OK(status);
});
-
});
}
diff --git a/src/mongo/util/future_test_shared_future.cpp b/src/mongo/util/future_test_shared_future.cpp
index 12914422412..5afb3f6d112 100644
--- a/src/mongo/util/future_test_shared_future.cpp
+++ b/src/mongo/util/future_test_shared_future.cpp
@@ -67,7 +67,8 @@ TEST(SharedFuture, isReady_shared_TSAN_OK) {
auto fut = async([&] {
done = true;
return 1;
- }).share();
+ })
+ .share();
//(void)*const_cast<volatile bool*>(&done); // Data Race! Uncomment to make sure TSAN works.
while (!fut.isReady()) {
}
@@ -183,7 +184,7 @@ TEST(SharedFuture, NoStackOverflow_Destruction) {
// Add 100 children that each use 100K of stack space on destruction.
for (int i = 0; i < 100; i++) {
collector.push_back(
- shared.thenRunOn(exec).then([x = Evil()]{}).semi());
+ shared.thenRunOn(exec).then([x = Evil()] {}).semi());
}
for (auto&& collected : collector) {
diff --git a/src/mongo/util/future_test_utils.h b/src/mongo/util/future_test_utils.h
index 77451f837ff..d4189f28efc 100644
--- a/src/mongo/util/future_test_utils.h
+++ b/src/mongo/util/future_test_utils.h
@@ -131,14 +131,15 @@ template <typename Func, typename Result = std::result_of_t<Func && ()>>
Future<Result> async(Func&& func) {
auto pf = makePromiseFuture<Result>();
- stdx::thread([ promise = std::move(pf.promise), func = std::forward<Func>(func) ]() mutable {
+ stdx::thread([promise = std::move(pf.promise), func = std::forward<Func>(func)]() mutable {
sleepIfShould();
try {
completePromise(&promise, func);
} catch (const DBException& ex) {
promise.setError(ex.toStatus());
}
- }).detach();
+ })
+ .detach();
return std::move(pf.future);
}
diff --git a/src/mongo/util/hex.cpp b/src/mongo/util/hex.cpp
index 1bbf362ada9..41255966894 100644
--- a/src/mongo/util/hex.cpp
+++ b/src/mongo/util/hex.cpp
@@ -107,4 +107,4 @@ std::string hexdump(const char* data, unsigned len) {
std::string s = ss.str();
return s;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/hex.h b/src/mongo/util/hex.h
index d58364fe54f..b01cb9b9336 100644
--- a/src/mongo/util/hex.h
+++ b/src/mongo/util/hex.h
@@ -129,4 +129,4 @@ std::string unsignedIntToFixedLengthHex(uint32_t val);
/* @return a dump of the buffer as hex byte ascii output */
std::string hexdump(const char* data, unsigned len);
-}
+} // namespace mongo
diff --git a/src/mongo/util/if_constexpr.h b/src/mongo/util/if_constexpr.h
index bf1dbdf8867..28900a243a1 100644
--- a/src/mongo/util/if_constexpr.h
+++ b/src/mongo/util/if_constexpr.h
@@ -31,6 +31,4 @@
// Terrible hack to work around clang-format being out of date.
// TODO sed this away and delete this file when we upgrade clang-format.
-#define IF_CONSTEXPR \
- if \
- constexpr
+#define IF_CONSTEXPR if constexpr
diff --git a/src/mongo/util/intrusive_counter.cpp b/src/mongo/util/intrusive_counter.cpp
index 59b177a1fc3..e33cbc87da5 100644
--- a/src/mongo/util/intrusive_counter.cpp
+++ b/src/mongo/util/intrusive_counter.cpp
@@ -39,8 +39,7 @@ using boost::intrusive_ptr;
intrusive_ptr<const RCString> RCString::create(StringData s) {
uassert(16493,
str::stream() << "Tried to create string longer than "
- << (BSONObjMaxUserSize / 1024 / 1024)
- << "MB",
+ << (BSONObjMaxUserSize / 1024 / 1024) << "MB",
s.size() < static_cast<size_t>(BSONObjMaxUserSize));
const size_t sizeWithNUL = s.size() + 1;
diff --git a/src/mongo/util/log.h b/src/mongo/util/log.h
index 68a16c34493..62441644344 100644
--- a/src/mongo/util/log.h
+++ b/src/mongo/util/log.h
@@ -174,15 +174,15 @@ inline bool shouldLog(logger::LogSeverity severity) {
} // namespace
// MONGO_LOG uses log component from MongoLogDefaultComponent from current or global namespace.
-#define MONGO_LOG(DLEVEL) \
- if (!(::mongo::logger::globalLogDomain()) \
- ->shouldLog(MongoLogDefaultComponent_component, \
- ::mongo::LogstreamBuilder::severityCast(DLEVEL))) { \
- } else \
- ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
- ::mongo::getThreadName(), \
- ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
- MongoLogDefaultComponent_component)
+#define MONGO_LOG(DLEVEL) \
+ if (!(::mongo::logger::globalLogDomain()) \
+ ->shouldLog(MongoLogDefaultComponent_component, \
+ ::mongo::LogstreamBuilder::severityCast(DLEVEL))) { \
+ } else \
+ ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
+ ::mongo::getThreadName(), \
+ ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
+ MongoLogDefaultComponent_component)
#define LOG MONGO_LOG
@@ -190,32 +190,32 @@ inline bool shouldLog(logger::LogSeverity severity) {
if (!(::mongo::logger::globalLogDomain()) \
->shouldLog((COMPONENT1), ::mongo::LogstreamBuilder::severityCast(DLEVEL))) { \
} else \
- ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
- ::mongo::getThreadName(), \
- ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
- (COMPONENT1))
+ ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
+ ::mongo::getThreadName(), \
+ ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
+ (COMPONENT1))
#define MONGO_LOG_COMPONENT2(DLEVEL, COMPONENT1, COMPONENT2) \
if (!(::mongo::logger::globalLogDomain()) \
->shouldLog( \
(COMPONENT1), (COMPONENT2), ::mongo::LogstreamBuilder::severityCast(DLEVEL))) { \
} else \
- ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
- ::mongo::getThreadName(), \
- ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
- (COMPONENT1))
-
-#define MONGO_LOG_COMPONENT3(DLEVEL, COMPONENT1, COMPONENT2, COMPONENT3) \
- if (!(::mongo::logger::globalLogDomain()) \
- ->shouldLog((COMPONENT1), \
- (COMPONENT2), \
- (COMPONENT3), \
- ::mongo::LogstreamBuilder::severityCast(DLEVEL))) { \
- } else \
- ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
- ::mongo::getThreadName(), \
- ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
- (COMPONENT1))
+ ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
+ ::mongo::getThreadName(), \
+ ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
+ (COMPONENT1))
+
+#define MONGO_LOG_COMPONENT3(DLEVEL, COMPONENT1, COMPONENT2, COMPONENT3) \
+ if (!(::mongo::logger::globalLogDomain()) \
+ ->shouldLog((COMPONENT1), \
+ (COMPONENT2), \
+ (COMPONENT3), \
+ ::mongo::LogstreamBuilder::severityCast(DLEVEL))) { \
+ } else \
+ ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), \
+ ::mongo::getThreadName(), \
+ ::mongo::LogstreamBuilder::severityCast(DLEVEL), \
+ (COMPONENT1))
/**
* Rotates the log files. Returns true if all logs rotate successfully.
diff --git a/src/mongo/util/log_and_backoff.cpp b/src/mongo/util/log_and_backoff.cpp
index e890f86a9ca..3438b4b23b7 100644
--- a/src/mongo/util/log_and_backoff.cpp
+++ b/src/mongo/util/log_and_backoff.cpp
@@ -40,8 +40,8 @@ void logAndBackoff(logger::LogComponent logComponent,
logger::LogSeverity logLevel,
size_t numAttempts,
StringData message) {
- MONGO_LOG_COMPONENT(logLevel, logComponent) << message
- << ". Retrying, attempt: " << numAttempts;
+ MONGO_LOG_COMPONENT(logLevel, logComponent)
+ << message << ". Retrying, attempt: " << numAttempts;
if (numAttempts < 4) {
// no-op
diff --git a/src/mongo/util/lru_cache_test.cpp b/src/mongo/util/lru_cache_test.cpp
index a8772bc5a93..b88e4297e46 100644
--- a/src/mongo/util/lru_cache_test.cpp
+++ b/src/mongo/util/lru_cache_test.cpp
@@ -277,7 +277,6 @@ TEST(LRUCacheTest, SizeOneCache) {
// Test cache eviction when the cache is full and new elements are added.
TEST(LRUCacheTest, EvictionTest) {
runWithDifferentSizes([](int maxSize) {
-
// Test eviction for any permutation of the original cache
for (int i = 0; i < maxSize; i++) {
LRUCache<int, int> cache(maxSize);
@@ -309,7 +308,6 @@ TEST(LRUCacheTest, EvictionTest) {
// from any original position in the cache.
TEST(LRUCacheTest, PromoteTest) {
runWithDifferentSizes([](int maxSize) {
-
// Test promotion for any position in the original cache
// i <= maxSize here, so we test promotion of cache.end(),
// and of a non-existent key.
@@ -354,7 +352,6 @@ TEST(LRUCacheTest, PromoteTest) {
// the existing entry and gets promoted properly
TEST(LRUCacheTest, ReplaceKeyTest) {
runWithDifferentSizes([](int maxSize) {
-
// Test replacement for any position in the original cache
for (int i = 0; i < maxSize; i++) {
LRUCache<int, int> cache(maxSize);
@@ -378,7 +375,6 @@ TEST(LRUCacheTest, ReplaceKeyTest) {
// the existing entry and gets promoted properly
TEST(LRUCacheTest, EraseByKey) {
runWithDifferentSizes([](int maxSize) {
-
// Test replacement for any position in the original cache
// i <= maxSize so we erase a non-existent element
for (int i = 0; i <= maxSize; i++) {
@@ -416,7 +412,6 @@ TEST(LRUCacheTest, EraseByKey) {
// Test removal of elements by iterator from the cache
TEST(LRUCacheTest, EraseByIterator) {
runWithDifferentSizes([](int maxSize) {
-
// Test replacement for any position in the original cache
for (int i = 0; i < maxSize; i++) {
LRUCache<int, int> cache(maxSize);
diff --git a/src/mongo/util/map_util.h b/src/mongo/util/map_util.h
index b576eb573af..5825cfe79b8 100644
--- a/src/mongo/util/map_util.h
+++ b/src/mongo/util/map_util.h
@@ -42,4 +42,4 @@ V mapFindWithDefault(const M& myMap, const K& key, const V& defaultValue = V())
return it->second;
}
-} // end namespace
+} // namespace mongo
diff --git a/src/mongo/util/md5_test.cpp b/src/mongo/util/md5_test.cpp
index 996cf6ae931..79d598eb040 100644
--- a/src/mongo/util/md5_test.cpp
+++ b/src/mongo/util/md5_test.cpp
@@ -35,4 +35,4 @@ namespace mongo {
TEST(MD5, BuiltIn1) {
ASSERT_EQUALS(0, do_md5_test());
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/md5main.cpp b/src/mongo/util/md5main.cpp
index 51291c69686..27047713d55 100644
--- a/src/mongo/util/md5main.cpp
+++ b/src/mongo/util/md5main.cpp
@@ -64,8 +64,8 @@ static const char* const version = "2002-04-13";
/* modified: not static, renamed */
/* Run the self-test. */
/*static*/ int
- // do_test(void)
- do_md5_test(void) {
+// do_test(void)
+do_md5_test(void) {
static const char* const test[7 * 2] = {
"",
"d41d8cd98f00b204e9800998ecf8427e",
diff --git a/src/mongo/util/net/cidr.cpp b/src/mongo/util/net/cidr.cpp
index 8e3f5899c42..20cc7e6069c 100644
--- a/src/mongo/util/net/cidr.cpp
+++ b/src/mongo/util/net/cidr.cpp
@@ -40,8 +40,8 @@
#endif
using std::begin;
-using std::find;
using std::end;
+using std::find;
namespace mongo {
@@ -139,7 +139,7 @@ BSONObjBuilder& BSONObjBuilderValueStream::operator<<<CIDR>(CIDR value) {
return *_builder;
}
-} // namespace
+} // namespace mongo
std::ostream& mongo::operator<<(std::ostream& s, const CIDR& cidr) {
return append(s, cidr._family, cidr._ip, cidr._len);
diff --git a/src/mongo/util/net/hostandport.cpp b/src/mongo/util/net/hostandport.cpp
index ed74befa3a7..eb22852a926 100644
--- a/src/mongo/util/net/hostandport.cpp
+++ b/src/mongo/util/net/hostandport.cpp
@@ -80,7 +80,7 @@ int HostAndPort::port() const {
bool HostAndPort::isLocalHost() const {
return (_host == "localhost" || str::startsWith(_host.c_str(), "127.") || _host == "::1" ||
_host == "anonymous unix socket" || _host.c_str()[0] == '/' // unix socket
- );
+ );
}
bool HostAndPort::isDefaultRoute() const {
@@ -135,8 +135,8 @@ Status HostAndPort::initialize(StringData s) {
if (openBracketPos != std::string::npos) {
if (openBracketPos != 0) {
return Status(ErrorCodes::FailedToParse,
- str::stream() << "'[' present, but not first character in "
- << s.toString());
+ str::stream()
+ << "'[' present, but not first character in " << s.toString());
}
if (closeBracketPos == std::string::npos) {
return Status(ErrorCodes::FailedToParse,
@@ -150,31 +150,29 @@ Status HostAndPort::initialize(StringData s) {
// If the last colon is inside the brackets, then there must not be a port.
if (s.size() != closeBracketPos + 1) {
return Status(ErrorCodes::FailedToParse,
- str::stream() << "missing colon after ']' before the port in "
- << s.toString());
+ str::stream()
+ << "missing colon after ']' before the port in " << s.toString());
}
colonPos = std::string::npos;
} else if (colonPos != closeBracketPos + 1) {
return Status(ErrorCodes::FailedToParse,
str::stream() << "Extraneous characters between ']' and pre-port ':'"
- << " in "
- << s.toString());
+ << " in " << s.toString());
}
} else if (closeBracketPos != std::string::npos) {
return Status(ErrorCodes::FailedToParse,
str::stream() << "']' present without '[' in " << s.toString());
} else if (s.find(':') != colonPos) {
return Status(ErrorCodes::FailedToParse,
- str::stream() << "More than one ':' detected. If this is an ipv6 address,"
- << " it needs to be surrounded by '[' and ']'; "
- << s.toString());
+ str::stream()
+ << "More than one ':' detected. If this is an ipv6 address,"
+ << " it needs to be surrounded by '[' and ']'; " << s.toString());
}
if (hostPart.empty()) {
return Status(ErrorCodes::FailedToParse,
str::stream() << "Empty host component parsing HostAndPort from \""
- << str::escape(s.toString())
- << "\"");
+ << str::escape(s.toString()) << "\"");
}
int port;
@@ -188,8 +186,7 @@ Status HostAndPort::initialize(StringData s) {
return Status(ErrorCodes::FailedToParse,
str::stream() << "Port number " << port
<< " out of range parsing HostAndPort from \""
- << str::escape(s.toString())
- << "\"");
+ << str::escape(s.toString()) << "\"");
}
} else {
port = -1;
diff --git a/src/mongo/util/net/http_client_none.cpp b/src/mongo/util/net/http_client_none.cpp
index 3e0789c116d..6a3d11e6b1a 100644
--- a/src/mongo/util/net/http_client_none.cpp
+++ b/src/mongo/util/net/http_client_none.cpp
@@ -27,8 +27,8 @@
* it in the license file.
*/
-#include "mongo/util/net/http_client.h"
#include "mongo/base/status.h"
+#include "mongo/util/net/http_client.h"
namespace mongo {
diff --git a/src/mongo/util/net/http_client_winhttp.cpp b/src/mongo/util/net/http_client_winhttp.cpp
index 4ddab8046aa..f774e7387e4 100644
--- a/src/mongo/util/net/http_client_winhttp.cpp
+++ b/src/mongo/util/net/http_client_winhttp.cpp
@@ -60,7 +60,8 @@ namespace mongo {
namespace {
const LPCWSTR kAcceptTypes[] = {
- L"application/octet-stream", nullptr,
+ L"application/octet-stream",
+ nullptr,
};
struct ProcessedUrl {
@@ -253,8 +254,7 @@ private:
const auto msg = errnoWithDescription(err);
uasserted(ErrorCodes::OperationFailed,
str::stream() << "Failed receiving response from server"
- << ": "
- << msg);
+ << ": " << msg);
}
DWORD statusCode = 0;
diff --git a/src/mongo/util/net/private/socket_poll.cpp b/src/mongo/util/net/private/socket_poll.cpp
index 7726aa3c077..b032d8ac732 100644
--- a/src/mongo/util/net/private/socket_poll.cpp
+++ b/src/mongo/util/net/private/socket_poll.cpp
@@ -70,4 +70,4 @@ int socketPoll(pollfd* fdarray, unsigned long nfds, int timeout) {
}
#endif
-}
+} // namespace mongo
diff --git a/src/mongo/util/net/private/socket_poll.h b/src/mongo/util/net/private/socket_poll.h
index 705633f624b..8b0c116b66e 100644
--- a/src/mongo/util/net/private/socket_poll.h
+++ b/src/mongo/util/net/private/socket_poll.h
@@ -36,4 +36,4 @@
namespace mongo {
bool isPollSupported();
int socketPoll(pollfd* fdarray, unsigned long nfds, int timeout);
-}
+} // namespace mongo
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index bb616b4452e..b0d04d1a8c2 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -120,8 +120,8 @@ void setSockTimeouts(int sock, double secs) {
log() << "unable to set SO_RCVTIMEO: " << errnoWithDescription(WSAGetLastError());
status =
setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, reinterpret_cast<char*>(&timeout), sizeof(DWORD));
- DEV if (report && (status == SOCKET_ERROR)) log() << "unable to set SO_SNDTIMEO: "
- << errnoWithDescription(WSAGetLastError());
+ DEV if (report && (status == SOCKET_ERROR)) log()
+ << "unable to set SO_SNDTIMEO: " << errnoWithDescription(WSAGetLastError());
#else
struct timeval tv;
tv.tv_sec = (int)secs;
@@ -547,7 +547,7 @@ void Socket::handleSendError(int ret, const char* context) {
<< ' ' << remoteString();
throwSocketError(SocketErrorKind::SEND_ERROR, remoteString());
}
-}
+} // namespace mongo
void Socket::handleRecvError(int ret, int len) {
if (ret == 0) {
diff --git a/src/mongo/util/net/ssl/context_schannel.hpp b/src/mongo/util/net/ssl/context_schannel.hpp
index baabea394f6..fff06f9b188 100644
--- a/src/mongo/util/net/ssl/context_schannel.hpp
+++ b/src/mongo/util/net/ssl/context_schannel.hpp
@@ -53,28 +53,28 @@ public:
#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
/// Move-construct a context from another.
/**
- * This constructor moves an SSL context from one object to another.
- *
- * @param other The other context object from which the move will occur.
- *
- * @note Following the move, the following operations only are valid for the
- * moved-from object:
- * @li Destruction.
- * @li As a target for move-assignment.
- */
+ * This constructor moves an SSL context from one object to another.
+ *
+ * @param other The other context object from which the move will occur.
+ *
+ * @note Following the move, the following operations only are valid for the
+ * moved-from object:
+ * @li Destruction.
+ * @li As a target for move-assignment.
+ */
ASIO_DECL context(context&& other);
/// Move-assign a context from another.
/**
- * This assignment operator moves an SSL context from one object to another.
- *
- * @param other The other context object from which the move will occur.
- *
- * @note Following the move, the following operations only are valid for the
- * moved-from object:
- * @li Destruction.
- * @li As a target for move-assignment.
- */
+ * This assignment operator moves an SSL context from one object to another.
+ *
+ * @param other The other context object from which the move will occur.
+ *
+ * @note Following the move, the following operations only are valid for the
+ * moved-from object:
+ * @li Destruction.
+ * @li As a target for move-assignment.
+ */
ASIO_DECL context& operator=(context&& other);
#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
@@ -83,10 +83,10 @@ public:
/// Get the underlying implementation in the native type.
/**
- * This function may be used to obtain the underlying implementation of the
- * context. This is intended to allow access to context functionality that is
- * not otherwise provided.
- */
+ * This function may be used to obtain the underlying implementation of the
+ * context. This is intended to allow access to context functionality that is
+ * not otherwise provided.
+ */
ASIO_DECL native_handle_type native_handle();
private:
diff --git a/src/mongo/util/net/ssl/detail/impl/engine_apple.ipp b/src/mongo/util/net/ssl/detail/impl/engine_apple.ipp
index a78460e8d97..154f08707aa 100644
--- a/src/mongo/util/net/ssl/detail/impl/engine_apple.ipp
+++ b/src/mongo/util/net/ssl/detail/impl/engine_apple.ipp
@@ -63,16 +63,16 @@ public:
const auto status = static_cast<::OSStatus>(value);
apple::CFUniquePtr<::CFStringRef> errstr(::SecCopyErrorMessageString(status, nullptr));
if (!errstr) {
- return mongo::str::stream() << "Secure.Transport unknown error: "
- << static_cast<int>(status);
+ return mongo::str::stream()
+ << "Secure.Transport unknown error: " << static_cast<int>(status);
}
const auto len = ::CFStringGetMaximumSizeForEncoding(::CFStringGetLength(errstr.get()),
::kCFStringEncodingUTF8);
std::string ret;
ret.resize(len + 1);
if (!::CFStringGetCString(errstr.get(), &ret[0], len, ::kCFStringEncodingUTF8)) {
- return mongo::str::stream() << "Secure.Transport unknown error: "
- << static_cast<int>(status);
+ return mongo::str::stream()
+ << "Secure.Transport unknown error: " << static_cast<int>(status);
}
ret.resize(strlen(ret.c_str()));
diff --git a/src/mongo/util/net/ssl/detail/io.hpp b/src/mongo/util/net/ssl/detail/io.hpp
index 8a702abc9dd..d6e376b00f0 100644
--- a/src/mongo/util/net/ssl/detail/io.hpp
+++ b/src/mongo/util/net/ssl/detail/io.hpp
@@ -247,7 +247,7 @@ public:
// Release any waiting write operations.
core_.pending_write_.expires_at(core_.neg_infin());
- // Fall through to call handler.
+ // Fall through to call handler.
default:
diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp
index 441fcb3e763..fae6729ce75 100644
--- a/src/mongo/util/net/ssl_manager.cpp
+++ b/src/mongo/util/net/ssl_manager.cpp
@@ -171,9 +171,7 @@ std::string RFC4514Parser::extractAttributeName() {
} else {
uasserted(ErrorCodes::BadValue,
str::stream() << "DN attribute names must begin with either a digit or an alpha"
- << " not \'"
- << ch
- << "\'");
+ << " not \'" << ch << "\'");
}
for (; ch != '=' && !done(); ch = _advance()) {
@@ -218,8 +216,7 @@ std::pair<std::string, RFC4514Parser::ValueTerminator> RFC4514Parser::extractVal
uassert(ErrorCodes::BadValue,
str::stream() << "Escaped hex value contains invalid character \'"
- << hexValStr[1]
- << "\'",
+ << hexValStr[1] << "\'",
isHex(hexValStr[1]));
const char hexVal = uassertStatusOK(fromHex(StringData(hexValStr.data(), 2)));
sb << hexVal;
@@ -247,8 +244,8 @@ std::pair<std::string, RFC4514Parser::ValueTerminator> RFC4514Parser::extractVal
}
} else if (isEscaped(ch)) {
uasserted(ErrorCodes::BadValue,
- str::stream() << "Found unescaped character that should be escaped: \'" << ch
- << "\'");
+ str::stream()
+ << "Found unescaped character that should be escaped: \'" << ch << "\'");
} else {
if (ch != ' ') {
trailingSpaces = 0;
@@ -832,9 +829,9 @@ StatusWith<std::string> readDERString(ConstDataRangeCursor& cdc) {
if (derString.getType() != DERType::UTF8String) {
return Status(ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "Unexpected DER Tag, Got "
- << static_cast<char>(derString.getType())
- << ", Expected UTF8String");
+ str::stream()
+ << "Unexpected DER Tag, Got " << static_cast<char>(derString.getType())
+ << ", Expected UTF8String");
}
return derString.readUtf8String();
@@ -970,9 +967,9 @@ StatusWith<stdx::unordered_set<RoleName>> parsePeerRoles(ConstDataRange cdrExten
if (swSet.getValue().getType() != DERType::SET) {
return Status(ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "Unexpected DER Tag, Got "
- << static_cast<char>(swSet.getValue().getType())
- << ", Expected SET");
+ str::stream()
+ << "Unexpected DER Tag, Got "
+ << static_cast<char>(swSet.getValue().getType()) << ", Expected SET");
}
ConstDataRangeCursor cdcSet(swSet.getValue().getSetRange());
diff --git a/src/mongo/util/net/ssl_manager.h b/src/mongo/util/net/ssl_manager.h
index 859f671d24b..ce7b7d9bfc7 100644
--- a/src/mongo/util/net/ssl_manager.h
+++ b/src/mongo/util/net/ssl_manager.h
@@ -69,7 +69,7 @@ Status validateOpensslCipherConfig(const std::string&);
* Validation callback for setParameter 'disableNonTLSConnectionLogging'.
*/
Status validateDisableNonTLSConnectionLogging(const bool&);
-}
+} // namespace mongo
#ifdef MONGO_CONFIG_SSL
namespace mongo {
@@ -220,8 +220,8 @@ public:
virtual const SSLConfiguration& getSSLConfiguration() const = 0;
/**
- * Fetches the error text for an error code, in a thread-safe manner.
- */
+ * Fetches the error text for an error code, in a thread-safe manner.
+ */
static std::string getSSLErrorMessage(int code);
/**
diff --git a/src/mongo/util/net/ssl_manager_apple.cpp b/src/mongo/util/net/ssl_manager_apple.cpp
index c6b828125e8..205837d1035 100644
--- a/src/mongo/util/net/ssl_manager_apple.cpp
+++ b/src/mongo/util/net/ssl_manager_apple.cpp
@@ -725,8 +725,7 @@ StatusWith<CFUniquePtr<::CFArrayRef>> loadPEM(const std::string& keyfilepath,
return Status(ErrorCodes::InvalidSSLConfiguration,
str::stream() << "Unable to load PEM from '" << keyfilepath << "'"
<< (passphrase.empty() ? "" : " with passphrase")
- << (msg.empty() ? "" : ": ")
- << msg);
+ << (msg.empty() ? "" : ": ") << msg);
};
std::ifstream pemFile(keyfilepath, std::ios::binary);
@@ -746,7 +745,9 @@ StatusWith<CFUniquePtr<::CFArrayRef>> loadPEM(const std::string& keyfilepath,
nullptr, reinterpret_cast<const uint8_t*>(passphrase.c_str()), passphrase.size()));
}
::SecItemImportExportKeyParameters params = {
- SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION, 0, cfpass.get(),
+ SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION,
+ 0,
+ cfpass.get(),
};
CFUniquePtr<CFStringRef> cfkeyfile(
@@ -771,8 +772,8 @@ StatusWith<CFUniquePtr<::CFArrayRef>> loadPEM(const std::string& keyfilepath,
"key. Consider using a certificate selector or PKCS#12 instead");
}
if (status != ::errSecSuccess) {
- return retFail(str::stream() << "Failing importing certificate(s): "
- << stringFromOSStatus(status));
+ return retFail(str::stream()
+ << "Failing importing certificate(s): " << stringFromOSStatus(status));
}
if (mode == kLoadPEMBindIdentities) {
diff --git a/src/mongo/util/net/ssl_manager_openssl.cpp b/src/mongo/util/net/ssl_manager_openssl.cpp
index 563c6a570ad..787b5d1d274 100644
--- a/src/mongo/util/net/ssl_manager_openssl.cpp
+++ b/src/mongo/util/net/ssl_manager_openssl.cpp
@@ -925,8 +925,9 @@ Status SSLManagerOpenSSL::initSSLContext(SSL_CTX* context,
}
// We use the address of the context as the session id context.
- if (0 == ::SSL_CTX_set_session_id_context(
- context, reinterpret_cast<unsigned char*>(&context), sizeof(context))) {
+ if (0 ==
+ ::SSL_CTX_set_session_id_context(
+ context, reinterpret_cast<unsigned char*>(&context), sizeof(context))) {
return Status(ErrorCodes::InvalidSSLConfiguration,
str::stream() << "Can not store ssl session id context: "
<< getSSLErrorMessage(ERR_get_error()));
@@ -1312,14 +1313,11 @@ Status SSLManagerOpenSSL::_setupSystemCA(SSL_CTX* context) {
// On non-Windows/non-Apple platforms, the OpenSSL libraries should have been configured
// with default locations for CA certificates.
if (SSL_CTX_set_default_verify_paths(context) != 1) {
- return {ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "error loading system CA certificates "
- << "(default certificate file: "
- << X509_get_default_cert_file()
- << ", "
- << "default certificate path: "
- << X509_get_default_cert_dir()
- << ")"};
+ return {
+ ErrorCodes::InvalidSSLConfiguration,
+ str::stream() << "error loading system CA certificates "
+ << "(default certificate file: " << X509_get_default_cert_file() << ", "
+ << "default certificate path: " << X509_get_default_cert_dir() << ")"};
}
#else
@@ -1363,17 +1361,17 @@ bool SSLManagerOpenSSL::_setupCRL(SSL_CTX* context, const std::string& crlFile)
}
/*
-* The interface layer between network and BIO-pair. The BIO-pair buffers
-* the data to/from the TLS layer.
-*/
+ * The interface layer between network and BIO-pair. The BIO-pair buffers
+ * the data to/from the TLS layer.
+ */
void SSLManagerOpenSSL::_flushNetworkBIO(SSLConnectionOpenSSL* conn) {
char buffer[BUFFER_SIZE];
int wantWrite;
/*
- * Write the complete contents of the buffer. Leaving the buffer
- * unflushed could cause a deadlock.
- */
+ * Write the complete contents of the buffer. Leaving the buffer
+ * unflushed could cause a deadlock.
+ */
while ((wantWrite = BIO_ctrl_pending(conn->networkBIO)) > 0) {
if (wantWrite > BUFFER_SIZE) {
wantWrite = BUFFER_SIZE;
diff --git a/src/mongo/util/net/ssl_manager_test.cpp b/src/mongo/util/net/ssl_manager_test.cpp
index acf4d04e438..a7335970125 100644
--- a/src/mongo/util/net/ssl_manager_test.cpp
+++ b/src/mongo/util/net/ssl_manager_test.cpp
@@ -187,7 +187,10 @@ TEST(SSLManager, MongoDBRolesParser) {
// Negative: Runt, only a tag and long length with wrong missing length
{
unsigned char derData[] = {
- 0x31, 0x88, 0xff, 0xff,
+ 0x31,
+ 0x88,
+ 0xff,
+ 0xff,
};
auto swPeer = parsePeerRoles(ConstDataRange(derData));
ASSERT_NOT_OK(swPeer.getStatus());
@@ -196,7 +199,10 @@ TEST(SSLManager, MongoDBRolesParser) {
// Negative: Runt, only a tag and long length
{
unsigned char derData[] = {
- 0x31, 0x82, 0xff, 0xff,
+ 0x31,
+ 0x82,
+ 0xff,
+ 0xff,
};
auto swPeer = parsePeerRoles(ConstDataRange(derData));
ASSERT_NOT_OK(swPeer.getStatus());
@@ -362,9 +368,7 @@ TEST(SSLManager, DNParsingAndNormalization) {
}
TEST(SSLManager, BadDNParsing) {
- std::vector<std::string> tests = {"CN=#12345",
- R"(CN=\B)",
- R"(CN=<", "\)"};
+ std::vector<std::string> tests = {"CN=#12345", R"(CN=\B)", R"(CN=<", "\)"};
for (const auto& test : tests) {
log() << "Testing bad DN: \"" << test << "\"";
auto swDN = parseDN(test);
diff --git a/src/mongo/util/net/ssl_manager_windows.cpp b/src/mongo/util/net/ssl_manager_windows.cpp
index 514d39094f6..d73f2f7d8f4 100644
--- a/src/mongo/util/net/ssl_manager_windows.cpp
+++ b/src/mongo/util/net/ssl_manager_windows.cpp
@@ -70,8 +70,8 @@ extern SSLManagerInterface* theSSLManager;
namespace {
/**
-* Free a Certificate Context.
-*/
+ * Free a Certificate Context.
+ */
struct CERTFree {
void operator()(const CERT_CONTEXT* p) noexcept {
if (p) {
@@ -83,8 +83,8 @@ struct CERTFree {
using UniqueCertificate = std::unique_ptr<const CERT_CONTEXT, CERTFree>;
/**
-* Free a CRL Handle
-*/
+ * Free a CRL Handle
+ */
struct CryptCRLFree {
void operator()(const CRL_CONTEXT* p) noexcept {
if (p) {
@@ -97,8 +97,8 @@ using UniqueCRL = std::unique_ptr<const CRL_CONTEXT, CryptCRLFree>;
/**
-* Free a Certificate Chain Context
-*/
+ * Free a Certificate Chain Context
+ */
struct CryptCertChainFree {
void operator()(const CERT_CHAIN_CONTEXT* p) noexcept {
if (p) {
@@ -111,10 +111,10 @@ using UniqueCertChain = std::unique_ptr<const CERT_CHAIN_CONTEXT, CryptCertChain
/**
-* A simple generic class to manage Windows handle like things. Behaves similiar to std::unique_ptr.
-*
-* Only supports move.
-*/
+ * A simple generic class to manage Windows handle like things. Behaves similiar to std::unique_ptr.
+ *
+ * Only supports move.
+ */
template <typename HandleT, class Deleter>
class AutoHandle {
public:
@@ -157,8 +157,8 @@ private:
};
/**
-* Free a HCRYPTPROV Handle
-*/
+ * Free a HCRYPTPROV Handle
+ */
struct CryptProviderFree {
void operator()(HCRYPTPROV const h) noexcept {
if (h) {
@@ -170,8 +170,8 @@ struct CryptProviderFree {
using UniqueCryptProvider = AutoHandle<HCRYPTPROV, CryptProviderFree>;
/**
-* Free a HCRYPTKEY Handle
-*/
+ * Free a HCRYPTKEY Handle
+ */
struct CryptKeyFree {
void operator()(HCRYPTKEY const h) noexcept {
if (h) {
@@ -184,7 +184,7 @@ using UniqueCryptKey = AutoHandle<HCRYPTKEY, CryptKeyFree>;
/**
* Free a CERTSTORE Handle
-*/
+ */
struct CertStoreFree {
void operator()(HCERTSTORE const p) noexcept {
if (p) {
@@ -199,8 +199,8 @@ struct CertStoreFree {
using UniqueCertStore = AutoHandle<HCERTSTORE, CertStoreFree>;
/**
-* Free a HCERTCHAINENGINE Handle
-*/
+ * Free a HCERTCHAINENGINE Handle
+ */
struct CertChainEngineFree {
void operator()(HCERTCHAINENGINE const p) noexcept {
if (p) {
@@ -816,8 +816,8 @@ StatusWith<UniqueCertificateWithPrivateKey> readCertPEMFile(StringData fileName,
// Use the the log file if possible
if (!serverGlobalParams.logpath.empty()) {
static AtomicWord<int> counter{0};
- std::string keyContainerName = str::stream() << serverGlobalParams.logpath
- << counter.fetchAndAdd(1);
+ std::string keyContainerName = str::stream()
+ << serverGlobalParams.logpath << counter.fetchAndAdd(1);
wstr = toNativeString(keyContainerName.c_str());
} else {
auto us = UUID::gen().toString();
@@ -846,8 +846,8 @@ StatusWith<UniqueCertificateWithPrivateKey> readCertPEMFile(StringData fileName,
} else {
return Status(ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "CryptAcquireContextW failed "
- << errnoWithDescription(gle));
+ str::stream()
+ << "CryptAcquireContextW failed " << errnoWithDescription(gle));
}
}
} else {
@@ -857,8 +857,8 @@ StatusWith<UniqueCertificateWithPrivateKey> readCertPEMFile(StringData fileName,
if (!ret) {
DWORD gle = GetLastError();
return Status(ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "CryptAcquireContextW failed "
- << errnoWithDescription(gle));
+ str::stream()
+ << "CryptAcquireContextW failed " << errnoWithDescription(gle));
}
}
UniqueCryptProvider cryptProvider(hProv);
@@ -1013,8 +1013,8 @@ Status readCRLPEMFile(HCERTSTORE certStore, StringData fileName) {
if (!ret) {
DWORD gle = GetLastError();
return Status(ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "CertAddCRLContextToStore Failed "
- << errnoWithDescription(gle));
+ str::stream()
+ << "CertAddCRLContextToStore Failed " << errnoWithDescription(gle));
}
}
@@ -1061,8 +1061,7 @@ StatusWith<UniqueCertificate> loadCertificateSelectorFromStore(
DWORD gle = GetLastError();
return Status(ErrorCodes::InvalidSSLConfiguration,
str::stream() << "CertOpenStore failed to open store 'My' from '" << storeName
- << "': "
- << errnoWithDescription(gle));
+ << "': " << errnoWithDescription(gle));
}
UniqueCertStore storeHolder(store);
@@ -1082,11 +1081,8 @@ StatusWith<UniqueCertificate> loadCertificateSelectorFromStore(
ErrorCodes::InvalidSSLConfiguration,
str::stream()
<< "CertFindCertificateInStore failed to find cert with subject name '"
- << selector.subject.c_str()
- << "' in 'My' store in '"
- << storeName
- << "': "
- << errnoWithDescription(gle));
+ << selector.subject.c_str() << "' in 'My' store in '" << storeName
+ << "': " << errnoWithDescription(gle));
}
return UniqueCertificate(cert);
@@ -1106,10 +1102,8 @@ StatusWith<UniqueCertificate> loadCertificateSelectorFromStore(
str::stream()
<< "CertFindCertificateInStore failed to find cert with thumbprint '"
<< toHex(selector.thumbprint.data(), selector.thumbprint.size())
- << "' in 'My' store in '"
- << storeName
- << "': "
- << errnoWithDescription(gle));
+ << "' in 'My' store in '" << storeName
+ << "': " << errnoWithDescription(gle));
}
return UniqueCertificate(cert);
@@ -1636,8 +1630,8 @@ Status validatePeerCertificate(const std::string& remoteHost,
if (!ret) {
DWORD gle = GetLastError();
return Status(ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "CertGetCertificateChain failed: "
- << errnoWithDescription(gle));
+ str::stream()
+ << "CertGetCertificateChain failed: " << errnoWithDescription(gle));
}
UniqueCertChain certChainHolder(chainContext);
@@ -1761,8 +1755,8 @@ StatusWith<TLSVersion> mapTLSVersion(PCtxtHandle ssl) {
if (ss != SEC_E_OK) {
return Status(ErrorCodes::SSLHandshakeFailed,
- str::stream() << "QueryContextAttributes for connection info failed with"
- << ss);
+ str::stream()
+ << "QueryContextAttributes for connection info failed with" << ss);
}
switch (connInfo.dwProtocol) {
diff --git a/src/mongo/util/net/ssl_options.cpp b/src/mongo/util/net/ssl_options.cpp
index bc87567cafe..30389860a29 100644
--- a/src/mongo/util/net/ssl_options.cpp
+++ b/src/mongo/util/net/ssl_options.cpp
@@ -145,15 +145,14 @@ Status parseCertificateSelector(SSLParams::CertificateSelector* selector,
if (key != "thumbprint") {
return {ErrorCodes::BadValue,
str::stream() << "Unknown certificate selector property for '" << name << "': '"
- << key
- << "'"};
+ << key << "'"};
}
auto swHex = hexToVector(value.substr(delim + 1));
if (!swHex.isOK()) {
return {ErrorCodes::BadValue,
- str::stream() << "Invalid certificate selector value for '" << name << "': "
- << swHex.getStatus().reason()};
+ str::stream() << "Invalid certificate selector value for '" << name
+ << "': " << swHex.getStatus().reason()};
}
selector->thumbprint = std::move(swHex.getValue());
@@ -174,8 +173,7 @@ StatusWith<SSLParams::SSLModes> SSLParams::sslModeParse(StringData strMode) {
return Status(
ErrorCodes::BadValue,
str::stream()
- << "Invalid sslMode setting '"
- << strMode
+ << "Invalid sslMode setting '" << strMode
<< "', expected one of: 'disabled', 'allowSSL', 'preferSSL', or 'requireSSL'");
}
}
@@ -193,8 +191,7 @@ StatusWith<SSLParams::SSLModes> SSLParams::tlsModeParse(StringData strMode) {
return Status(
ErrorCodes::BadValue,
str::stream()
- << "Invalid tlsMode setting '"
- << strMode
+ << "Invalid tlsMode setting '" << strMode
<< "', expected one of: 'disabled', 'allowTLS', 'preferTLS', or 'requireTLS'");
}
}
diff --git a/src/mongo/util/net/ssl_options.h b/src/mongo/util/net/ssl_options.h
index 27402e8a923..cb820ba91e7 100644
--- a/src/mongo/util/net/ssl_options.h
+++ b/src/mongo/util/net/ssl_options.h
@@ -93,23 +93,23 @@ struct SSLParams {
enum SSLModes : int {
/**
- * Make unencrypted outgoing connections and do not accept incoming SSL-connections.
- */
+ * Make unencrypted outgoing connections and do not accept incoming SSL-connections.
+ */
SSLMode_disabled,
/**
- * Make unencrypted outgoing connections and accept both unencrypted and SSL-connections.
- */
+ * Make unencrypted outgoing connections and accept both unencrypted and SSL-connections.
+ */
SSLMode_allowSSL,
/**
- * Make outgoing SSL-connections and accept both unecrypted and SSL-connections.
- */
+ * Make outgoing SSL-connections and accept both unecrypted and SSL-connections.
+ */
SSLMode_preferSSL,
/**
- * Make outgoing SSL-connections and only accept incoming SSL-connections.
- */
+ * Make outgoing SSL-connections and only accept incoming SSL-connections.
+ */
SSLMode_requireSSL
};
@@ -137,10 +137,10 @@ Status storeSSLDisabledProtocols(
SSLDisabledProtocolsMode mode = SSLDisabledProtocolsMode::kStandardFormat);
/**
-* The global SSL configuration. This should be accessed only after global initialization has
-* completed. If it must be accessed in an initializer, the initializer should have
-* "EndStartupOptionStorage" as a prerequisite.
-*/
+ * The global SSL configuration. This should be accessed only after global initialization has
+ * completed. If it must be accessed in an initializer, the initializer should have
+ * "EndStartupOptionStorage" as a prerequisite.
+ */
const SSLParams& getSSLGlobalParams();
Status parseCertificateSelector(SSLParams::CertificateSelector* selector,
diff --git a/src/mongo/util/net/ssl_parameters.cpp b/src/mongo/util/net/ssl_parameters.cpp
index 0ace15fb3a2..fd1f8d23c58 100644
--- a/src/mongo/util/net/ssl_parameters.cpp
+++ b/src/mongo/util/net/ssl_parameters.cpp
@@ -70,9 +70,9 @@ StatusWith<ServerGlobalParams::ClusterAuthModes> clusterAuthModeParse(StringData
} else if (strMode == "x509") {
return ServerGlobalParams::ClusterAuthMode_x509;
} else {
- return Status(
- ErrorCodes::BadValue,
- str::stream() << "Invalid clusterAuthMode '" << strMode
+ return Status(ErrorCodes::BadValue,
+ str::stream()
+ << "Invalid clusterAuthMode '" << strMode
<< "', expected one of: 'keyFile', 'sendKeyFile', 'sendX509', or 'x509'");
}
}
@@ -97,8 +97,7 @@ StatusWith<SSLParams::SSLModes> checkTLSModeTransition(T modeToString,
return {ErrorCodes::BadValue,
str::stream() << "Illegal state transition for " << parameterName
<< ", attempt to change from "
- << modeToString(static_cast<SSLParams::SSLModes>(oldMode))
- << " to "
+ << modeToString(static_cast<SSLParams::SSLModes>(oldMode)) << " to "
<< strMode};
}
}
diff --git a/src/mongo/util/net/ssl_parameters_auth.cpp b/src/mongo/util/net/ssl_parameters_auth.cpp
index fd821f4e52d..612c2bc70cc 100644
--- a/src/mongo/util/net/ssl_parameters_auth.cpp
+++ b/src/mongo/util/net/ssl_parameters_auth.cpp
@@ -67,9 +67,9 @@ StatusWith<ServerGlobalParams::ClusterAuthModes> clusterAuthModeParse(StringData
} else if (strMode == "x509") {
return ServerGlobalParams::ClusterAuthMode_x509;
} else {
- return Status(
- ErrorCodes::BadValue,
- str::stream() << "Invalid clusterAuthMode '" << strMode
+ return Status(ErrorCodes::BadValue,
+ str::stream()
+ << "Invalid clusterAuthMode '" << strMode
<< "', expected one of: 'keyFile', 'sendKeyFile', 'sendX509', or 'x509'");
}
}
@@ -99,18 +99,16 @@ Status ClusterAuthModeServerParameter::setFromString(const std::string& strMode)
"connections"};
}
serverGlobalParams.clusterAuthMode.store(mode);
- auth::setInternalUserAuthParams(
- BSON(saslCommandMechanismFieldName << "MONGODB-X509" << saslCommandUserDBFieldName
- << "$external"));
+ auth::setInternalUserAuthParams(BSON(saslCommandMechanismFieldName
+ << "MONGODB-X509" << saslCommandUserDBFieldName
+ << "$external"));
} else if ((mode == ServerGlobalParams::ClusterAuthMode_x509) &&
(oldMode == ServerGlobalParams::ClusterAuthMode_sendX509)) {
serverGlobalParams.clusterAuthMode.store(mode);
} else {
return {ErrorCodes::BadValue,
str::stream() << "Illegal state transition for clusterAuthMode, change from "
- << clusterAuthModeFormat()
- << " to "
- << strMode};
+ << clusterAuthModeFormat() << " to " << strMode};
}
return Status::OK();
diff --git a/src/mongo/util/net/ssl_stream.cpp b/src/mongo/util/net/ssl_stream.cpp
index 80e3503f7ae..1aeb82d2189 100644
--- a/src/mongo/util/net/ssl_stream.cpp
+++ b/src/mongo/util/net/ssl_stream.cpp
@@ -40,8 +40,8 @@ namespace asio {
namespace ssl {
namespace detail {
MONGO_FAIL_POINT_DEFINE(smallTLSReads);
-} // namespce detail
-} // namespce ssl
-} // namespce asio
+} // namespace detail
+} // namespace ssl
+} // namespace asio
#endif
diff --git a/src/mongo/util/ntservice.cpp b/src/mongo/util/ntservice.cpp
index c5133a9c99a..512200c2744 100644
--- a/src/mongo/util/ntservice.cpp
+++ b/src/mongo/util/ntservice.cpp
@@ -625,7 +625,7 @@ void startService() {
}
}
-} // namspace ntservice
+} // namespace ntservice
} // namespace mongo
#endif
diff --git a/src/mongo/util/options_parser/constraints.h b/src/mongo/util/options_parser/constraints.h
index 796f7de8721..6be67a8f31c 100644
--- a/src/mongo/util/options_parser/constraints.h
+++ b/src/mongo/util/options_parser/constraints.h
@@ -131,10 +131,9 @@ private:
T typedVal;
if (!val.get(&typedVal).isOK()) {
return {ErrorCodes::InternalError,
- str::stream() << "Error: value for key: " << _key << " was found as type: "
- << val.typeToString()
- << " but is required to be type: "
- << typeid(typedVal).name()};
+ str::stream() << "Error: value for key: " << _key
+ << " was found as type: " << val.typeToString()
+ << " but is required to be type: " << typeid(typedVal).name()};
}
return _valueCallback(typedVal);
diff --git a/src/mongo/util/options_parser/environment_test.cpp b/src/mongo/util/options_parser/environment_test.cpp
index 9f0737e2ad6..6fbd3d70048 100644
--- a/src/mongo/util/options_parser/environment_test.cpp
+++ b/src/mongo/util/options_parser/environment_test.cpp
@@ -92,8 +92,7 @@ TEST(ToBSONTests, DottedValues) {
ASSERT_OK(environment.set(moe::Key("val1.dotted2"), moe::Value(std::string("string"))));
mongo::BSONObj obj = BSON("val1" << BSON("dotted1" << 6 << "dotted2"
<< "string")
- << "val2"
- << true);
+ << "val2" << true);
// TODO: Put a comparison here that doesn't depend on the field order. Right now it is
// based on the sort order of keys in a std::map.
ASSERT_BSONOBJ_EQ(obj, environment.toBSON());
@@ -108,12 +107,10 @@ TEST(ToBSONTests, DeepDottedValues) {
ASSERT_OK(environment.set(moe::Key("val2"), moe::Value(6.0)));
mongo::BSONObj obj =
BSON("val1" << BSON("first1" << BSON("second1" << BSON("third1" << 6 << "third2" << true)
- << "second2"
- << BSON("third1" << false))
+ << "second2" << BSON("third1" << false))
<< "first2"
<< "string")
- << "val2"
- << 6.0);
+ << "val2" << 6.0);
// TODO: Put a comparison here that doesn't depend on the field order. Right now it is
// based on the sort order of keys in a std::map.
ASSERT_BSONOBJ_EQ(obj, environment.toBSON());
diff --git a/src/mongo/util/options_parser/option_section.cpp b/src/mongo/util/options_parser/option_section.cpp
index e8f3c6f9927..d54922fb29c 100644
--- a/src/mongo/util/options_parser/option_section.cpp
+++ b/src/mongo/util/options_parser/option_section.cpp
@@ -157,8 +157,7 @@ OptionDescription& OptionSection::addOptionChaining(
// Should not be the same as dottedName.
uassert(ErrorCodes::InternalError,
str::stream() << "Attempted to register option with conflict between dottedName and "
- << "deprecatedDottedName: "
- << dottedName,
+ << "deprecatedDottedName: " << dottedName,
!std::count(deprecatedDottedNames.begin(), deprecatedDottedNames.end(), dottedName));
// Verify deprecated single names.
@@ -170,8 +169,7 @@ OptionDescription& OptionSection::addOptionChaining(
// Should not be the same as singleName.
uassert(ErrorCodes::InternalError,
str::stream() << "Attempted to register option with conflict between singleName and "
- << "deprecatedSingleName: "
- << singleName,
+ << "deprecatedSingleName: " << singleName,
!std::count(deprecatedSingleNames.begin(), deprecatedSingleNames.end(), singleName));
// Should not contain any already registered name.
diff --git a/src/mongo/util/options_parser/options_parser.cpp b/src/mongo/util/options_parser/options_parser.cpp
index 76fdc7fd42a..99231dd132c 100644
--- a/src/mongo/util/options_parser/options_parser.cpp
+++ b/src/mongo/util/options_parser/options_parser.cpp
@@ -416,9 +416,7 @@ public:
uassert(ErrorCodes::BadValue,
str::stream()
- << nodeName
- << " expansion block must contain only '"
- << getExpansionName()
+ << nodeName << " expansion block must contain only '" << getExpansionName()
<< "', and optionally 'type', 'trim', and/or 'digest'/'digest_key' fields",
node.size() == numVisitedFields);
@@ -472,8 +470,7 @@ public:
&computed);
uassert(ErrorCodes::BadValue,
str::stream() << "SHA256HMAC of config expansion " << computed.toString()
- << " does not match expected digest: "
- << _digest->toString(),
+ << " does not match expected digest: " << _digest->toString(),
computed == *_digest);
}
@@ -487,8 +484,7 @@ public:
if (!status.isOK()) {
uasserted(status.code(),
str::stream() << "Failed processing output of " << getExpansionName()
- << " block for config file: "
- << status.reason());
+ << " block for config file: " << status.reason());
}
return newNode;
@@ -719,8 +715,7 @@ Status YAMLNodeToValue(const YAML::Node& YAMLNode,
if (stringMap.count(elemKey) > 0) {
return Status(ErrorCodes::BadValue,
str::stream() << "String Map Option: " << key
- << " has duplicate keys in YAML Config: "
- << elemKey);
+ << " has duplicate keys in YAML Config: " << elemKey);
}
stringMap[std::move(elemKey)] = elemVal.Scalar();
@@ -1028,10 +1023,10 @@ Status addYAMLNodesToEnvironment(const YAML::Node& root,
}
/**
-* For all options that we registered as composable, combine the values from source and dest
-* and set the result in dest. Note that this only works for options that are registered as
-* vectors of strings.
-*/
+ * For all options that we registered as composable, combine the values from source and dest
+ * and set the result in dest. Note that this only works for options that are registered as
+ * vectors of strings.
+ */
Status addCompositions(const OptionSection& options, const Environment& source, Environment* dest) {
std::vector<OptionDescription> options_vector;
Status ret = options.getAllOptions(&options_vector);
@@ -1126,9 +1121,9 @@ Status addCompositions(const OptionSection& options, const Environment& source,
}
/**
-* For all options that have constraints, add those constraints to our environment so that
-* they run when the environment gets validated.
-*/
+ * For all options that have constraints, add those constraints to our environment so that
+ * they run when the environment gets validated.
+ */
Status addConstraints(const OptionSection& options, Environment* dest) {
std::vector<std::shared_ptr<Constraint>> constraints_vector;
diff --git a/src/mongo/util/options_parser/options_parser_test.cpp b/src/mongo/util/options_parser/options_parser_test.cpp
index 42530ab08b6..65b61b08ab5 100644
--- a/src/mongo/util/options_parser/options_parser_test.cpp
+++ b/src/mongo/util/options_parser/options_parser_test.cpp
@@ -5096,7 +5096,8 @@ TEST(YAMLConfigFile, canonicalize) {
moe::OptionsParser parser;
moe::Environment env;
std::vector<std::string> argv = {
- "binary", "--bind_ip_all",
+ "binary",
+ "--bind_ip_all",
};
std::map<std::string, std::string> env_map;
ASSERT_OK(parser.run(opts, argv, env_map, &env));
diff --git a/src/mongo/util/perfctr_collect.cpp b/src/mongo/util/perfctr_collect.cpp
index c70f50fae3f..4fbe98dd419 100644
--- a/src/mongo/util/perfctr_collect.cpp
+++ b/src/mongo/util/perfctr_collect.cpp
@@ -296,9 +296,7 @@ StatusWith<std::vector<PerfCounterCollector::CounterInfo>> PerfCounterCollector:
if (status != PDH_MORE_DATA) {
return {ErrorCodes::WindowsPdhError,
str::stream() << formatFunctionCallError("PdhExpandCounterPathW", status)
- << " for counter '"
- << path
- << "'"};
+ << " for counter '" << path << "'"};
}
auto buf = std::make_unique<wchar_t[]>(pathListLength);
diff --git a/src/mongo/util/perfctr_collect_test.cpp b/src/mongo/util/perfctr_collect_test.cpp
index 35380d43421..869f72f9e20 100644
--- a/src/mongo/util/perfctr_collect_test.cpp
+++ b/src/mongo/util/perfctr_collect_test.cpp
@@ -178,22 +178,22 @@ TEST(FTDCPerfCollector, TestBadCollectionInput) {
ASSERT_NOT_OK(collection.addCountersGroup("cpu", {"\\Processor(0)\\% Idle Time"}));
// Duplicate counter
- ASSERT_NOT_OK(collection.addCountersGroup(
- "cpu2",
- {
- "\\Processor(0)\\% Idle Time", "\\Processor(0)\\% Idle Time",
- }));
+ ASSERT_NOT_OK(collection.addCountersGroup("cpu2",
+ {
+ "\\Processor(0)\\% Idle Time",
+ "\\Processor(0)\\% Idle Time",
+ }));
// Duplicate group
ASSERT_NOT_OK(
collection.addCountersGroupedByInstanceName("cpu", {"\\Processor(0)\\% Idle Time"}));
// Duplicate counter
- ASSERT_NOT_OK(collection.addCountersGroupedByInstanceName(
- "cpu2",
- {
- "\\Processor(0)\\% Idle Time", "\\Processor(0)\\% Idle Time",
- }));
+ ASSERT_NOT_OK(collection.addCountersGroupedByInstanceName("cpu2",
+ {
+ "\\Processor(0)\\% Idle Time",
+ "\\Processor(0)\\% Idle Time",
+ }));
}
// Test negative collector input
diff --git a/src/mongo/util/periodic_runner.h b/src/mongo/util/periodic_runner.h
index 93a03498357..e9dcfa67489 100644
--- a/src/mongo/util/periodic_runner.h
+++ b/src/mongo/util/periodic_runner.h
@@ -143,7 +143,7 @@ public:
* Each wrapped PeriodicRunner::ControllableJob function on this object throws
* if the underlying job is gone (e.g. in shutdown).
*/
-class[[nodiscard]] PeriodicJobAnchor {
+class [[nodiscard]] PeriodicJobAnchor {
public:
using Job = PeriodicRunner::ControllableJob;
diff --git a/src/mongo/util/periodic_runner_factory.cpp b/src/mongo/util/periodic_runner_factory.cpp
index 66cddf81be6..34aa8c86458 100644
--- a/src/mongo/util/periodic_runner_factory.cpp
+++ b/src/mongo/util/periodic_runner_factory.cpp
@@ -40,4 +40,4 @@ std::unique_ptr<PeriodicRunner> makePeriodicRunner(ServiceContext* svc) {
return std::make_unique<PeriodicRunnerImpl>(svc, svc->getPreciseClockSource());
}
-} // namespace
+} // namespace mongo
diff --git a/src/mongo/util/periodic_runner_impl.cpp b/src/mongo/util/periodic_runner_impl.cpp
index fc21a7184a4..98a517cf7d9 100644
--- a/src/mongo/util/periodic_runner_impl.cpp
+++ b/src/mongo/util/periodic_runner_impl.cpp
@@ -57,7 +57,7 @@ PeriodicRunnerImpl::PeriodicJobImpl::PeriodicJobImpl(PeriodicJob job,
: _job(std::move(job)), _clockSource(source), _serviceContext(svc) {}
void PeriodicRunnerImpl::PeriodicJobImpl::_run() {
- auto[startPromise, startFuture] = makePromiseFuture<void>();
+ auto [startPromise, startFuture] = makePromiseFuture<void>();
{
stdx::lock_guard lk(_mutex);
@@ -65,7 +65,7 @@ void PeriodicRunnerImpl::PeriodicJobImpl::_run() {
}
- _thread = stdx::thread([ this, startPromise = std::move(startPromise) ]() mutable {
+ _thread = stdx::thread([this, startPromise = std::move(startPromise)]() mutable {
auto guard = makeGuard([this] { _stopPromise.emplaceValue(); });
Client::initThread(_job.name, _serviceContext, nullptr);
diff --git a/src/mongo/util/polymorphic_scoped.h b/src/mongo/util/polymorphic_scoped.h
index cace603334b..c6df4086503 100644
--- a/src/mongo/util/polymorphic_scoped.h
+++ b/src/mongo/util/polymorphic_scoped.h
@@ -31,8 +31,8 @@
namespace mongo {
/**
-* Base class to implement interfaces with RAII-style objects
-*/
+ * Base class to implement interfaces with RAII-style objects
+ */
class PolymorphicScoped {
public:
virtual ~PolymorphicScoped() = default;
diff --git a/src/mongo/util/processinfo.h b/src/mongo/util/processinfo.h
index 58a2ad4c686..43cde512599 100644
--- a/src/mongo/util/processinfo.h
+++ b/src/mongo/util/processinfo.h
@@ -245,4 +245,4 @@ private:
};
bool writePidFile(const std::string& path);
-}
+} // namespace mongo
diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
index 478851ec91c..d38acf0393e 100644
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -132,7 +132,7 @@ public:
&_exit_signal, &_processor,
&_rtprio, &_sched
*/
- );
+ );
if (found == 0) {
std::cout << "system error: reading proc info" << std::endl;
}
@@ -248,8 +248,8 @@ public:
class LinuxSysHelper {
public:
/**
- * Read the first 1023 bytes from a file
- */
+ * Read the first 1023 bytes from a file
+ */
static std::string readLineFromFile(const char* fname) {
FILE* f;
char fstr[1024] = {0};
@@ -264,8 +264,8 @@ public:
}
/**
- * Get some details about the CPU
- */
+ * Get some details about the CPU
+ */
static void getCpuInfo(int& procCount, std::string& freq, std::string& features) {
FILE* f;
char fstr[1024] = {0};
@@ -290,8 +290,8 @@ public:
}
/**
- * Determine linux distro and version
- */
+ * Determine linux distro and version
+ */
static void getLinuxDistro(std::string& name, std::string& version) {
char buf[4096] = {0};
@@ -387,8 +387,8 @@ public:
}
/**
- * Get system memory total
- */
+ * Get system memory total
+ */
static unsigned long long getSystemMemorySize() {
std::string meminfo = readLineFromFile("/proc/meminfo");
size_t lineOff = 0;
@@ -413,11 +413,11 @@ public:
}
/**
- * Get memory limit for the process.
- * If memory is being limited by the applied control group and it's less
- * than the OS system memory (default cgroup limit is ulonglong max) let's
- * return the actual memory we'll have available to the process.
- */
+ * Get memory limit for the process.
+ * If memory is being limited by the applied control group and it's less
+ * than the OS system memory (default cgroup limit is ulonglong max) let's
+ * return the actual memory we'll have available to the process.
+ */
static unsigned long long getMemorySizeLimit() {
unsigned long long systemMemBytes = getSystemMemorySize();
unsigned long long cgroupMemBytes = 0;
@@ -508,8 +508,8 @@ void ProcessInfo::getExtraInfo(BSONObjBuilder& info) {
}
/**
-* Save a BSON obj representing the host system's details
-*/
+ * Save a BSON obj representing the host system's details
+ */
void ProcessInfo::SystemInfo::collectSystemInfo() {
utsname unameData;
std::string distroName, distroVersion;
@@ -563,8 +563,8 @@ void ProcessInfo::SystemInfo::collectSystemInfo() {
}
/**
-* Determine if the process is running with (cc)NUMA
-*/
+ * Determine if the process is running with (cc)NUMA
+ */
bool ProcessInfo::checkNumaEnabled() {
bool hasMultipleNodes = false;
bool hasNumaMaps = false;
@@ -619,4 +619,4 @@ bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, std::vector<
}
return true;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/processinfo_openbsd.cpp b/src/mongo/util/processinfo_openbsd.cpp
index 234d2e9d366..34dade8a885 100644
--- a/src/mongo/util/processinfo_openbsd.cpp
+++ b/src/mongo/util/processinfo_openbsd.cpp
@@ -217,4 +217,4 @@ boost::optional<unsigned long> ProcessInfo::getNumCoresForProcess() {
return nprocs;
return boost::none;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/processinfo_osx.cpp b/src/mongo/util/processinfo_osx.cpp
index 0ed7de3a1f9..45fc77f68ff 100644
--- a/src/mongo/util/processinfo_osx.cpp
+++ b/src/mongo/util/processinfo_osx.cpp
@@ -240,4 +240,4 @@ bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, std::vector<
}
return true;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/processinfo_solaris.cpp b/src/mongo/util/processinfo_solaris.cpp
index 9d7d66f9891..c12ce0e6da9 100644
--- a/src/mongo/util/processinfo_solaris.cpp
+++ b/src/mongo/util/processinfo_solaris.cpp
@@ -242,4 +242,4 @@ bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, std::vector<
}
return true;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/processinfo_test.cpp b/src/mongo/util/processinfo_test.cpp
index 47fb5e91b5c..158c1186268 100644
--- a/src/mongo/util/processinfo_test.cpp
+++ b/src/mongo/util/processinfo_test.cpp
@@ -36,8 +36,8 @@
#include "mongo/unittest/unittest.h"
#include "mongo/util/processinfo.h"
-using mongo::ProcessInfo;
using boost::optional;
+using mongo::ProcessInfo;
namespace mongo_test {
TEST(ProcessInfo, SysInfoIsInitialized) {
@@ -65,4 +65,4 @@ TEST(ProcessInfo, GetNumAvailableCores) {
TEST(ProcessInfo, GetNumCoresReturnsNonZeroNumberOfProcessors) {
ASSERT_GREATER_THAN(ProcessInfo::getNumCores(), 0u);
}
-}
+} // namespace mongo_test
diff --git a/src/mongo/util/processinfo_unknown.cpp b/src/mongo/util/processinfo_unknown.cpp
index 338c6efd857..05f84b7f22c 100644
--- a/src/mongo/util/processinfo_unknown.cpp
+++ b/src/mongo/util/processinfo_unknown.cpp
@@ -78,4 +78,4 @@ bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, std::vector<
boost::optional<unsigned long> ProcessInfo::getNumCoresForProcess() {
return boost::none;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/processinfo_windows.cpp b/src/mongo/util/processinfo_windows.cpp
index e545778f897..3e6e0b27aae 100644
--- a/src/mongo/util/processinfo_windows.cpp
+++ b/src/mongo/util/processinfo_windows.cpp
@@ -413,4 +413,4 @@ bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, std::vector<
}
return true;
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/procparser.cpp b/src/mongo/util/procparser.cpp
index 630e2888eee..78e1a244155 100644
--- a/src/mongo/util/procparser.cpp
+++ b/src/mongo/util/procparser.cpp
@@ -93,8 +93,8 @@ StatusWith<std::string> readFileAsString(StringData filename) {
if (fd == -1) {
int err = errno;
return Status(ErrorCodes::FileOpenFailed,
- str::stream() << "Failed to open file " << filename << " with error: "
- << errnoWithDescription(err));
+ str::stream() << "Failed to open file " << filename
+ << " with error: " << errnoWithDescription(err));
}
auto scopedGuard = makeGuard([fd] { close(fd); });
@@ -122,8 +122,8 @@ StatusWith<std::string> readFileAsString(StringData filename) {
}
return Status(ErrorCodes::FileStreamFailed,
- str::stream() << "Failed to read file " << filename << " with error: "
- << errnoWithDescription(err));
+ str::stream() << "Failed to read file " << filename
+ << " with error: " << errnoWithDescription(err));
}
break;
@@ -432,11 +432,10 @@ Status parseProcNetstat(const std::vector<StringData>& keys,
// Split the file by lines.
uint32_t lineNum = 0;
- for (string_split_iterator
- lineIt = string_split_iterator(
- data.begin(),
- data.end(),
- boost::token_finder([](char c) { return c == '\n'; }, boost::token_compress_on));
+ for (string_split_iterator lineIt = string_split_iterator(
+ data.begin(),
+ data.end(),
+ boost::token_finder([](char c) { return c == '\n'; }, boost::token_compress_on));
lineIt != string_split_iterator();
++lineIt, ++lineNum) {
diff --git a/src/mongo/util/procparser.h b/src/mongo/util/procparser.h
index 9bae32cba10..8fd39d0fd35 100644
--- a/src/mongo/util/procparser.h
+++ b/src/mongo/util/procparser.h
@@ -60,12 +60,12 @@ Status parseProcStat(const std::vector<StringData>& keys,
BSONObjBuilder* builder);
/**
-* Read from file, and write the specified list of keys into builder.
-*
-* See parseProcStat.
-*
-* Returns Status errors on file reading issues.
-*/
+ * Read from file, and write the specified list of keys into builder.
+ *
+ * See parseProcStat.
+ *
+ * Returns Status errors on file reading issues.
+ */
Status parseProcStatFile(StringData filename,
const std::vector<StringData>& keys,
BSONObjBuilder* builder);
diff --git a/src/mongo/util/procparser_test.cpp b/src/mongo/util/procparser_test.cpp
index 0afd85726c1..1fba705f929 100644
--- a/src/mongo/util/procparser_test.cpp
+++ b/src/mongo/util/procparser_test.cpp
@@ -208,7 +208,12 @@ TEST(FTDCProcStat, TestStat) {
// otherwise.
TEST(FTDCProcStat, TestLocalStat) {
std::vector<StringData> keys{
- "btime", "cpu", "ctxt", "processes", "procs_blocked", "procs_running",
+ "btime",
+ "cpu",
+ "ctxt",
+ "processes",
+ "procs_blocked",
+ "procs_running",
};
BSONObjBuilder builder;
@@ -237,7 +242,12 @@ TEST(FTDCProcStat, TestLocalStat) {
TEST(FTDCProcStat, TestLocalNonExistentStat) {
std::vector<StringData> keys{
- "btime", "cpu", "ctxt", "processes", "procs_blocked", "procs_running",
+ "btime",
+ "cpu",
+ "ctxt",
+ "processes",
+ "procs_blocked",
+ "procs_running",
};
BSONObjBuilder builder;
diff --git a/src/mongo/util/producer_consumer_queue.h b/src/mongo/util/producer_consumer_queue.h
index c103515d19f..05b39eff7db 100644
--- a/src/mongo/util/producer_consumer_queue.h
+++ b/src/mongo/util/producer_consumer_queue.h
@@ -336,8 +336,7 @@ public:
explicit Waiter(ProducerState& x, size_t wants) : _x(x) {
uassert(ErrorCodes::ProducerConsumerQueueProducerQueueDepthExceeded,
str::stream() << "ProducerConsumerQueue producer queue depth exceeded, "
- << (_x._producerQueueDepth + wants)
- << " > "
+ << (_x._producerQueueDepth + wants) << " > "
<< _x._maxProducerQueueDepth,
_x._maxProducerQueueDepth == std::numeric_limits<size_t>::max() ||
_x._producerQueueDepth + wants <= _x._maxProducerQueueDepth);
@@ -473,8 +472,7 @@ public:
auto cost = _invokeCostFunc(t, lk);
uassert(ErrorCodes::ProducerConsumerQueueBatchTooLarge,
str::stream() << "cost of item (" << cost
- << ") larger than maximum queue size ("
- << _options.maxQueueDepth
+ << ") larger than maximum queue size (" << _options.maxQueueDepth
<< ")",
cost <= _options.maxQueueDepth);
@@ -506,8 +504,7 @@ public:
uassert(ErrorCodes::ProducerConsumerQueueBatchTooLarge,
str::stream() << "cost of items in batch (" << cost
- << ") larger than maximum queue size ("
- << _options.maxQueueDepth
+ << ") larger than maximum queue size (" << _options.maxQueueDepth
<< ")",
cost <= _options.maxQueueDepth);
diff --git a/src/mongo/util/producer_consumer_queue_test.cpp b/src/mongo/util/producer_consumer_queue_test.cpp
index 34ff9227a8d..ba39482d0d0 100644
--- a/src/mongo/util/producer_consumer_queue_test.cpp
+++ b/src/mongo/util/producer_consumer_queue_test.cpp
@@ -861,7 +861,7 @@ PRODUCER_CONSUMER_QUEUE_TEST(pipeProducerEndClosesAfterProducersLeave,
ASSERT_EQUALS(consumer.pop(), MoveOnly(2));
auto thread3 =
- helper.runThread("Producer3", [producer = std::move(producer)](OperationContext * opCtx) {
+ helper.runThread("Producer3", [producer = std::move(producer)](OperationContext* opCtx) {
producer.push(MoveOnly(3), opCtx);
});
@@ -882,7 +882,7 @@ PRODUCER_CONSUMER_QUEUE_TEST(pipeConsumerEndClosesAfterConsumersLeave,
helper.runThread("Consumer2", [consumer](OperationContext* opCtx) { consumer.pop(opCtx); });
auto thread3 =
- helper.runThread("Consumer3", [consumer = std::move(consumer)](OperationContext * opCtx) {
+ helper.runThread("Consumer3", [consumer = std::move(consumer)](OperationContext* opCtx) {
consumer.pop(opCtx);
});
diff --git a/src/mongo/util/progress_meter.cpp b/src/mongo/util/progress_meter.cpp
index 6287cbd7552..1869eca8a95 100644
--- a/src/mongo/util/progress_meter.cpp
+++ b/src/mongo/util/progress_meter.cpp
@@ -100,4 +100,4 @@ std::string ProgressMeter::toString() const {
return buf.str();
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/progress_meter.h b/src/mongo/util/progress_meter.h
index c666c0e90a2..35b3305f94a 100644
--- a/src/mongo/util/progress_meter.h
+++ b/src/mongo/util/progress_meter.h
@@ -168,4 +168,4 @@ public:
private:
ProgressMeter* _pm;
};
-}
+} // namespace mongo
diff --git a/src/mongo/util/queue.h b/src/mongo/util/queue.h
index 63321eeb926..c3a56d4db21 100644
--- a/src/mongo/util/queue.h
+++ b/src/mongo/util/queue.h
@@ -278,4 +278,4 @@ private:
stdx::condition_variable _cvNoLongerFull;
stdx::condition_variable _cvNoLongerEmpty;
};
-}
+} // namespace mongo
diff --git a/src/mongo/util/regex_util.cpp b/src/mongo/util/regex_util.cpp
index 1a596f5375c..2338e32f0c3 100644
--- a/src/mongo/util/regex_util.cpp
+++ b/src/mongo/util/regex_util.cpp
@@ -56,13 +56,13 @@ pcrecpp::RE_Options flagsToPcreOptions(StringData optionFlags,
continue;
default:
if (!ignoreInvalidFlags) {
- uasserted(
- 51108,
- str::stream() << opName << " invalid flag in regex options: " << flag);
+ uasserted(51108,
+ str::stream()
+ << opName << " invalid flag in regex options: " << flag);
}
}
}
return opt;
}
-}
-}
+} // namespace regex_util
+} // namespace mongo
diff --git a/src/mongo/util/regex_util.h b/src/mongo/util/regex_util.h
index 9be72ba94d7..f187c8eddfc 100644
--- a/src/mongo/util/regex_util.h
+++ b/src/mongo/util/regex_util.h
@@ -42,5 +42,5 @@ namespace regex_util {
pcrecpp::RE_Options flagsToPcreOptions(StringData optionFlags,
bool ignoreInvalidOptions,
StringData opName = "");
-}
-}
+} // namespace regex_util
+} // namespace mongo
diff --git a/src/mongo/util/safe_num.h b/src/mongo/util/safe_num.h
index 529adec4878..7f16cd036f3 100644
--- a/src/mongo/util/safe_num.h
+++ b/src/mongo/util/safe_num.h
@@ -40,7 +40,7 @@ namespace mongo {
namespace mutablebson {
class Element;
class Document;
-}
+} // namespace mutablebson
/**
* SafeNum holds and does arithmetic on a number in a safe way, handling overflow
diff --git a/src/mongo/util/safe_num_test.cpp b/src/mongo/util/safe_num_test.cpp
index 426c4d2809e..7fb581b786f 100644
--- a/src/mongo/util/safe_num_test.cpp
+++ b/src/mongo/util/safe_num_test.cpp
@@ -40,8 +40,8 @@
namespace {
-using mongo::SafeNum;
using mongo::Decimal128;
+using mongo::SafeNum;
TEST(Basics, Initialization) {
const SafeNum numInt(0);
diff --git a/src/mongo/util/scopeguard.h b/src/mongo/util/scopeguard.h
index bf2e571f8d0..6ba256f6eeb 100644
--- a/src/mongo/util/scopeguard.h
+++ b/src/mongo/util/scopeguard.h
@@ -37,7 +37,7 @@
namespace mongo {
template <typename F>
-class[[nodiscard]] ScopeGuard {
+class [[nodiscard]] ScopeGuard {
public:
template <typename FuncArg>
explicit ScopeGuard(FuncArg && f) : _func(std::forward<FuncArg>(f)) {}
diff --git a/src/mongo/util/shared_buffer.h b/src/mongo/util/shared_buffer.h
index c026f92f848..83a9f02bc2b 100644
--- a/src/mongo/util/shared_buffer.h
+++ b/src/mongo/util/shared_buffer.h
@@ -228,4 +228,4 @@ private:
inline void swap(ConstSharedBuffer& one, ConstSharedBuffer& two) {
one.swap(two);
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/signal_handlers.cpp b/src/mongo/util/signal_handlers.cpp
index 2f361b363e5..f4ff57e8238 100644
--- a/src/mongo/util/signal_handlers.cpp
+++ b/src/mongo/util/signal_handlers.cpp
@@ -65,7 +65,7 @@ const char* strsignal(int signalNum) {
return "UNKNOWN";
}
}
-}
+} // namespace
#endif
namespace mongo {
diff --git a/src/mongo/util/signal_win32.cpp b/src/mongo/util/signal_win32.cpp
index 3f4163c514a..e4e51e4b19f 100644
--- a/src/mongo/util/signal_win32.cpp
+++ b/src/mongo/util/signal_win32.cpp
@@ -42,4 +42,4 @@ std::string getShutdownSignalName(int processId) {
return str::stream() << strEventNamePrefix << processId;
}
#endif
-}
+} // namespace mongo
diff --git a/src/mongo/util/signal_win32.h b/src/mongo/util/signal_win32.h
index d05bde04899..1127e549a1f 100644
--- a/src/mongo/util/signal_win32.h
+++ b/src/mongo/util/signal_win32.h
@@ -37,4 +37,4 @@ namespace mongo {
// Generate windows event name for shutdown signal
std::string getShutdownSignalName(int processId);
#endif
-}
+} // namespace mongo
diff --git a/src/mongo/util/stack_introspect.h b/src/mongo/util/stack_introspect.h
index 9087711ad69..9f431160332 100644
--- a/src/mongo/util/stack_introspect.h
+++ b/src/mongo/util/stack_introspect.h
@@ -44,4 +44,4 @@ bool inConstructorChain(bool printOffending = false);
* @return if supported on platform, compile options may still prevent it from working
*/
bool inConstructorChainSupported();
-}
+} // namespace mongo
diff --git a/src/mongo/util/stacktrace_posix.cpp b/src/mongo/util/stacktrace_posix.cpp
index d9d63b89109..29775d035b1 100644
--- a/src/mongo/util/stacktrace_posix.cpp
+++ b/src/mongo/util/stacktrace_posix.cpp
@@ -543,12 +543,12 @@ void addOSComponentsToSoMap(BSONObjBuilder* soMap) {
}
}
}
-} // namepace
+} // namespace
} // namespace mongo
#else
namespace mongo {
namespace {
void addOSComponentsToSoMap(BSONObjBuilder* soMap) {}
-} // namepace
+} // namespace
} // namespace mongo
#endif
diff --git a/src/mongo/util/stacktrace_unwind.cpp b/src/mongo/util/stacktrace_unwind.cpp
index a70667e45bf..c5aff514880 100644
--- a/src/mongo/util/stacktrace_unwind.cpp
+++ b/src/mongo/util/stacktrace_unwind.cpp
@@ -596,12 +596,12 @@ void addOSComponentsToSoMap(BSONObjBuilder* soMap) {
}
}
}
-} // namepace
+} // namespace
} // namespace mongo
#else
namespace mongo {
namespace {
void addOSComponentsToSoMap(BSONObjBuilder* soMap) {}
-} // namepace
+} // namespace
} // namespace mongo
#endif
diff --git a/src/mongo/util/stacktrace_windows.cpp b/src/mongo/util/stacktrace_windows.cpp
index 6aef676a4b2..06f401c6b8c 100644
--- a/src/mongo/util/stacktrace_windows.cpp
+++ b/src/mongo/util/stacktrace_windows.cpp
@@ -356,4 +356,4 @@ int crtDebugCallback(int, char* originalMessage, int*) {
log() << "*** C runtime error: " << message.substr(0, message.find('\n')) << ", terminating";
fassertFailed(17006);
}
-}
+} // namespace mongo
diff --git a/src/mongo/util/string_map_test.cpp b/src/mongo/util/string_map_test.cpp
index b244313db6b..24bae71587c 100644
--- a/src/mongo/util/string_map_test.cpp
+++ b/src/mongo/util/string_map_test.cpp
@@ -212,11 +212,14 @@ TEST(StringMapTest, Assign) {
TEST(StringMapTest, InitWithInitializerList) {
StringMap<int> smap{
- {"q", 1}, {"coollog", 2}, {"mango", 3}, {"mango", 4},
+ {"q", 1},
+ {"coollog", 2},
+ {"mango", 3},
+ {"mango", 4},
};
ASSERT_EQ(1, smap["q"]);
ASSERT_EQ(2, smap["coollog"]);
ASSERT_EQ(3, smap["mango"]);
}
-}
+} // namespace
diff --git a/src/mongo/util/summation_test.cpp b/src/mongo/util/summation_test.cpp
index 1fd8a632640..72b29cc47de 100644
--- a/src/mongo/util/summation_test.cpp
+++ b/src/mongo/util/summation_test.cpp
@@ -41,41 +41,41 @@ namespace mongo {
namespace {
using limits = std::numeric_limits<long long>;
-std::vector<long long> longValues = {
- limits::min(),
- limits::min() + 1,
- limits::min() / 2,
- -(1LL << 53),
- -(1LL << 52),
- -(1LL << 32),
- -0x100,
- -0xff,
- -0xaa,
- -0x55,
- -1,
- 0,
- 1,
- 2,
- 0x55,
- 0x80,
- 0xaa,
- 0x100,
- 512,
- 1024,
- 2048,
- 1LL << 31,
- 1LL << 32,
- 1LL << 52,
- 1LL << 53,
- limits::max() / 2,
+std::vector<long long> longValues = {limits::min(),
+ limits::min() + 1,
+ limits::min() / 2,
+ -(1LL << 53),
+ -(1LL << 52),
+ -(1LL << 32),
+ -0x100,
+ -0xff,
+ -0xaa,
+ -0x55,
+ -1,
+ 0,
+ 1,
+ 2,
+ 0x55,
+ 0x80,
+ 0xaa,
+ 0x100,
+ 512,
+ 1024,
+ 2048,
+ 1LL << 31,
+ 1LL << 32,
+ 1LL << 52,
+ 1LL << 53,
+ limits::max() / 2,
#pragma warning(push)
// C4308: negative integral constant converted to unsigned type
#pragma warning(disable : 4308)
- static_cast<long long>(1ULL << 63) - (1ULL << (63 - 53 - 1)), // Halfway between two doubles
+ static_cast<long long>(1ULL << 63) -
+ (1ULL << (63 - 53 - 1)), // Halfway between two doubles
#pragma warning(pop)
- limits::max() - 1,
- limits::max()};
+ limits::max() - 1,
+ limits::max()};
std::vector<double> doubleValues = {
1.4831356930199802e-05, -3.121724665346865, 3041897608700.073, 1001318343149.7166,
diff --git a/src/mongo/util/tcmalloc_set_parameter.cpp b/src/mongo/util/tcmalloc_set_parameter.cpp
index b7dd65fe752..87022f520da 100644
--- a/src/mongo/util/tcmalloc_set_parameter.cpp
+++ b/src/mongo/util/tcmalloc_set_parameter.cpp
@@ -75,18 +75,16 @@ StatusWith<size_t> validateTCMallocValue(StringData name, const BSONElement& new
return {ErrorCodes::TypeMismatch,
str::stream() << "Expected server parameter " << name
<< " to have numeric type, but found "
- << newValueElement.toString(false)
- << " of type "
+ << newValueElement.toString(false) << " of type "
<< typeName(newValueElement.type())};
}
long long valueAsLongLong = newValueElement.safeNumberLong();
if (valueAsLongLong < 0 ||
static_cast<unsigned long long>(valueAsLongLong) > std::numeric_limits<size_t>::max()) {
- return Status(
- ErrorCodes::BadValue,
- str::stream() << "Value " << newValueElement.toString(false) << " is out of range for "
- << name
- << "; expected a value between 0 and "
+ return Status(ErrorCodes::BadValue,
+ str::stream()
+ << "Value " << newValueElement.toString(false) << " is out of range for "
+ << name << "; expected a value between 0 and "
<< std::min<unsigned long long>(std::numeric_limits<size_t>::max(),
std::numeric_limits<long long>::max()));
}
diff --git a/src/mongo/util/text.cpp b/src/mongo/util/text.cpp
index f01ed7797a4..be0e18eea3a 100644
--- a/src/mongo/util/text.cpp
+++ b/src/mongo/util/text.cpp
@@ -184,7 +184,7 @@ std::wstring toWideString(const char* utf8String) {
-1, // Count, -1 for NUL-terminated
nullptr, // No output buffer
0 // Zero means "compute required size"
- );
+ );
if (bufferSize == 0) {
return std::wstring();
}
@@ -196,7 +196,7 @@ std::wstring toWideString(const char* utf8String) {
-1, // Count, -1 for NUL-terminated
tempBuffer.get(), // UTF-16 output buffer
bufferSize // Buffer size in wide characters
- );
+ );
return std::wstring(tempBuffer.get());
}
@@ -214,7 +214,7 @@ bool writeUtf8ToWindowsConsole(const char* utf8String, unsigned int utf8StringSi
utf8StringSize, // Input string length
nullptr, // No output buffer
0 // Zero means "compute required size"
- );
+ );
if (bufferSize == 0) {
return true;
}
@@ -225,7 +225,7 @@ bool writeUtf8ToWindowsConsole(const char* utf8String, unsigned int utf8StringSi
utf8StringSize, // Input string length
utf16String.get(), // UTF-16 output buffer
bufferSize // Buffer size in wide characters
- );
+ );
const wchar_t* utf16Pointer = utf16String.get();
size_t numberOfCharactersToWrite = bufferSize;
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
diff --git a/src/mongo/util/tick_source_test.cpp b/src/mongo/util/tick_source_test.cpp
index 78ea3dac678..aef28a7e97c 100644
--- a/src/mongo/util/tick_source_test.cpp
+++ b/src/mongo/util/tick_source_test.cpp
@@ -52,5 +52,5 @@ TEST(TickSourceTest, TicksToDurationConversion) {
tsMicros.reset(1);
ASSERT_EQ(tsMicros.ticksTo<Microseconds>(tsMicros.getTicks()).count(), 1);
}
-}
+} // namespace
} // namespace mongo
diff --git a/src/mongo/util/unique_function_test.cpp b/src/mongo/util/unique_function_test.cpp
index 66f10ef01e7..8689951a7cb 100644
--- a/src/mongo/util/unique_function_test.cpp
+++ b/src/mongo/util/unique_function_test.cpp
@@ -141,7 +141,7 @@ TEST(UniqueFunctionTest, reassign_simple_unique_function_from_lambda) {
TEST(UniqueFunctionTest, accepts_a_functor_that_is_move_only) {
struct Checker {};
- mongo::unique_function<void()> uf = [checkerPtr = std::make_unique<Checker>()]{};
+ mongo::unique_function<void()> uf = [checkerPtr = std::make_unique<Checker>()] {};
mongo::unique_function<void()> uf2 = std::move(uf);
diff --git a/src/mongo/util/unowned_ptr_test.cpp b/src/mongo/util/unowned_ptr_test.cpp
index 4a6ec0b1d34..b6acea486f6 100644
--- a/src/mongo/util/unowned_ptr_test.cpp
+++ b/src/mongo/util/unowned_ptr_test.cpp
@@ -155,4 +155,4 @@ TEST(UnownedPtr, Equality) {
ASSERT_NE(unowned_ptr<int>(), unowned_ptr<int>(&i)); // NULL != non-NULL
ASSERT_NE(unowned_ptr<int>(&i), unowned_ptr<int>(&j)); // two distinct non-NULLs
}
-}
+} // namespace mongo