summaryrefslogtreecommitdiff
path: root/src/mongo/util
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
commit6dcdd23dd37ef12c87e71cf59ef01cd82432efe0 (patch)
treec8cfb5acb62c80f375bc37e7d4350382deea6a37 /src/mongo/util
parentd4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff)
downloadmongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz
SERVER-23971 Clang-Format code
Diffstat (limited to 'src/mongo/util')
-rw-r--r--src/mongo/util/admin_access.h2
-rw-r--r--src/mongo/util/assert_util.cpp11
-rw-r--r--src/mongo/util/assert_util.h2
-rw-r--r--src/mongo/util/background_thread_clock_source.h4
-rw-r--r--src/mongo/util/base64.h2
-rw-r--r--src/mongo/util/cmdline_utils/censor_cmdline_test.cpp93
-rw-r--r--src/mongo/util/concurrency/rwlockimpl.cpp2
-rw-r--r--src/mongo/util/concurrency/thread_pool.cpp32
-rw-r--r--src/mongo/util/concurrency/thread_pool_test_common.cpp63
-rw-r--r--src/mongo/util/concurrency/ticketholder.cpp3
-rw-r--r--src/mongo/util/debugger.cpp2
-rw-r--r--src/mongo/util/descriptive_stats-inl.h3
-rw-r--r--src/mongo/util/duration.h3
-rw-r--r--src/mongo/util/duration_test.cpp2
-rw-r--r--src/mongo/util/exception_filter_win32.cpp2
-rw-r--r--src/mongo/util/fail_point_service.cpp5
-rw-r--r--src/mongo/util/file.cpp24
-rw-r--r--src/mongo/util/intrusive_counter.cpp3
-rw-r--r--src/mongo/util/intrusive_counter.h2
-rw-r--r--src/mongo/util/itoa_test.cpp2
-rw-r--r--src/mongo/util/log.cpp2
-rw-r--r--src/mongo/util/mongoutils/str.h2
-rw-r--r--src/mongo/util/net/asio_message_port.cpp4
-rw-r--r--src/mongo/util/net/hostandport.cpp11
-rw-r--r--src/mongo/util/net/hostname_canonicalization.cpp4
-rw-r--r--src/mongo/util/net/listen.cpp16
-rw-r--r--src/mongo/util/net/message.cpp2
-rw-r--r--src/mongo/util/net/message_port.cpp4
-rw-r--r--src/mongo/util/net/sock.cpp12
-rw-r--r--src/mongo/util/net/sock.h2
-rw-r--r--src/mongo/util/net/sockaddr.cpp10
-rw-r--r--src/mongo/util/net/sockaddr.h2
-rw-r--r--src/mongo/util/net/ssl_manager.cpp25
-rw-r--r--src/mongo/util/net/ssl_options.cpp80
-rw-r--r--src/mongo/util/ntservice.cpp12
-rw-r--r--src/mongo/util/options_parser/environment_test.cpp13
-rw-r--r--src/mongo/util/options_parser/options_parser.cpp4
-rw-r--r--src/mongo/util/options_parser/options_parser_test.cpp24
-rw-r--r--src/mongo/util/platform_init.cpp4
-rw-r--r--src/mongo/util/processinfo.cpp7
-rw-r--r--src/mongo/util/processinfo_freebsd.cpp2
-rw-r--r--src/mongo/util/processinfo_linux.cpp8
-rw-r--r--src/mongo/util/processinfo_openbsd.cpp2
-rw-r--r--src/mongo/util/processinfo_osx.cpp12
-rw-r--r--src/mongo/util/processinfo_solaris.cpp16
-rw-r--r--src/mongo/util/processinfo_test.cpp2
-rw-r--r--src/mongo/util/processinfo_windows.cpp2
-rw-r--r--src/mongo/util/progress_meter_test.cpp2
-rw-r--r--src/mongo/util/safe_num-inl.h10
-rw-r--r--src/mongo/util/safe_num_test.cpp4
-rw-r--r--src/mongo/util/signal_handlers_synchronous.cpp2
-rw-r--r--src/mongo/util/signal_handlers_synchronous_test.cpp4
-rw-r--r--src/mongo/util/signal_win32.cpp2
-rw-r--r--src/mongo/util/string_map_test.cpp2
-rw-r--r--src/mongo/util/stringutils_test.cpp2
-rw-r--r--src/mongo/util/tcmalloc_set_parameter.cpp15
-rw-r--r--src/mongo/util/text.cpp3
-rw-r--r--src/mongo/util/text.h2
-rw-r--r--src/mongo/util/time_support.cpp10
-rw-r--r--src/mongo/util/time_support.h2
-rw-r--r--src/mongo/util/unowned_ptr.h12
-rw-r--r--src/mongo/util/winutil.h2
62 files changed, 336 insertions, 284 deletions
diff --git a/src/mongo/util/admin_access.h b/src/mongo/util/admin_access.h
index 37ca3f0e29f..721aeb2db23 100644
--- a/src/mongo/util/admin_access.h
+++ b/src/mongo/util/admin_access.h
@@ -31,8 +31,8 @@
#pragma once
-#include "mongo/db/jsobj.h"
#include "mongo/db/auth/user_name.h"
+#include "mongo/db/jsobj.h"
namespace mongo {
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index f1523de6517..b832278cac9 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -288,12 +288,13 @@ Status exceptionToStatus() {
} 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)) << ": "
- << boost::diagnostic_information(ex));
+ return Status(
+ ErrorCodes::UnknownError,
+ str::stream() << "Caught boost::exception of type " << demangleName(typeid(ex)) << ": "
+ << boost::diagnostic_information(ex));
} catch (...) {
severe() << "Caught unknown exception in exceptionToStatus()";
diff --git a/src/mongo/util/assert_util.h b/src/mongo/util/assert_util.h
index 1d72c045764..7748ba447e1 100644
--- a/src/mongo/util/assert_util.h
+++ b/src/mongo/util/assert_util.h
@@ -27,8 +27,8 @@
#pragma once
-#include <typeinfo>
#include <string>
+#include <typeinfo>
#include "mongo/base/status.h" // NOTE: This is safe as utils depend on base
#include "mongo/base/status_with.h"
diff --git a/src/mongo/util/background_thread_clock_source.h b/src/mongo/util/background_thread_clock_source.h
index c532efd3817..6ea43ed86de 100644
--- a/src/mongo/util/background_thread_clock_source.h
+++ b/src/mongo/util/background_thread_clock_source.h
@@ -33,12 +33,12 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/platform/atomic_word.h"
-#include "mongo/util/clock_source.h"
-#include "mongo/util/time_support.h"
#include "mongo/stdx/condition_variable.h"
#include "mongo/stdx/memory.h"
#include "mongo/stdx/mutex.h"
#include "mongo/stdx/thread.h"
+#include "mongo/util/clock_source.h"
+#include "mongo/util/time_support.h"
namespace mongo {
diff --git a/src/mongo/util/base64.h b/src/mongo/util/base64.h
index d5cf3a71f55..740811936ff 100644
--- a/src/mongo/util/base64.h
+++ b/src/mongo/util/base64.h
@@ -29,8 +29,8 @@
#pragma once
-#include <memory>
#include <iosfwd>
+#include <memory>
#include <string>
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/util/cmdline_utils/censor_cmdline_test.cpp b/src/mongo/util/cmdline_utils/censor_cmdline_test.cpp
index a9cb8fe95ba..70e37aacef5 100644
--- a/src/mongo/util/cmdline_utils/censor_cmdline_test.cpp
+++ b/src/mongo/util/cmdline_utils/censor_cmdline_test.cpp
@@ -221,7 +221,8 @@ TEST(BSONObjCensorTests, Strings) {
<< "also not a password"
<< "processManagement.windowsService.servicePassword"
<< "this password should also be censored"
- << "lastarg" << false);
+ << "lastarg"
+ << false);
BSONObj res = BSON("firstarg"
<< "not a password"
@@ -233,35 +234,45 @@ TEST(BSONObjCensorTests, Strings) {
<< "also not a password"
<< "processManagement.windowsService.servicePassword"
<< "<password>"
- << "lastarg" << false);
+ << "lastarg"
+ << false);
cmdline_utils::censorBSONObj(&obj);
ASSERT_EQUALS(res, obj);
}
TEST(BSONObjCensorTests, Arrays) {
- BSONObj obj =
- BSON("firstarg"
- << "not a password"
- << "net.ssl.PEMKeyPassword" << BSON_ARRAY("first censored password"
- << "next censored password")
- << "net.ssl.clusterPassword" << BSON_ARRAY("first censored password"
- << "next censored password") << "middlearg"
- << "also not a password"
- << "processManagement.windowsService.servicePassword"
- << BSON_ARRAY("first censored password"
- << "next censored password") << "lastarg" << false);
+ BSONObj obj = BSON("firstarg"
+ << "not a password"
+ << "net.ssl.PEMKeyPassword"
+ << BSON_ARRAY("first censored password"
+ << "next censored password")
+ << "net.ssl.clusterPassword"
+ << BSON_ARRAY("first censored password"
+ << "next censored password")
+ << "middlearg"
+ << "also not a password"
+ << "processManagement.windowsService.servicePassword"
+ << BSON_ARRAY("first censored password"
+ << "next censored password")
+ << "lastarg"
+ << false);
BSONObj res = BSON("firstarg"
<< "not a password"
- << "net.ssl.PEMKeyPassword" << BSON_ARRAY("<password>"
- << "<password>")
- << "net.ssl.clusterPassword" << BSON_ARRAY("<password>"
- << "<password>") << "middlearg"
+ << "net.ssl.PEMKeyPassword"
+ << BSON_ARRAY("<password>"
+ << "<password>")
+ << "net.ssl.clusterPassword"
+ << BSON_ARRAY("<password>"
+ << "<password>")
+ << "middlearg"
<< "also not a password"
<< "processManagement.windowsService.servicePassword"
<< BSON_ARRAY("<password>"
- << "<password>") << "lastarg" << false);
+ << "<password>")
+ << "lastarg"
+ << false);
cmdline_utils::censorBSONObj(&obj);
ASSERT_EQUALS(res, obj);
@@ -272,26 +283,32 @@ TEST(BSONObjCensorTests, SubObjects) {
BSON("firstarg"
<< "not a password"
<< "net"
- << BSON("ssl" << BSON("PEMKeyPassword"
- << BSON_ARRAY("first censored password"
- << "next censored password") << "PEMKeyPassword"
- << "should be censored too"
- << "clusterPassword" << BSON_ARRAY("first censored password"
- << "next censored password")
- << "clusterPassword"
- << "should be censored too")) << "lastarg" << false);
-
- BSONObj res = BSON(
- "firstarg"
- << "not a password"
- << "net"
- << BSON("ssl" << BSON("PEMKeyPassword" << BSON_ARRAY("<password>"
- << "<password>") << "PEMKeyPassword"
- << "<password>"
- << "clusterPassword" << BSON_ARRAY("<password>"
- << "<password>")
- << "clusterPassword"
- << "<password>")) << "lastarg" << false);
+ << BSON("ssl" << BSON("PEMKeyPassword" << BSON_ARRAY("first censored password"
+ << "next censored password")
+ << "PEMKeyPassword"
+ << "should be censored too"
+ << "clusterPassword"
+ << BSON_ARRAY("first censored password"
+ << "next censored password")
+ << "clusterPassword"
+ << "should be censored too"))
+ << "lastarg"
+ << false);
+
+ BSONObj res = BSON("firstarg"
+ << "not a password"
+ << "net"
+ << BSON("ssl" << BSON("PEMKeyPassword" << BSON_ARRAY("<password>"
+ << "<password>")
+ << "PEMKeyPassword"
+ << "<password>"
+ << "clusterPassword"
+ << BSON_ARRAY("<password>"
+ << "<password>")
+ << "clusterPassword"
+ << "<password>"))
+ << "lastarg"
+ << false);
cmdline_utils::censorBSONObj(&obj);
ASSERT_EQUALS(res, obj);
diff --git a/src/mongo/util/concurrency/rwlockimpl.cpp b/src/mongo/util/concurrency/rwlockimpl.cpp
index 28eeebd363b..755724cd3a5 100644
--- a/src/mongo/util/concurrency/rwlockimpl.cpp
+++ b/src/mongo/util/concurrency/rwlockimpl.cpp
@@ -34,9 +34,9 @@
#define NOMINMAX
#include <windows.h>
#endif
+#include <boost/version.hpp>
#include <map>
#include <set>
-#include <boost/version.hpp>
#include "mongo/config.h"
#include "mongo/stdx/condition_variable.h"
diff --git a/src/mongo/util/concurrency/thread_pool.cpp b/src/mongo/util/concurrency/thread_pool.cpp
index 4a5e456b972..90464d7b167 100644
--- a/src/mongo/util/concurrency/thread_pool.cpp
+++ b/src/mongo/util/concurrency/thread_pool.cpp
@@ -137,23 +137,21 @@ void ThreadPool::join() {
}
void ThreadPool::_join_inlock(stdx::unique_lock<stdx::mutex>* lk) {
- _stateChange.wait(*lk,
- [this] {
- switch (_state) {
- case preStart:
- return false;
- case running:
- return false;
- case joinRequired:
- return true;
- case joining:
- case shutdownComplete:
- severe() << "Attempted to join pool " << _options.poolName
- << " more than once";
- fassertFailed(28700);
- }
- MONGO_UNREACHABLE;
- });
+ _stateChange.wait(*lk, [this] {
+ switch (_state) {
+ case preStart:
+ return false;
+ case running:
+ return false;
+ case joinRequired:
+ return true;
+ case joining:
+ case shutdownComplete:
+ severe() << "Attempted to join pool " << _options.poolName << " more than once";
+ fassertFailed(28700);
+ }
+ MONGO_UNREACHABLE;
+ });
_setState_inlock(joining);
++_numIdleThreads;
while (!_pendingTasks.empty()) {
diff --git a/src/mongo/util/concurrency/thread_pool_test_common.cpp b/src/mongo/util/concurrency/thread_pool_test_common.cpp
index 1f965e4a2c4..ea63df2df83 100644
--- a/src/mongo/util/concurrency/thread_pool_test_common.cpp
+++ b/src/mongo/util/concurrency/thread_pool_test_common.cpp
@@ -99,40 +99,39 @@ public:
}
};
-#define COMMON_THREAD_POOL_TEST(TEST_NAME) \
- class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \
- public: \
- TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \
- : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \
- \
- private: \
- void _doTest() override; \
- static const TptRegistrationAgent _agent; \
- }; \
- const TptRegistrationAgent TPT_##TEST_NAME::_agent(#TEST_NAME, \
- [](ThreadPoolFactory makeThreadPool) { \
- return stdx::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \
- }); \
+#define COMMON_THREAD_POOL_TEST(TEST_NAME) \
+ class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \
+ public: \
+ TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \
+ : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \
+ \
+ private: \
+ void _doTest() override; \
+ static const TptRegistrationAgent _agent; \
+ }; \
+ const TptRegistrationAgent TPT_##TEST_NAME::_agent( \
+ #TEST_NAME, [](ThreadPoolFactory makeThreadPool) { \
+ return stdx::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \
+ }); \
void TPT_##TEST_NAME::_doTest()
-#define COMMON_THREAD_POOL_DEATH_TEST(TEST_NAME, MATCH_EXPR) \
- class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \
- public: \
- TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \
- : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \
- \
- private: \
- void _doTest() override; \
- static const TptDeathRegistrationAgent<TPT_##TEST_NAME> _agent; \
- }; \
- const TptDeathRegistrationAgent<TPT_##TEST_NAME> TPT_##TEST_NAME::_agent( \
- #TEST_NAME, \
- [](ThreadPoolFactory makeThreadPool) { \
- return stdx::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \
- }); \
- std::string getDeathTestPattern(TPT_##TEST_NAME*) { \
- return MATCH_EXPR; \
- } \
+#define COMMON_THREAD_POOL_DEATH_TEST(TEST_NAME, MATCH_EXPR) \
+ class TPT_##TEST_NAME : public CommonThreadPoolTestFixture { \
+ public: \
+ TPT_##TEST_NAME(ThreadPoolFactory makeThreadPool) \
+ : CommonThreadPoolTestFixture(std::move(makeThreadPool)) {} \
+ \
+ private: \
+ void _doTest() override; \
+ static const TptDeathRegistrationAgent<TPT_##TEST_NAME> _agent; \
+ }; \
+ const TptDeathRegistrationAgent<TPT_##TEST_NAME> TPT_##TEST_NAME::_agent( \
+ #TEST_NAME, [](ThreadPoolFactory makeThreadPool) { \
+ return stdx::make_unique<TPT_##TEST_NAME>(std::move(makeThreadPool)); \
+ }); \
+ std::string getDeathTestPattern(TPT_##TEST_NAME*) { \
+ return MATCH_EXPR; \
+ } \
void TPT_##TEST_NAME::_doTest()
COMMON_THREAD_POOL_TEST(UnusedPool) {
diff --git a/src/mongo/util/concurrency/ticketholder.cpp b/src/mongo/util/concurrency/ticketholder.cpp
index 34535fa98b6..3a99d643419 100644
--- a/src/mongo/util/concurrency/ticketholder.cpp
+++ b/src/mongo/util/concurrency/ticketholder.cpp
@@ -96,7 +96,8 @@ 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();
diff --git a/src/mongo/util/debugger.cpp b/src/mongo/util/debugger.cpp
index 933af392b12..9682c54db14 100644
--- a/src/mongo/util/debugger.cpp
+++ b/src/mongo/util/debugger.cpp
@@ -34,8 +34,8 @@
#include <cstdlib>
#if defined(USE_GDBSERVER)
-#include <unistd.h>
#include <cstdio>
+#include <unistd.h>
#endif
#ifndef _WIN32
diff --git a/src/mongo/util/descriptive_stats-inl.h b/src/mongo/util/descriptive_stats-inl.h
index 1ae73134063..41746b354fc 100644
--- a/src/mongo/util/descriptive_stats-inl.h
+++ b/src/mongo/util/descriptive_stats-inl.h
@@ -67,8 +67,7 @@ void BasicEstimators<Sample>::appendBasicToBSONObjBuilder(BSONObjBuilder& b) con
}
template <std::size_t NumQuantiles>
-DistributionEstimators<NumQuantiles>::DistributionEstimators()
- : _count(0) {
+DistributionEstimators<NumQuantiles>::DistributionEstimators() : _count(0) {
for (std::size_t i = 0; i < NumMarkers; i++) {
_actual_positions[i] = i + 1;
}
diff --git a/src/mongo/util/duration.h b/src/mongo/util/duration.h
index 97c67ba04e4..353cb1fca9f 100644
--- a/src/mongo/util/duration.h
+++ b/src/mongo/util/duration.h
@@ -219,8 +219,7 @@ public:
typename Rep2,
stdx::enable_if_t<std::is_convertible<Rep2, rep>::value && std::is_integral<Rep2>::value,
int> = 0>
- constexpr explicit Duration(const Rep2& r)
- : _count(r) {
+ constexpr explicit Duration(const Rep2& r) : _count(r) {
static_assert(std::is_signed<Rep2>::value || sizeof(Rep2) < sizeof(rep),
"Durations must be constructed from values of integral type that are "
"representable as 64-bit signed integers");
diff --git a/src/mongo/util/duration_test.cpp b/src/mongo/util/duration_test.cpp
index 95501cc5d95..aac33feec99 100644
--- a/src/mongo/util/duration_test.cpp
+++ b/src/mongo/util/duration_test.cpp
@@ -28,8 +28,8 @@
#include "mongo/platform/basic.h"
#include "mongo/stdx/chrono.h"
-#include "mongo/util/duration.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/duration.h"
namespace mongo {
namespace {
diff --git a/src/mongo/util/exception_filter_win32.cpp b/src/mongo/util/exception_filter_win32.cpp
index f24cbbe10c4..db09154229c 100644
--- a/src/mongo/util/exception_filter_win32.cpp
+++ b/src/mongo/util/exception_filter_win32.cpp
@@ -32,8 +32,8 @@
#include "mongo/platform/basic.h"
-#include <ostream>
#include <DbgHelp.h>
+#include <ostream>
#include "mongo/config.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/util/fail_point_service.cpp b/src/mongo/util/fail_point_service.cpp
index 68bb4897286..a4766784df8 100644
--- a/src/mongo/util/fail_point_service.cpp
+++ b/src/mongo/util/fail_point_service.cpp
@@ -42,9 +42,8 @@ MONGO_INITIALIZER(FailPointRegistry)(InitializerContext* context) {
return Status::OK();
}
-MONGO_INITIALIZER_GENERAL(AllFailPointsRegistered,
- MONGO_NO_PREREQUISITES,
- MONGO_NO_DEPENDENTS)(InitializerContext* context) {
+MONGO_INITIALIZER_GENERAL(AllFailPointsRegistered, MONGO_NO_PREREQUISITES, MONGO_NO_DEPENDENTS)
+(InitializerContext* context) {
_fpRegistry->freeze();
return Status::OK();
}
diff --git a/src/mongo/util/file.cpp b/src/mongo/util/file.cpp
index bcb4b74e989..1d55b4d51b6 100644
--- a/src/mongo/util/file.cpp
+++ b/src/mongo/util/file.cpp
@@ -136,10 +136,14 @@ void File::read(fileofs o, char* data, unsigned len) {
} else if (bytesRead != len) {
_bad = true;
msgasserted(10438,
- mongoutils::str::stream()
- << "In File::read(), ReadFile for '" << _name << "' read " << bytesRead
- << " bytes while trying to read " << len << " bytes starting at offset "
- << o << ", truncated file?");
+ mongoutils::str::stream() << "In File::read(), ReadFile for '" << _name
+ << "' read "
+ << bytesRead
+ << " bytes while trying to read "
+ << len
+ << " bytes starting at offset "
+ << o
+ << ", truncated file?");
}
}
@@ -259,10 +263,14 @@ void File::read(fileofs o, char* data, unsigned len) {
} else if (bytesRead != static_cast<ssize_t>(len)) {
_bad = true;
msgasserted(16569,
- mongoutils::str::stream()
- << "In File::read(), ::pread for '" << _name << "' read " << bytesRead
- << " bytes while trying to read " << len << " bytes starting at offset "
- << o << ", truncated file?");
+ mongoutils::str::stream() << "In File::read(), ::pread for '" << _name
+ << "' read "
+ << bytesRead
+ << " bytes while trying to read "
+ << len
+ << " bytes starting at offset "
+ << o
+ << ", truncated file?");
}
}
diff --git a/src/mongo/util/intrusive_counter.cpp b/src/mongo/util/intrusive_counter.cpp
index 8a10384cfb3..75c3b0f0acc 100644
--- a/src/mongo/util/intrusive_counter.cpp
+++ b/src/mongo/util/intrusive_counter.cpp
@@ -39,7 +39,8 @@ using namespace mongoutils;
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/intrusive_counter.h b/src/mongo/util/intrusive_counter.h
index 1b1ce182b90..76c1bee5a78 100644
--- a/src/mongo/util/intrusive_counter.h
+++ b/src/mongo/util/intrusive_counter.h
@@ -31,9 +31,9 @@
#include <boost/intrusive_ptr.hpp>
#include <stdlib.h>
-#include "mongo/platform/atomic_word.h"
#include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h"
+#include "mongo/platform/atomic_word.h"
#include "mongo/util/allocator.h"
namespace mongo {
diff --git a/src/mongo/util/itoa_test.cpp b/src/mongo/util/itoa_test.cpp
index abf0a2fbf45..ba363249e00 100644
--- a/src/mongo/util/itoa_test.cpp
+++ b/src/mongo/util/itoa_test.cpp
@@ -28,9 +28,9 @@
#include "mongo/platform/basic.h"
+#include <array>
#include <cstdint>
#include <limits>
-#include <array>
#include "mongo/base/string_data.h"
#include "mongo/unittest/unittest.h"
diff --git a/src/mongo/util/log.cpp b/src/mongo/util/log.cpp
index b3c130bf264..86c70d27f66 100644
--- a/src/mongo/util/log.cpp
+++ b/src/mongo/util/log.cpp
@@ -40,8 +40,8 @@
#include "mongo/logger/ramlog.h"
#include "mongo/logger/rotatable_file_manager.h"
#include "mongo/util/assert_util.h"
-#include "mongo/util/concurrency/threadlocal.h"
#include "mongo/util/concurrency/thread_name.h"
+#include "mongo/util/concurrency/threadlocal.h"
#include "mongo/util/stacktrace.h"
#include "mongo/util/text.h"
#include "mongo/util/time_support.h"
diff --git a/src/mongo/util/mongoutils/str.h b/src/mongo/util/mongoutils/str.h
index 561bf20008c..2aefea6f261 100644
--- a/src/mongo/util/mongoutils/str.h
+++ b/src/mongo/util/mongoutils/str.h
@@ -36,8 +36,8 @@
* TODO: Retire the mongoutils namespace, and move str under the mongo namespace.
*/
-#include <string>
#include <sstream>
+#include <string>
#include "mongo/bson/util/builder.h"
diff --git a/src/mongo/util/net/asio_message_port.cpp b/src/mongo/util/net/asio_message_port.cpp
index f2225bccec8..3f84cceb3be 100644
--- a/src/mongo/util/net/asio_message_port.cpp
+++ b/src/mongo/util/net/asio_message_port.cpp
@@ -317,7 +317,9 @@ bool ASIOMessagingPort::recv(Message& m) {
LOG(_logLevel) << httpMsg;
std::stringstream ss;
ss << "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: "
- "text/plain\r\nContent-Length: " << httpMsg.size() << "\r\n\r\n" << httpMsg;
+ "text/plain\r\nContent-Length: "
+ << httpMsg.size() << "\r\n\r\n"
+ << httpMsg;
auto s = ss.str();
send(s.c_str(), s.size(), nullptr);
return false;
diff --git a/src/mongo/util/net/hostandport.cpp b/src/mongo/util/net/hostandport.cpp
index ea1d0f93467..36106ac83fa 100644
--- a/src/mongo/util/net/hostandport.cpp
+++ b/src/mongo/util/net/hostandport.cpp
@@ -36,8 +36,8 @@
#include "mongo/base/string_data.h"
#include "mongo/bson/util/builder.h"
#include "mongo/db/server_options.h"
-#include "mongo/util/mongoutils/str.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -127,7 +127,8 @@ Status HostAndPort::initialize(StringData s) {
} 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,
@@ -142,7 +143,8 @@ Status HostAndPort::initialize(StringData s) {
if (hostPart.empty()) {
return Status(ErrorCodes::FailedToParse,
str::stream() << "Empty host component parsing HostAndPort from \""
- << escape(s.toString()) << "\"");
+ << escape(s.toString())
+ << "\"");
}
int port;
@@ -156,7 +158,8 @@ Status HostAndPort::initialize(StringData s) {
return Status(ErrorCodes::FailedToParse,
str::stream() << "Port number " << port
<< " out of range parsing HostAndPort from \""
- << escape(s.toString()) << "\"");
+ << escape(s.toString())
+ << "\"");
}
} else {
port = -1;
diff --git a/src/mongo/util/net/hostname_canonicalization.cpp b/src/mongo/util/net/hostname_canonicalization.cpp
index d76cfb28b05..5dfc69d6ba4 100644
--- a/src/mongo/util/net/hostname_canonicalization.cpp
+++ b/src/mongo/util/net/hostname_canonicalization.cpp
@@ -34,10 +34,10 @@
#if !defined(_WIN32)
#include <arpa/inet.h>
+#include <netdb.h>
#include <netinet/in.h>
-#include <sys/types.h>
#include <sys/socket.h>
-#include <netdb.h>
+#include <sys/types.h>
#endif
#include "mongo/util/log.h"
diff --git a/src/mongo/util/net/listen.cpp b/src/mongo/util/net/listen.cpp
index 2cbee476522..a5f80406f1b 100644
--- a/src/mongo/util/net/listen.cpp
+++ b/src/mongo/util/net/listen.cpp
@@ -56,14 +56,14 @@
#include <sys/resource.h>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
#ifdef __OpenBSD__
#include <sys/uio.h>
#endif
@@ -323,7 +323,8 @@ void Listener::initAndListen() {
if (x == EMFILE || x == ENFILE) {
// Connection still in listen queue but we can't accept it yet
error() << "Out of file descriptors. Waiting one second before trying to "
- "accept more connections." << warnings;
+ "accept more connections."
+ << warnings;
sleepsecs(1);
}
}
@@ -545,7 +546,8 @@ void Listener::initAndListen() {
if (x == EMFILE || x == ENFILE) {
// Connection still in listen queue but we can't accept it yet
error() << "Out of file descriptors. Waiting one second before"
- " trying to accept more connections." << warnings;
+ " trying to accept more connections."
+ << warnings;
sleepsecs(1);
}
}
diff --git a/src/mongo/util/net/message.cpp b/src/mongo/util/net/message.cpp
index 9c91ce0d124..11736ac1821 100644
--- a/src/mongo/util/net/message.cpp
+++ b/src/mongo/util/net/message.cpp
@@ -31,8 +31,8 @@
#include "mongo/util/net/message.h"
-#include <fcntl.h>
#include <errno.h>
+#include <fcntl.h>
#include <time.h>
#include "mongo/util/net/listen.h"
diff --git a/src/mongo/util/net/message_port.cpp b/src/mongo/util/net/message_port.cpp
index 225dfd06940..69e33377e59 100644
--- a/src/mongo/util/net/message_port.cpp
+++ b/src/mongo/util/net/message_port.cpp
@@ -143,7 +143,9 @@ bool MessagingPort::recv(Message& m) {
LOG(_psock->getLogLevel()) << msg;
std::stringstream ss;
ss << "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: "
- "text/plain\r\nContent-Length: " << msg.size() << "\r\n\r\n" << msg;
+ "text/plain\r\nContent-Length: "
+ << msg.size() << "\r\n\r\n"
+ << msg;
string s = ss.str();
send(s.c_str(), s.size(), "http");
return false;
diff --git a/src/mongo/util/net/sock.cpp b/src/mongo/util/net/sock.cpp
index c0c526a0b22..9c04caef048 100644
--- a/src/mongo/util/net/sock.cpp
+++ b/src/mongo/util/net/sock.cpp
@@ -34,14 +34,14 @@
#include "mongo/util/net/sock.h"
#if !defined(_WIN32)
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
#if defined(__OpenBSD__)
#include <sys/uio.h>
#endif
@@ -54,8 +54,8 @@
#include "mongo/util/debug_util.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/hex.h"
-#include "mongo/util/mongoutils/str.h"
#include "mongo/util/log.h"
+#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/message.h"
#include "mongo/util/net/socket_exception.h"
#include "mongo/util/net/socket_poll.h"
diff --git a/src/mongo/util/net/sock.h b/src/mongo/util/net/sock.h
index d607eb8051c..a9da4bdbbfb 100644
--- a/src/mongo/util/net/sock.h
+++ b/src/mongo/util/net/sock.h
@@ -33,10 +33,10 @@
#ifndef _WIN32
+#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
-#include <errno.h>
#ifdef __OpenBSD__
#include <sys/uio.h>
diff --git a/src/mongo/util/net/sockaddr.cpp b/src/mongo/util/net/sockaddr.cpp
index f16eb447f8b..00960f2fd97 100644
--- a/src/mongo/util/net/sockaddr.cpp
+++ b/src/mongo/util/net/sockaddr.cpp
@@ -33,14 +33,14 @@
#include "mongo/util/net/sockaddr.h"
#if !defined(_WIN32)
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/un.h>
#if defined(__OpenBSD__)
#include <sys/uio.h>
#endif
diff --git a/src/mongo/util/net/sockaddr.h b/src/mongo/util/net/sockaddr.h
index 046167e4196..4c52d3453f7 100644
--- a/src/mongo/util/net/sockaddr.h
+++ b/src/mongo/util/net/sockaddr.h
@@ -32,10 +32,10 @@
#ifndef _WIN32
+#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
-#include <errno.h>
#ifdef __OpenBSD__
#include <sys/uio.h>
diff --git a/src/mongo/util/net/ssl_manager.cpp b/src/mongo/util/net/ssl_manager.cpp
index a1e25a31ced..da090bde45d 100644
--- a/src/mongo/util/net/ssl_manager.cpp
+++ b/src/mongo/util/net/ssl_manager.cpp
@@ -851,9 +851,9 @@ Status importCertStoreToX509_STORE(LPWSTR storeName, DWORD storeLocation, X509_S
}
int lastError = GetLastError();
if (lastError != CRYPT_E_NOT_FOUND) {
- return {
- ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "Error enumerating certificates: " << errnoWithDescription(lastError)};
+ return {ErrorCodes::InvalidSSLConfiguration,
+ str::stream() << "Error enumerating certificates: "
+ << errnoWithDescription(lastError)};
}
return Status::OK();
@@ -902,9 +902,9 @@ Status importKeychainToX509_STORE(X509_STORE* verifyStore) {
auto rawData = makeCFTypeRefHolder(SecCertificateCopyData(cert));
if (!rawData) {
- return {
- ErrorCodes::InvalidSSLConfiguration,
- str::stream() << "Error enumerating certificates: " << OSStatusToString(status)};
+ return {ErrorCodes::InvalidSSLConfiguration,
+ str::stream() << "Error enumerating certificates: "
+ << OSStatusToString(status)};
}
const uint8_t* rawDataPtr = CFDataGetBytePtr(rawData);
@@ -934,11 +934,14 @@ Status SSLManager::_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()
+ << ")"};
}
return Status::OK();
#else
diff --git a/src/mongo/util/net/ssl_options.cpp b/src/mongo/util/net/ssl_options.cpp
index 452cf0507fb..8873ac3b021 100644
--- a/src/mongo/util/net/ssl_options.cpp
+++ b/src/mongo/util/net/ssl_options.cpp
@@ -36,18 +36,19 @@
#include "mongo/base/status.h"
#include "mongo/db/server_options.h"
#include "mongo/util/log.h"
-#include "mongo/util/text.h"
#include "mongo/util/options_parser/startup_options.h"
+#include "mongo/util/text.h"
namespace mongo {
using std::string;
Status addSSLServerOptions(moe::OptionSection* options) {
- options->addOptionChaining("net.ssl.sslOnNormalPorts",
- "sslOnNormalPorts",
- moe::Switch,
- "use ssl on configured ports")
+ options
+ ->addOptionChaining("net.ssl.sslOnNormalPorts",
+ "sslOnNormalPorts",
+ moe::Switch,
+ "use ssl on configured ports")
.setSources(moe::SourceAllLegacy)
.incompatibleWith("net.ssl.mode");
@@ -60,8 +61,9 @@ Status addSSLServerOptions(moe::OptionSection* options) {
options->addOptionChaining(
"net.ssl.PEMKeyFile", "sslPEMKeyFile", moe::String, "PEM file for ssl");
- options->addOptionChaining(
- "net.ssl.PEMKeyPassword", "sslPEMKeyPassword", moe::String, "PEM file password")
+ options
+ ->addOptionChaining(
+ "net.ssl.PEMKeyPassword", "sslPEMKeyPassword", moe::String, "PEM file password")
.setImplicit(moe::Value(std::string("")));
options->addOptionChaining("net.ssl.clusterFile",
@@ -69,10 +71,11 @@ Status addSSLServerOptions(moe::OptionSection* options) {
moe::String,
"Key file for internal SSL authentication");
- options->addOptionChaining("net.ssl.clusterPassword",
- "sslClusterPassword",
- moe::String,
- "Internal authentication key file password")
+ options
+ ->addOptionChaining("net.ssl.clusterPassword",
+ "sslClusterPassword",
+ moe::String,
+ "Internal authentication key file password")
.setImplicit(moe::Value(std::string("")));
options->addOptionChaining(
@@ -81,10 +84,12 @@ Status addSSLServerOptions(moe::OptionSection* options) {
options->addOptionChaining(
"net.ssl.CRLFile", "sslCRLFile", moe::String, "Certificate Revocation List file for SSL");
- options->addOptionChaining("net.ssl.sslCipherConfig",
- "sslCipherConfig",
- moe::String,
- "OpenSSL cipher configuration string").hidden();
+ options
+ ->addOptionChaining("net.ssl.sslCipherConfig",
+ "sslCipherConfig",
+ moe::String,
+ "OpenSSL cipher configuration string")
+ .hidden();
options->addOptionChaining(
"net.ssl.disabledProtocols",
@@ -123,36 +128,41 @@ Status addSSLServerOptions(moe::OptionSection* options) {
Status addSSLClientOptions(moe::OptionSection* options) {
options->addOptionChaining("ssl", "ssl", moe::Switch, "use SSL for all connections");
- options->addOptionChaining(
- "ssl.CAFile", "sslCAFile", moe::String, "Certificate Authority file for SSL")
+ options
+ ->addOptionChaining(
+ "ssl.CAFile", "sslCAFile", moe::String, "Certificate Authority file for SSL")
.requires("ssl");
- options->addOptionChaining(
- "ssl.PEMKeyFile", "sslPEMKeyFile", moe::String, "PEM certificate/key file for SSL")
+ options
+ ->addOptionChaining(
+ "ssl.PEMKeyFile", "sslPEMKeyFile", moe::String, "PEM certificate/key file for SSL")
.requires("ssl");
- options->addOptionChaining("ssl.PEMKeyPassword",
- "sslPEMKeyPassword",
- moe::String,
- "password for key in PEM file for SSL").requires("ssl");
+ options
+ ->addOptionChaining("ssl.PEMKeyPassword",
+ "sslPEMKeyPassword",
+ moe::String,
+ "password for key in PEM file for SSL")
+ .requires("ssl");
- options->addOptionChaining("ssl.CRLFile",
- "sslCRLFile",
- moe::String,
- "Certificate Revocation List file for SSL")
+ options
+ ->addOptionChaining(
+ "ssl.CRLFile", "sslCRLFile", moe::String, "Certificate Revocation List file for SSL")
.requires("ssl")
.requires("ssl.CAFile");
- options->addOptionChaining("net.ssl.allowInvalidHostnames",
- "sslAllowInvalidHostnames",
- moe::Switch,
- "allow connections to servers with non-matching hostnames")
+ options
+ ->addOptionChaining("net.ssl.allowInvalidHostnames",
+ "sslAllowInvalidHostnames",
+ moe::Switch,
+ "allow connections to servers with non-matching hostnames")
.requires("ssl");
- options->addOptionChaining("ssl.allowInvalidCertificates",
- "sslAllowInvalidCertificates",
- moe::Switch,
- "allow connections to servers with invalid certificates")
+ options
+ ->addOptionChaining("ssl.allowInvalidCertificates",
+ "sslAllowInvalidCertificates",
+ moe::Switch,
+ "allow connections to servers with invalid certificates")
.requires("ssl");
options->addOptionChaining(
diff --git a/src/mongo/util/ntservice.cpp b/src/mongo/util/ntservice.cpp
index 43028bf50e0..81ff20e3e17 100644
--- a/src/mongo/util/ntservice.cpp
+++ b/src/mongo/util/ntservice.cpp
@@ -78,8 +78,10 @@ bool shouldStartService() {
return _startService;
}
-static DWORD WINAPI
-serviceCtrl(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext);
+static DWORD WINAPI serviceCtrl(DWORD dwControl,
+ DWORD dwEventType,
+ LPVOID lpEventData,
+ LPVOID lpContext);
void configureService(ServiceCallback serviceCallback,
const moe::Environment& params,
@@ -586,8 +588,10 @@ static void serviceShutdown(const char* controlCodeName) {
// Note: we will report exit status in initService
}
-static DWORD WINAPI
-serviceCtrl(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext) {
+static DWORD WINAPI serviceCtrl(DWORD dwControl,
+ DWORD dwEventType,
+ LPVOID lpEventData,
+ LPVOID lpContext) {
switch (dwControl) {
case SERVICE_CONTROL_INTERROGATE:
// Return NO_ERROR per MSDN even though we do nothing for this control code.
diff --git a/src/mongo/util/options_parser/environment_test.cpp b/src/mongo/util/options_parser/environment_test.cpp
index e87267c013e..b5b7b774b1c 100644
--- a/src/mongo/util/options_parser/environment_test.cpp
+++ b/src/mongo/util/options_parser/environment_test.cpp
@@ -27,9 +27,9 @@
#include "mongo/bson/util/builder.h"
+#include "mongo/unittest/unittest.h"
#include "mongo/util/options_parser/constraints.h"
#include "mongo/util/options_parser/environment.h"
-#include "mongo/unittest/unittest.h"
namespace {
@@ -146,7 +146,9 @@ TEST(ToBSONTests, DottedValues) {
ASSERT_OK(environment.set(moe::Key("val2"), moe::Value(true)));
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);
+ << "string")
+ << "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_EQUALS(obj, environment.toBSON());
@@ -161,9 +163,12 @@ 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);
+ << "string")
+ << "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_EQUALS(obj, environment.toBSON());
diff --git a/src/mongo/util/options_parser/options_parser.cpp b/src/mongo/util/options_parser/options_parser.cpp
index ff2bcb49a16..5535533a3a8 100644
--- a/src/mongo/util/options_parser/options_parser.cpp
+++ b/src/mongo/util/options_parser/options_parser.cpp
@@ -29,8 +29,8 @@
#include "mongo/util/options_parser/options_parser.h"
-#include <boost/program_options.hpp>
#include <algorithm>
+#include <boost/program_options.hpp>
#include <cerrno>
#include <fstream>
#include <stdio.h>
@@ -40,8 +40,8 @@
#include "mongo/base/status.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/json.h"
-#include "mongo/util/mongoutils/str.h"
#include "mongo/util/log.h"
+#include "mongo/util/mongoutils/str.h"
#include "mongo/util/options_parser/constraints.h"
#include "mongo/util/options_parser/environment.h"
#include "mongo/util/options_parser/option_description.h"
diff --git a/src/mongo/util/options_parser/options_parser_test.cpp b/src/mongo/util/options_parser/options_parser_test.cpp
index 79de691ea17..dba5910d395 100644
--- a/src/mongo/util/options_parser/options_parser_test.cpp
+++ b/src/mongo/util/options_parser/options_parser_test.cpp
@@ -205,8 +205,8 @@ TEST(Registration, ComposableWithImplicit) {
try {
std::vector<std::string> implicitVal;
implicitVal.push_back("implicit");
- testOpts.addOptionChaining(
- "setParameter", "setParameter", moe::StringVector, "Multiple Values")
+ testOpts
+ .addOptionChaining("setParameter", "setParameter", moe::StringVector, "Multiple Values")
.setImplicit(moe::Value(implicitVal))
.composing();
FAIL("Was able to register composable option with implicit value");
@@ -216,8 +216,8 @@ TEST(Registration, ComposableWithImplicit) {
try {
std::vector<std::string> implicitVal;
implicitVal.push_back("implicit");
- testOpts.addOptionChaining(
- "setParameter", "setParameter", moe::StringVector, "Multiple Values")
+ testOpts
+ .addOptionChaining("setParameter", "setParameter", moe::StringVector, "Multiple Values")
.composing()
.setImplicit(moe::Value(implicitVal));
FAIL("Was able to set implicit value on composable option");
@@ -230,8 +230,8 @@ TEST(Registration, ComposableWithDefault) {
try {
std::vector<std::string> defaultVal;
defaultVal.push_back("default");
- testOpts.addOptionChaining(
- "setParameter", "setParameter", moe::StringVector, "Multiple Values")
+ testOpts
+ .addOptionChaining("setParameter", "setParameter", moe::StringVector, "Multiple Values")
.setDefault(moe::Value(defaultVal))
.composing();
FAIL("Was able to register composable option with default value");
@@ -241,8 +241,8 @@ TEST(Registration, ComposableWithDefault) {
try {
std::vector<std::string> defaultVal;
defaultVal.push_back("default");
- testOpts.addOptionChaining(
- "setParameter", "setParameter", moe::StringVector, "Multiple Values")
+ testOpts
+ .addOptionChaining("setParameter", "setParameter", moe::StringVector, "Multiple Values")
.composing()
.setDefault(moe::Value(defaultVal));
FAIL("Was able to set default value on composable option");
@@ -867,8 +867,9 @@ TEST(Style, Verbosity) {
/* support for -vv -vvvv etc. */
for (std::string s = "vv"; s.length() <= 12; s.append("v")) {
- testOpts.addOptionChaining(
- s.c_str(), s.c_str(), moe::Switch, "higher verbosity levels (hidden)")
+ testOpts
+ .addOptionChaining(
+ s.c_str(), s.c_str(), moe::Switch, "higher verbosity levels (hidden)")
.hidden();
}
@@ -3782,8 +3783,7 @@ TEST(YAMLConfigFile, DeprecatedDottedNameMultipleDeprecated) {
std::map<std::string, std::string> env_map;
std::stringstream ss;
- ss << deprecatedDottedNames[0] << ": 6" << std::endl
- << deprecatedDottedNames[1] << ": 7";
+ ss << deprecatedDottedNames[0] << ": 6" << std::endl << deprecatedDottedNames[1] << ": 7";
parser.setConfig("config.yaml", ss.str());
ASSERT_NOT_OK(parser.run(testOpts, argv, env_map, &environment));
diff --git a/src/mongo/util/platform_init.cpp b/src/mongo/util/platform_init.cpp
index fa34f7a820d..3ececf3eb0f 100644
--- a/src/mongo/util/platform_init.cpp
+++ b/src/mongo/util/platform_init.cpp
@@ -31,10 +31,10 @@
#include "mongo/platform/basic.h"
#ifdef _WIN32
-#include <mmsystem.h>
#include <crtdbg.h>
-#include <stdlib.h>
+#include <mmsystem.h>
#include <stdio.h>
+#include <stdlib.h>
#endif
#include "mongo/base/init.h"
diff --git a/src/mongo/util/processinfo.cpp b/src/mongo/util/processinfo.cpp
index baaa874eaff..434b2e766cb 100644
--- a/src/mongo/util/processinfo.cpp
+++ b/src/mongo/util/processinfo.cpp
@@ -34,8 +34,8 @@
#include "mongo/base/init.h"
#include "mongo/util/processinfo.h"
-#include <iostream>
#include <fstream>
+#include <iostream>
#include "mongo/util/log.h"
@@ -89,9 +89,8 @@ void ProcessInfo::initializeSystemInfo() {
* We need this get the system page size for the secure allocator, which the enterprise modules need
* for storage for command line parameters.
*/
-MONGO_INITIALIZER_GENERAL(SystemInfo,
- MONGO_NO_PREREQUISITES,
- MONGO_NO_DEPENDENTS)(InitializerContext* context) {
+MONGO_INITIALIZER_GENERAL(SystemInfo, MONGO_NO_PREREQUISITES, MONGO_NO_DEPENDENTS)
+(InitializerContext* context) {
ProcessInfo::initializeSystemInfo();
return Status::OK();
}
diff --git a/src/mongo/util/processinfo_freebsd.cpp b/src/mongo/util/processinfo_freebsd.cpp
index f335addfd9e..d8a8d5edce7 100644
--- a/src/mongo/util/processinfo_freebsd.cpp
+++ b/src/mongo/util/processinfo_freebsd.cpp
@@ -41,8 +41,8 @@
#include <unistd.h>
#include <vm/vm_param.h>
-#include "mongo/util/scopeguard.h"
#include "mongo/util/log.h"
+#include "mongo/util/scopeguard.h"
#include "processinfo.h"
using namespace std;
diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
index 4bebeb5189c..c831e135f0d 100644
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -29,25 +29,25 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kControl
-#include <malloc.h>
#include <iostream>
+#include <malloc.h>
#include <sched.h>
#include <stdio.h>
-#include <unistd.h>
#include <sys/mman.h>
#include <sys/utsname.h>
+#include <unistd.h>
#ifdef __UCLIBC__
#include <features.h>
#else
#include <gnu/libc-version.h>
#endif
-#include "processinfo.h"
#include "boost/filesystem.hpp"
+#include "mongo/util/log.h"
+#include "processinfo.h"
#include <boost/none.hpp>
#include <boost/optional.hpp>
#include <mongo/util/file.h>
-#include "mongo/util/log.h"
using namespace std;
diff --git a/src/mongo/util/processinfo_openbsd.cpp b/src/mongo/util/processinfo_openbsd.cpp
index 7bbd2a15c2d..8974dbb6ea8 100644
--- a/src/mongo/util/processinfo_openbsd.cpp
+++ b/src/mongo/util/processinfo_openbsd.cpp
@@ -40,8 +40,8 @@
#include <sys/vmmeter.h>
#include <unistd.h>
-#include "mongo/util/scopeguard.h"
#include "mongo/util/log.h"
+#include "mongo/util/scopeguard.h"
#include "processinfo.h"
using namespace std;
diff --git a/src/mongo/util/processinfo_osx.cpp b/src/mongo/util/processinfo_osx.cpp
index f15601c5390..ad0c8f7d99d 100644
--- a/src/mongo/util/processinfo_osx.cpp
+++ b/src/mongo/util/processinfo_osx.cpp
@@ -34,19 +34,19 @@
#include <boost/none.hpp>
#include <boost/optional.hpp>
-#include <mach/vm_statistics.h>
-#include <mach/task_info.h>
-#include <mach/mach_init.h>
+#include <iostream>
#include <mach/mach_host.h>
+#include <mach/mach_init.h>
#include <mach/mach_traps.h>
+#include <mach/shared_region.h>
#include <mach/task.h>
+#include <mach/task_info.h>
#include <mach/vm_map.h>
-#include <mach/shared_region.h>
-#include <iostream>
+#include <mach/vm_statistics.h>
-#include <sys/types.h>
#include <sys/mman.h>
#include <sys/sysctl.h>
+#include <sys/types.h>
#include "mongo/db/jsobj.h"
#include "mongo/util/log.h"
diff --git a/src/mongo/util/processinfo_solaris.cpp b/src/mongo/util/processinfo_solaris.cpp
index 6fa36cf48ca..53fda06efad 100644
--- a/src/mongo/util/processinfo_solaris.cpp
+++ b/src/mongo/util/processinfo_solaris.cpp
@@ -70,15 +70,15 @@ struct ProcPsinfo {
ProcPsinfo() {
FILE* f = fopen("/proc/self/psinfo", "r");
massert(16846,
- mongoutils::str::stream()
- << "couldn't open \"/proc/self/psinfo\": " << errnoWithDescription(),
+ mongoutils::str::stream() << "couldn't open \"/proc/self/psinfo\": "
+ << errnoWithDescription(),
f);
size_t num = fread(&psinfo, sizeof(psinfo), 1, f);
int err = errno;
fclose(f);
massert(16847,
- mongoutils::str::stream()
- << "couldn't read from \"/proc/self/psinfo\": " << errnoWithDescription(err),
+ mongoutils::str::stream() << "couldn't read from \"/proc/self/psinfo\": "
+ << errnoWithDescription(err),
num == 1);
}
psinfo_t psinfo;
@@ -88,15 +88,15 @@ struct ProcUsage {
ProcUsage() {
FILE* f = fopen("/proc/self/usage", "r");
massert(16848,
- mongoutils::str::stream()
- << "couldn't open \"/proc/self/usage\": " << errnoWithDescription(),
+ mongoutils::str::stream() << "couldn't open \"/proc/self/usage\": "
+ << errnoWithDescription(),
f);
size_t num = fread(&prusage, sizeof(prusage), 1, f);
int err = errno;
fclose(f);
massert(16849,
- mongoutils::str::stream()
- << "couldn't read from \"/proc/self/usage\": " << errnoWithDescription(err),
+ mongoutils::str::stream() << "couldn't read from \"/proc/self/usage\": "
+ << errnoWithDescription(err),
num == 1);
}
prusage_t prusage;
diff --git a/src/mongo/util/processinfo_test.cpp b/src/mongo/util/processinfo_test.cpp
index f84e7a38c35..76f7e7ee551 100644
--- a/src/mongo/util/processinfo_test.cpp
+++ b/src/mongo/util/processinfo_test.cpp
@@ -32,8 +32,8 @@
#include <iostream>
#include <vector>
-#include "mongo/util/processinfo.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/processinfo.h"
using mongo::ProcessInfo;
using boost::optional;
diff --git a/src/mongo/util/processinfo_windows.cpp b/src/mongo/util/processinfo_windows.cpp
index 7fa9a7e3943..0e9cb8cc578 100644
--- a/src/mongo/util/processinfo_windows.cpp
+++ b/src/mongo/util/processinfo_windows.cpp
@@ -37,8 +37,8 @@
#include <iostream>
#include <psapi.h>
-#include "mongo/util/processinfo.h"
#include "mongo/util/log.h"
+#include "mongo/util/processinfo.h"
using namespace std;
using std::unique_ptr;
diff --git a/src/mongo/util/progress_meter_test.cpp b/src/mongo/util/progress_meter_test.cpp
index 7dbada064d0..619f754e9ee 100644
--- a/src/mongo/util/progress_meter_test.cpp
+++ b/src/mongo/util/progress_meter_test.cpp
@@ -28,8 +28,8 @@
#include "mongo/platform/basic.h"
-#include "mongo/util/progress_meter.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/progress_meter.h"
namespace {
diff --git a/src/mongo/util/safe_num-inl.h b/src/mongo/util/safe_num-inl.h
index f60ade9f9f9..8015a600760 100644
--- a/src/mongo/util/safe_num-inl.h
+++ b/src/mongo/util/safe_num-inl.h
@@ -70,7 +70,7 @@ inline SafeNum SafeNum::operator+(const SafeNum& rhs) const {
}
inline SafeNum& SafeNum::operator+=(const SafeNum& rhs) {
- return * this = addInternal(*this, rhs);
+ return *this = addInternal(*this, rhs);
}
inline SafeNum SafeNum::operator*(const SafeNum& rhs) const {
@@ -78,7 +78,7 @@ inline SafeNum SafeNum::operator*(const SafeNum& rhs) const {
}
inline SafeNum& SafeNum::operator*=(const SafeNum& rhs) {
- return * this = mulInternal(*this, rhs);
+ return *this = mulInternal(*this, rhs);
}
inline SafeNum SafeNum::bitAnd(const SafeNum& rhs) const {
@@ -90,7 +90,7 @@ inline SafeNum SafeNum::operator&(const SafeNum& rhs) const {
}
inline SafeNum& SafeNum::operator&=(const SafeNum& rhs) {
- return * this = bitAnd(rhs);
+ return *this = bitAnd(rhs);
}
inline SafeNum SafeNum::bitOr(const SafeNum& rhs) const {
@@ -102,7 +102,7 @@ inline SafeNum SafeNum::operator|(const SafeNum& rhs) const {
}
inline SafeNum& SafeNum::operator|=(const SafeNum& rhs) {
- return * this = bitOr(rhs);
+ return *this = bitOr(rhs);
}
inline SafeNum SafeNum::bitXor(const SafeNum& rhs) const {
@@ -114,7 +114,7 @@ inline SafeNum SafeNum::operator^(const SafeNum& rhs) const {
}
inline SafeNum& SafeNum::operator^=(const SafeNum& rhs) {
- return * this = bitXor(rhs);
+ return *this = bitXor(rhs);
}
inline bool SafeNum::isValid() const {
diff --git a/src/mongo/util/safe_num_test.cpp b/src/mongo/util/safe_num_test.cpp
index 4086729e9c6..57b30efb807 100644
--- a/src/mongo/util/safe_num_test.cpp
+++ b/src/mongo/util/safe_num_test.cpp
@@ -30,11 +30,11 @@
#include "mongo/platform/basic.h"
#undef MONGO_PCH_WHITELISTED // for malloc/realloc pulled from bson
-#include "mongo/bson/bsontypes.h"
#include "mongo/bson/bsonobj.h"
+#include "mongo/bson/bsontypes.h"
#include "mongo/platform/decimal128.h"
-#include "mongo/util/safe_num.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/safe_num.h"
namespace {
diff --git a/src/mongo/util/signal_handlers_synchronous.cpp b/src/mongo/util/signal_handlers_synchronous.cpp
index fa383d97800..2f8996b3c36 100644
--- a/src/mongo/util/signal_handlers_synchronous.cpp
+++ b/src/mongo/util/signal_handlers_synchronous.cpp
@@ -36,8 +36,8 @@
#include <boost/exception/exception.hpp>
#include <csignal>
#include <exception>
-#include <iostream>
#include <fstream>
+#include <iostream>
#include <memory>
#include <streambuf>
#include <typeinfo>
diff --git a/src/mongo/util/signal_handlers_synchronous_test.cpp b/src/mongo/util/signal_handlers_synchronous_test.cpp
index f4104bafa16..51bc874f25a 100644
--- a/src/mongo/util/signal_handlers_synchronous_test.cpp
+++ b/src/mongo/util/signal_handlers_synchronous_test.cpp
@@ -31,11 +31,11 @@
#include "mongo/platform/basic.h"
#include <cmath>
-#include <cstdlib>
#include <csignal>
+#include <cstdlib>
-#include "mongo/unittest/unittest.h"
#include "mongo/unittest/death_test.h"
+#include "mongo/unittest/unittest.h"
#include "mongo/util/signal_handlers_synchronous.h"
namespace {
diff --git a/src/mongo/util/signal_win32.cpp b/src/mongo/util/signal_win32.cpp
index 95913067f7b..7407cfcb3e0 100644
--- a/src/mongo/util/signal_win32.cpp
+++ b/src/mongo/util/signal_win32.cpp
@@ -28,8 +28,8 @@
#include "mongo/platform/basic.h"
-#include <string>
#include "mongo/util/mongoutils/str.h"
+#include <string>
namespace mongo {
diff --git a/src/mongo/util/string_map_test.cpp b/src/mongo/util/string_map_test.cpp
index 60c888ca7af..5c0374e3cec 100644
--- a/src/mongo/util/string_map_test.cpp
+++ b/src/mongo/util/string_map_test.cpp
@@ -33,8 +33,8 @@
#include "mongo/platform/random.h"
#include "mongo/platform/unordered_map.h"
-#include "mongo/util/string_map.h"
#include "mongo/util/log.h"
+#include "mongo/util/string_map.h"
#include "mongo/util/timer.h"
namespace {
diff --git a/src/mongo/util/stringutils_test.cpp b/src/mongo/util/stringutils_test.cpp
index faabd5f5b8c..302fc5c3de3 100644
--- a/src/mongo/util/stringutils_test.cpp
+++ b/src/mongo/util/stringutils_test.cpp
@@ -29,8 +29,8 @@
#include "mongo/unittest/unittest.h"
-#include "mongo/util/stringutils.h"
#include "mongo/util/hex.h"
+#include "mongo/util/stringutils.h"
namespace mongo {
diff --git a/src/mongo/util/tcmalloc_set_parameter.cpp b/src/mongo/util/tcmalloc_set_parameter.cpp
index 951086ae4c1..130f77535cf 100644
--- a/src/mongo/util/tcmalloc_set_parameter.cpp
+++ b/src/mongo/util/tcmalloc_set_parameter.cpp
@@ -85,16 +85,18 @@ Status TcmallocNumericPropertyServerParameter::set(const BSONElement& newValueEl
return Status(ErrorCodes::TypeMismatch,
str::stream() << "Expected server parameter " << newValueElement.fieldName()
<< " 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 "
- << newValueElement.fieldName() << "; expected a value between 0 and "
+ return Status(
+ ErrorCodes::BadValue,
+ str::stream() << "Value " << newValueElement.toString(false) << " is out of range for "
+ << newValueElement.fieldName()
+ << "; expected a value between 0 and "
<< std::min<unsigned long long>(std::numeric_limits<size_t>::max(),
std::numeric_limits<long long>::max()));
}
@@ -128,7 +130,8 @@ TcmallocNumericPropertyServerParameter tcmallocAggressiveMemoryDecommit(
MONGO_INITIALIZER_GENERAL(TcmallocConfigurationDefaults,
("SystemInfo"),
- ("BeginStartupOptionHandling"))(InitializerContext*) {
+ ("BeginStartupOptionHandling"))
+(InitializerContext*) {
// Before processing the command line options, if the user has not specified a value in via
// the environment, set tcmalloc.max_total_thread_cache_bytes to its default value.
if (getenv("TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES")) {
diff --git a/src/mongo/util/text.cpp b/src/mongo/util/text.cpp
index edb5c1a50b9..f8282cfdccb 100644
--- a/src/mongo/util/text.cpp
+++ b/src/mongo/util/text.cpp
@@ -275,7 +275,8 @@ bool writeUtf8ToWindowsConsole(const char* utf8String, unsigned int utf8StringSi
if (!errorMessageShown) {
std::cout << "\n---\nUnicode text could not be correctly displayed.\n"
"Please change your console font to a Unicode font "
- "(e.g. Lucida Console).\n---\n" << std::endl;
+ "(e.g. Lucida Console).\n---\n"
+ << std::endl;
errorMessageShown = true;
}
// we can't display the text properly using a raster font,
diff --git a/src/mongo/util/text.h b/src/mongo/util/text.h
index 844f9cf2db5..08c87742bad 100644
--- a/src/mongo/util/text.h
+++ b/src/mongo/util/text.h
@@ -30,8 +30,8 @@
#pragma once
-#include <vector>
#include <string>
+#include <vector>
#include "mongo/base/disallow_copying.h"
#include "mongo/config.h"
diff --git a/src/mongo/util/time_support.cpp b/src/mongo/util/time_support.cpp
index b26e0a07361..22c943b0818 100644
--- a/src/mongo/util/time_support.cpp
+++ b/src/mongo/util/time_support.cpp
@@ -32,8 +32,8 @@
#include <boost/thread/tss.hpp>
#include <cstdint>
#include <cstdio>
-#include <string>
#include <iostream>
+#include <string>
#include "mongo/base/init.h"
#include "mongo/base/parse_number.h"
@@ -43,10 +43,10 @@
#include "mongo/util/mongoutils/str.h"
#ifdef _WIN32
-#include <boost/date_time/filetime_functions.hpp>
#include "mongo/util/concurrency/mutex.h"
#include "mongo/util/system_tick_source.h"
#include "mongo/util/timer.h"
+#include <boost/date_time/filetime_functions.hpp>
#endif
#ifdef __sun
@@ -379,7 +379,7 @@ Status parseMillisFromToken(StringData millisStr, int* resultMillis) {
millisMagnitude = 100;
}
- *resultMillis = *resultMillis* millisMagnitude;
+ *resultMillis = *resultMillis * millisMagnitude;
if (*resultMillis < 0 || *resultMillis > 1000) {
StringBuilder sb;
@@ -826,8 +826,8 @@ static unsigned long long resyncInterval = 0;
static SimpleMutex _curTimeMicros64ReadMutex;
static SimpleMutex _curTimeMicros64ResyncMutex;
-typedef WINBASEAPI VOID(WINAPI* pGetSystemTimePreciseAsFileTime)(_Out_ LPFILETIME
- lpSystemTimeAsFileTime);
+typedef WINBASEAPI VOID(WINAPI* pGetSystemTimePreciseAsFileTime)(
+ _Out_ LPFILETIME lpSystemTimeAsFileTime);
static pGetSystemTimePreciseAsFileTime GetSystemTimePreciseAsFileTimeFunc;
diff --git a/src/mongo/util/time_support.h b/src/mongo/util/time_support.h
index a445e9b6f47..df07e064dce 100644
--- a/src/mongo/util/time_support.h
+++ b/src/mongo/util/time_support.h
@@ -174,7 +174,7 @@ public:
template <typename Duration>
Date_t& operator-=(Duration d) {
- return * this += (-d);
+ return *this += (-d);
}
template <typename Duration>
diff --git a/src/mongo/util/unowned_ptr.h b/src/mongo/util/unowned_ptr.h
index fd7ef04157b..ecac433207f 100644
--- a/src/mongo/util/unowned_ptr.h
+++ b/src/mongo/util/unowned_ptr.h
@@ -58,20 +58,16 @@ struct unowned_ptr {
unowned_ptr(T* p) : _p(p) {}
template <typename U, typename = IfConvertibleFrom<U>>
- unowned_ptr(U* p)
- : _p(p) {}
+ unowned_ptr(U* p) : _p(p) {}
template <typename U, typename = IfConvertibleFrom<U>>
- unowned_ptr(const unowned_ptr<U>& p)
- : _p(p) {}
+ unowned_ptr(const unowned_ptr<U>& p) : _p(p) {}
template <typename U, typename = IfConvertibleFrom<U>>
- unowned_ptr(const std::unique_ptr<U>& p)
- : _p(p.get()) {}
+ unowned_ptr(const std::unique_ptr<U>& p) : _p(p.get()) {}
template <typename U, typename = IfConvertibleFrom<U>>
- unowned_ptr(const std::shared_ptr<U>& p)
- : _p(p.get()) {}
+ unowned_ptr(const std::shared_ptr<U>& p) : _p(p.get()) {}
//
// Modifiers
diff --git a/src/mongo/util/winutil.h b/src/mongo/util/winutil.h
index 5d4b727b111..a49fcc2f406 100644
--- a/src/mongo/util/winutil.h
+++ b/src/mongo/util/winutil.h
@@ -32,8 +32,8 @@
#pragma once
#if defined(_WIN32)
-#include <windows.h>
#include "text.h"
+#include <windows.h>
namespace mongo {