summaryrefslogtreecommitdiff
path: root/src/mongo/util/assert_util.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-04-23 15:02:29 -0400
committerBenety Goh <benety@mongodb.com>2018-04-23 15:02:50 -0400
commit2ca9e55b076d5bd117c44780ed7646b8b772d2d3 (patch)
tree8bc79f6f255435a36000b4f6c1d7932264357096 /src/mongo/util/assert_util.cpp
parent38487257b6b1d054619075641ec20d1aa79555d5 (diff)
downloadmongo-2ca9e55b076d5bd117c44780ed7646b8b772d2d3.tar.gz
SERVER-34364 qualify names from std namespace
Diffstat (limited to 'src/mongo/util/assert_util.cpp')
-rw-r--r--src/mongo/util/assert_util.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index 7ff79f092e0..5a85eb5b467 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -33,8 +33,6 @@
#include "mongo/util/assert_util.h"
-using namespace std;
-
#ifndef _WIN32
#include <cxxabi.h>
#include <sys/file.h>
@@ -77,31 +75,32 @@ AtomicBool DBException::traceExceptions(false);
void DBException::traceIfNeeded(const DBException& e) {
if (traceExceptions.load()) {
- warning() << "DBException thrown" << causedBy(e) << endl;
+ warning() << "DBException thrown" << causedBy(e) << std::endl;
printStackTrace();
}
}
NOINLINE_DECL void verifyFailed(const char* expr, const char* file, unsigned line) {
assertionCount.condrollover(++assertionCount.regular);
- error() << "Assertion failure " << expr << ' ' << file << ' ' << dec << line << endl;
+ error() << "Assertion failure " << expr << ' ' << file << ' ' << std::dec << line << std::endl;
logContext();
- stringstream temp;
+ std::stringstream temp;
temp << "assertion " << file << ":" << line;
breakpoint();
#if defined(MONGO_CONFIG_DEBUG_BUILD)
// this is so we notice in buildbot
- severe() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl;
+ severe() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n"
+ << std::endl;
std::abort();
#endif
error_details::throwExceptionForStatus(Status(ErrorCodes::UnknownError, temp.str()));
}
NOINLINE_DECL void invariantFailed(const char* expr, const char* file, unsigned line) noexcept {
- severe() << "Invariant failure " << expr << ' ' << file << ' ' << dec << line << endl;
+ severe() << "Invariant failure " << expr << ' ' << file << ' ' << std::dec << line << std::endl;
breakpoint();
- severe() << "\n\n***aborting after invariant() failure\n\n" << endl;
+ severe() << "\n\n***aborting after invariant() failure\n\n" << std::endl;
std::abort();
}
@@ -109,10 +108,10 @@ NOINLINE_DECL void invariantFailedWithMsg(const char* expr,
const std::string& msg,
const char* file,
unsigned line) noexcept {
- severe() << "Invariant failure " << expr << " " << msg << " " << file << ' ' << dec << line
- << endl;
+ severe() << "Invariant failure " << expr << " " << msg << " " << file << ' ' << std::dec << line
+ << std::endl;
breakpoint();
- severe() << "\n\n***aborting after invariant() failure\n\n" << endl;
+ severe() << "\n\n***aborting after invariant() failure\n\n" << std::endl;
std::abort();
}
@@ -121,9 +120,9 @@ NOINLINE_DECL void invariantOKFailed(const char* expr,
const char* file,
unsigned line) noexcept {
severe() << "Invariant failure: " << expr << " resulted in status " << redact(status) << " at "
- << file << ' ' << dec << line;
+ << file << ' ' << std::dec << line;
breakpoint();
- severe() << "\n\n***aborting after invariant() failure\n\n" << endl;
+ severe() << "\n\n***aborting after invariant() failure\n\n" << std::endl;
std::abort();
}
@@ -133,25 +132,25 @@ NOINLINE_DECL void invariantOKFailedWithMsg(const char* expr,
const char* file,
unsigned line) noexcept {
severe() << "Invariant failure: " << expr << " " << msg << " resulted in status "
- << redact(status) << " at " << file << ' ' << dec << line;
+ << redact(status) << " at " << file << ' ' << std::dec << line;
breakpoint();
- severe() << "\n\n***aborting after invariant() failure\n\n" << endl;
+ severe() << "\n\n***aborting after invariant() failure\n\n" << std::endl;
std::abort();
}
NOINLINE_DECL void fassertFailedWithLocation(int msgid, const char* file, unsigned line) noexcept {
- severe() << "Fatal Assertion " << msgid << " at " << file << " " << dec << line;
+ severe() << "Fatal Assertion " << msgid << " at " << file << " " << std::dec << line;
breakpoint();
- severe() << "\n\n***aborting after fassert() failure\n\n" << endl;
+ severe() << "\n\n***aborting after fassert() failure\n\n" << std::endl;
std::abort();
}
NOINLINE_DECL void fassertFailedNoTraceWithLocation(int msgid,
const char* file,
unsigned line) noexcept {
- severe() << "Fatal Assertion " << msgid << " at " << file << " " << dec << line;
+ severe() << "Fatal Assertion " << msgid << " at " << file << " " << std::dec << line;
breakpoint();
- severe() << "\n\n***aborting after fassert() failure\n\n" << endl;
+ severe() << "\n\n***aborting after fassert() failure\n\n" << std::endl;
quickExit(EXIT_ABRUPT);
}
@@ -159,10 +158,10 @@ MONGO_COMPILER_NORETURN void fassertFailedWithStatusWithLocation(int msgid,
const Status& status,
const char* file,
unsigned line) noexcept {
- severe() << "Fatal assertion " << msgid << " " << redact(status) << " at " << file << " " << dec
- << line;
+ severe() << "Fatal assertion " << msgid << " " << redact(status) << " at " << file << " "
+ << std::dec << line;
breakpoint();
- severe() << "\n\n***aborting after fassert() failure\n\n" << endl;
+ severe() << "\n\n***aborting after fassert() failure\n\n" << std::endl;
std::abort();
}
@@ -170,22 +169,22 @@ MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTraceWithLocation(int msgi
const Status& status,
const char* file,
unsigned line) noexcept {
- severe() << "Fatal assertion " << msgid << " " << redact(status) << " at " << file << " " << dec
- << line;
+ severe() << "Fatal assertion " << msgid << " " << redact(status) << " at " << file << " "
+ << std::dec << line;
breakpoint();
- severe() << "\n\n***aborting after fassert() failure\n\n" << endl;
+ severe() << "\n\n***aborting after fassert() failure\n\n" << std::endl;
quickExit(EXIT_ABRUPT);
}
NOINLINE_DECL void uassertedWithLocation(const Status& status, const char* file, unsigned line) {
assertionCount.condrollover(++assertionCount.user);
- LOG(1) << "User Assertion: " << redact(status) << ' ' << file << ' ' << dec << line;
+ LOG(1) << "User Assertion: " << redact(status) << ' ' << file << ' ' << std::dec << line;
error_details::throwExceptionForStatus(status);
}
NOINLINE_DECL void msgassertedWithLocation(const Status& status, const char* file, unsigned line) {
assertionCount.condrollover(++assertionCount.msg);
- error() << "Assertion: " << redact(status) << ' ' << file << ' ' << dec << line;
+ error() << "Assertion: " << redact(status) << ' ' << file << ' ' << std::dec << line;
error_details::throwExceptionForStatus(status);
}
@@ -218,7 +217,7 @@ std::string causedBy(const Status& e) {
return causedBy(e.toString());
}
-string demangleName(const type_info& typeinfo) {
+std::string demangleName(const std::type_info& typeinfo) {
#ifdef _WIN32
return typeinfo.name();
#else
@@ -228,7 +227,7 @@ string demangleName(const type_info& typeinfo) {
if (!niceName)
return typeinfo.name();
- string s = niceName;
+ std::string s = niceName;
free(niceName);
return s;
#endif