summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2016-06-12 09:33:35 -0400
committerAndrew Morrow <acm@mongodb.com>2016-06-13 15:29:10 -0400
commit642dda763795d7c62753e6e6391b30b1670612b4 (patch)
tree8e40cdd257d56f7495b2d60bc7da91289a7d7834
parent9fd6bc9fb1a9321447efa964b7568da740b23bcf (diff)
downloadmongo-642dda763795d7c62753e6e6391b30b1670612b4.tar.gz
SERVER-24530 Use invariant instead of verify in mutable bson
Also, mark the non-throwing termination points in assert_util noexcept
-rw-r--r--src/mongo/bson/mutable/document.cpp134
-rw-r--r--src/mongo/util/assert_util.cpp15
-rw-r--r--src/mongo/util/assert_util.h13
-rw-r--r--src/mongo/util/invariant.h4
4 files changed, 85 insertions, 81 deletions
diff --git a/src/mongo/bson/mutable/document.cpp b/src/mongo/bson/mutable/document.cpp
index 5ae92341217..da1486dcb24 100644
--- a/src/mongo/bson/mutable/document.cpp
+++ b/src/mongo/bson/mutable/document.cpp
@@ -497,8 +497,8 @@ uint32_t getElementOffset(const BSONObj& object, const BSONElement& elt) {
const ptrdiff_t offset = eltRaw - objRaw;
// BSON documents express their size as an int32_t so we should always be able to
// express the offset as a uint32_t.
- verify(offset > 0);
- verify(offset <= std::numeric_limits<int32_t>::max());
+ invariant(offset > 0);
+ invariant(offset <= std::numeric_limits<int32_t>::max());
return offset;
}
@@ -634,7 +634,7 @@ public:
if (id < kFastReps) {
return _fastElements[id] = defaultRep;
} else {
- verify(id <= Element::kMaxRepIdx);
+ invariant(id <= Element::kMaxRepIdx);
if (kDebugBuild && paranoid) {
// Force all reps to new addresses to help catch invalid rep usage.
@@ -683,7 +683,7 @@ public:
// Insert the given BSONObj and return an ID for it.
ElementRep::ObjIdx insertObject(const BSONObj& newObj) {
const size_t objIdx = _objects.size();
- verify(objIdx <= kMaxObjIdx);
+ invariant(objIdx <= kMaxObjIdx);
_objects.push_back(newObj);
if (kDebugBuild && paranoid) {
// Force reallocation to catch use after invalidation.
@@ -1088,9 +1088,9 @@ private:
};
Status Element::addSiblingLeft(Element e) {
- verify(ok());
- verify(e.ok());
- verify(_doc == e._doc);
+ invariant(ok());
+ invariant(e.ok());
+ invariant(_doc == e._doc);
Document::Impl& impl = getDocument().getImpl();
ElementRep& newRep = impl.getElementRep(e._repIdx);
@@ -1139,9 +1139,9 @@ Status Element::addSiblingLeft(Element e) {
}
Status Element::addSiblingRight(Element e) {
- verify(ok());
- verify(e.ok());
- verify(_doc == e._doc);
+ invariant(ok());
+ invariant(e.ok());
+ invariant(_doc == e._doc);
Document::Impl& impl = getDocument().getImpl();
ElementRep* newRep = &impl.getElementRep(e._repIdx);
@@ -1201,7 +1201,7 @@ Status Element::addSiblingRight(Element e) {
}
Status Element::remove() {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
// We need to realize any opaque right sibling, because we are going to need to set its
@@ -1249,7 +1249,7 @@ Status Element::remove() {
}
Status Element::rename(StringData newName) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
if (_repIdx == kRootRepIdx)
@@ -1302,7 +1302,7 @@ Status Element::rename(StringData newName) {
}
Element Element::leftChild() const {
- verify(ok());
+ invariant(ok());
// Capturing Document::Impl by non-const ref exploits the constness loophole
// created by our Impl so that we can let leftChild be lazily evaluated, even for a
@@ -1314,7 +1314,7 @@ Element Element::leftChild() const {
}
Element Element::rightChild() const {
- verify(ok());
+ invariant(ok());
// Capturing Document::Impl by non-const ref exploits the constness loophole
// created by our Impl so that we can let leftChild be lazily evaluated, even for a
@@ -1326,7 +1326,7 @@ Element Element::rightChild() const {
}
bool Element::hasChildren() const {
- verify(ok());
+ invariant(ok());
// Capturing Document::Impl by non-const ref exploits the constness loophole
// created by our Impl so that we can let leftChild be lazily evaluated, even for a
// const Element.
@@ -1335,7 +1335,7 @@ bool Element::hasChildren() const {
}
Element Element::leftSibling(size_t distance) const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
Element::RepIdx current = _repIdx;
while ((current != kInvalidRepIdx) && (distance-- != 0)) {
@@ -1346,7 +1346,7 @@ Element Element::leftSibling(size_t distance) const {
}
Element Element::rightSibling(size_t distance) const {
- verify(ok());
+ invariant(ok());
// Capturing Document::Impl by non-const ref exploits the constness loophole
// created by our Impl so that we can let rightSibling be lazily evaluated, even for a
@@ -1359,7 +1359,7 @@ Element Element::rightSibling(size_t distance) const {
}
Element Element::parent() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const Element::RepIdx parentIdx = impl.getElementRep(_repIdx).parent;
dassert(parentIdx != kOpaqueRepIdx);
@@ -1367,7 +1367,7 @@ Element Element::parent() const {
}
Element Element::findNthChild(size_t n) const {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = _doc->getImpl();
Element::RepIdx current = _repIdx;
current = impl.resolveLeftChild(current);
@@ -1377,7 +1377,7 @@ Element Element::findNthChild(size_t n) const {
}
Element Element::findFirstChildNamed(StringData name) const {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = _doc->getImpl();
Element::RepIdx current = _repIdx;
current = impl.resolveLeftChild(current);
@@ -1388,7 +1388,7 @@ Element Element::findFirstChildNamed(StringData name) const {
}
Element Element::findElementNamed(StringData name) const {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = _doc->getImpl();
Element::RepIdx current = _repIdx;
while ((current != kInvalidRepIdx) && (impl.getFieldName(impl.getElementRep(current)) != name))
@@ -1397,7 +1397,7 @@ Element Element::findElementNamed(StringData name) const {
}
size_t Element::countSiblingsLeft() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
Element::RepIdx current = _repIdx;
size_t result = 0;
@@ -1412,7 +1412,7 @@ size_t Element::countSiblingsLeft() const {
}
size_t Element::countSiblingsRight() const {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = _doc->getImpl();
Element::RepIdx current = _repIdx;
size_t result = 0;
@@ -1426,7 +1426,7 @@ size_t Element::countSiblingsRight() const {
}
size_t Element::countChildren() const {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = _doc->getImpl();
Element::RepIdx current = _repIdx;
current = impl.resolveLeftChild(current);
@@ -1439,14 +1439,14 @@ size_t Element::countChildren() const {
}
bool Element::hasValue() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
return impl.hasValue(thisRep);
}
bool Element::isNumeric() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const BSONType type = impl.getType(thisRep);
@@ -1455,7 +1455,7 @@ bool Element::isNumeric() const {
}
bool Element::isIntegral() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const BSONType type = impl.getType(thisRep);
@@ -1463,7 +1463,7 @@ bool Element::isIntegral() const {
}
const BSONElement Element::getValue() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
if (impl.hasValue(thisRep))
@@ -1489,8 +1489,8 @@ SafeNum Element::getValueSafeNum() const {
int Element::compareWithElement(const ConstElement& other,
bool considerFieldName,
const StringData::ComparatorInterface* comparator) const {
- verify(ok());
- verify(other.ok());
+ invariant(ok());
+ invariant(other.ok());
// Short circuit a tautological compare.
if ((_repIdx == other.getIdx()) && (_doc == &other.getDocument()))
@@ -1572,7 +1572,7 @@ int Element::compareWithElement(const ConstElement& other,
int Element::compareWithBSONElement(const BSONElement& other,
bool considerFieldName,
const StringData::ComparatorInterface* comparator) const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
@@ -1613,11 +1613,11 @@ int Element::compareWithBSONElement(const BSONElement& other,
int Element::compareWithBSONObj(const BSONObj& other,
bool considerFieldName,
const StringData::ComparatorInterface* comparator) const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
- verify(!impl.isLeaf(thisRep));
+ invariant(!impl.isLeaf(thisRep));
// We are dealing with either two objects, or two arrays. We need to consider the child
// elements individually. We walk two iterators forward over the children and compare
@@ -1643,10 +1643,10 @@ int Element::compareWithBSONObj(const BSONObj& other,
}
void Element::writeTo(BSONObjBuilder* const builder) const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
- verify(impl.getType(thisRep) == mongo::Object);
+ invariant(impl.getType(thisRep) == mongo::Object);
if (thisRep.parent == kInvalidRepIdx && _repIdx == kRootRepIdx) {
// If this is the root element, then we need to handle it differently, since it
// doesn't have a field name and should embed directly, rather than as an object.
@@ -1657,15 +1657,15 @@ void Element::writeTo(BSONObjBuilder* const builder) const {
}
void Element::writeArrayTo(BSONArrayBuilder* const builder) const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
- verify(impl.getType(thisRep) == mongo::Array);
+ invariant(impl.getType(thisRep) == mongo::Array);
return impl.writeChildren(_repIdx, builder);
}
Status Element::setValueDouble(const double value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
ElementRep thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1674,7 +1674,7 @@ Status Element::setValueDouble(const double value) {
}
Status Element::setValueString(StringData value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(value));
@@ -1686,7 +1686,7 @@ Status Element::setValueString(StringData value) {
}
Status Element::setValueObject(const BSONObj& value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(value));
@@ -1698,7 +1698,7 @@ Status Element::setValueObject(const BSONObj& value) {
}
Status Element::setValueArray(const BSONObj& value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(value));
@@ -1712,7 +1712,7 @@ Status Element::setValueArray(const BSONObj& value) {
Status Element::setValueBinary(const uint32_t len,
mongo::BinDataType binType,
const void* const data) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
// TODO: Alias check for binary data?
@@ -1724,7 +1724,7 @@ Status Element::setValueBinary(const uint32_t len,
}
Status Element::setValueUndefined() {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1733,7 +1733,7 @@ Status Element::setValueUndefined() {
}
Status Element::setValueOID(const OID value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1742,7 +1742,7 @@ Status Element::setValueOID(const OID value) {
}
Status Element::setValueBool(const bool value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
ElementRep thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1751,7 +1751,7 @@ Status Element::setValueBool(const bool value) {
}
Status Element::setValueDate(const Date_t value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1760,7 +1760,7 @@ Status Element::setValueDate(const Date_t value) {
}
Status Element::setValueNull() {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1769,7 +1769,7 @@ Status Element::setValueNull() {
}
Status Element::setValueRegex(StringData re, StringData flags) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(re));
@@ -1782,7 +1782,7 @@ Status Element::setValueRegex(StringData re, StringData flags) {
}
Status Element::setValueDBRef(StringData ns, const OID oid) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(ns));
@@ -1794,7 +1794,7 @@ Status Element::setValueDBRef(StringData ns, const OID oid) {
}
Status Element::setValueCode(StringData value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(value));
@@ -1806,7 +1806,7 @@ Status Element::setValueCode(StringData value) {
}
Status Element::setValueSymbol(StringData value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(value));
@@ -1818,7 +1818,7 @@ Status Element::setValueSymbol(StringData value) {
}
Status Element::setValueCodeWithScope(StringData code, const BSONObj& scope) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
dassert(impl.doesNotAlias(code));
@@ -1831,7 +1831,7 @@ Status Element::setValueCodeWithScope(StringData code, const BSONObj& scope) {
}
Status Element::setValueInt(const int32_t value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
ElementRep thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1840,7 +1840,7 @@ Status Element::setValueInt(const int32_t value) {
}
Status Element::setValueTimestamp(const Timestamp value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1849,7 +1849,7 @@ Status Element::setValueTimestamp(const Timestamp value) {
}
Status Element::setValueLong(const int64_t value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
ElementRep thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1858,7 +1858,7 @@ Status Element::setValueLong(const int64_t value) {
}
Status Element::setValueDecimal(const Decimal128 value) {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
ElementRep thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1867,7 +1867,7 @@ Status Element::setValueDecimal(const Decimal128 value) {
}
Status Element::setValueMinKey() {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1876,7 +1876,7 @@ Status Element::setValueMinKey() {
}
Status Element::setValueMaxKey() {
- verify(ok());
+ invariant(ok());
Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
const StringData fieldName = impl.getFieldNameForNewElement(thisRep);
@@ -1885,7 +1885,7 @@ Status Element::setValueMaxKey() {
}
Status Element::setValueBSONElement(const BSONElement& value) {
- verify(ok());
+ invariant(ok());
if (value.type() == mongo::EOO)
return Status(ErrorCodes::IllegalOperation, "Can't set Element value to EOO");
@@ -1901,7 +1901,7 @@ Status Element::setValueBSONElement(const BSONElement& value) {
}
Status Element::setValueSafeNum(const SafeNum value) {
- verify(ok());
+ invariant(ok());
switch (value.type()) {
case mongo::NumberInt:
return setValueInt(value._value.int32Val);
@@ -1918,7 +1918,7 @@ Status Element::setValueSafeNum(const SafeNum value) {
}
Status Element::setValueElement(ConstElement setFrom) {
- verify(ok());
+ invariant(ok());
// Can't set to your own root element, since this would create a circular document.
if (_doc->root() == setFrom) {
@@ -1942,25 +1942,25 @@ Status Element::setValueElement(ConstElement setFrom) {
}
BSONType Element::getType() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
return impl.getType(thisRep);
}
StringData Element::getFieldName() const {
- verify(ok());
+ invariant(ok());
const Document::Impl& impl = getDocument().getImpl();
const ElementRep& thisRep = impl.getElementRep(_repIdx);
return impl.getFieldName(thisRep);
}
Status Element::addChild(Element e, bool front) {
- // No need to verify(ok()) since we are only called from methods that have done so.
+ // No need to invariant(ok()) since we are only called from methods that have done so.
dassert(ok());
- verify(e.ok());
- verify(_doc == e._doc);
+ invariant(e.ok());
+ invariant(_doc == e._doc);
Document::Impl& impl = getDocument().getImpl();
ElementRep& newRep = impl.getElementRep(e._repIdx);
@@ -2008,7 +2008,7 @@ Status Element::addChild(Element e, bool front) {
}
Status Element::setValue(const Element::RepIdx newValueIdx) {
- // No need to verify(ok()) since we are only called from methods that have done so.
+ // No need to invariant(ok()) since we are only called from methods that have done so.
dassert(ok());
if (_repIdx == kRootRepIdx)
diff --git a/src/mongo/util/assert_util.cpp b/src/mongo/util/assert_util.cpp
index b832278cac9..99b4ec6f5a0 100644
--- a/src/mongo/util/assert_util.cpp
+++ b/src/mongo/util/assert_util.cpp
@@ -147,7 +147,7 @@ NOINLINE_DECL void verifyFailed(const char* expr, const char* file, unsigned lin
throw e;
}
-NOINLINE_DECL void invariantFailed(const char* expr, const char* file, unsigned line) {
+NOINLINE_DECL void invariantFailed(const char* expr, const char* file, unsigned line) noexcept {
log() << "Invariant failure " << expr << ' ' << file << ' ' << dec << line << endl;
breakpoint();
log() << "\n\n***aborting after invariant() failure\n\n" << endl;
@@ -157,7 +157,7 @@ NOINLINE_DECL void invariantFailed(const char* expr, const char* file, unsigned
NOINLINE_DECL void invariantOKFailed(const char* expr,
const Status& status,
const char* file,
- unsigned line) {
+ unsigned line) noexcept {
log() << "Invariant failure: " << expr << " resulted in status " << status << " at " << file
<< ' ' << dec << line;
breakpoint();
@@ -165,28 +165,29 @@ NOINLINE_DECL void invariantOKFailed(const char* expr,
std::abort();
}
-NOINLINE_DECL void fassertFailed(int msgid) {
+NOINLINE_DECL void fassertFailed(int msgid) noexcept {
log() << "Fatal Assertion " << msgid << endl;
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
std::abort();
}
-NOINLINE_DECL void fassertFailedNoTrace(int msgid) {
+NOINLINE_DECL void fassertFailedNoTrace(int msgid) noexcept {
log() << "Fatal Assertion " << msgid << endl;
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
quickExit(EXIT_ABRUPT);
}
-MONGO_COMPILER_NORETURN void fassertFailedWithStatus(int msgid, const Status& status) {
+MONGO_COMPILER_NORETURN void fassertFailedWithStatus(int msgid, const Status& status) noexcept {
log() << "Fatal assertion " << msgid << " " << status;
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
std::abort();
}
-MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTrace(int msgid, const Status& status) {
+MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTrace(int msgid,
+ const Status& status) noexcept {
log() << "Fatal assertion " << msgid << " " << status;
breakpoint();
log() << "\n\n***aborting after fassert() failure\n\n" << endl;
@@ -280,7 +281,7 @@ string demangleName(const type_info& typeinfo) {
#endif
}
-Status exceptionToStatus() {
+Status exceptionToStatus() noexcept {
try {
throw;
} catch (const DBException& ex) {
diff --git a/src/mongo/util/assert_util.h b/src/mongo/util/assert_util.h
index 7748ba447e1..3e6afbb5eaa 100644
--- a/src/mongo/util/assert_util.h
+++ b/src/mongo/util/assert_util.h
@@ -177,12 +177,13 @@ MONGO_COMPILER_NORETURN void verifyFailed(const char* expr, const char* file, un
MONGO_COMPILER_NORETURN void invariantOKFailed(const char* expr,
const Status& status,
const char* file,
- unsigned line);
+ unsigned line) noexcept;
void wasserted(const char* expr, const char* file, unsigned line);
-MONGO_COMPILER_NORETURN void fassertFailed(int msgid);
-MONGO_COMPILER_NORETURN void fassertFailedNoTrace(int msgid);
-MONGO_COMPILER_NORETURN void fassertFailedWithStatus(int msgid, const Status& status);
-MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTrace(int msgid, const Status& status);
+MONGO_COMPILER_NORETURN void fassertFailed(int msgid) noexcept;
+MONGO_COMPILER_NORETURN void fassertFailedNoTrace(int msgid) noexcept;
+MONGO_COMPILER_NORETURN void fassertFailedWithStatus(int msgid, const Status& status) noexcept;
+MONGO_COMPILER_NORETURN void fassertFailedWithStatusNoTrace(int msgid,
+ const Status& status) noexcept;
/** a "user assertion". throws UserAssertion. logs. typically used for errors that a user
could cause, such as duplicate key, disk full, etc.
@@ -352,7 +353,7 @@ std::string demangleName(const std::type_info& typeinfo);
* }
* }
*/
-Status exceptionToStatus();
+Status exceptionToStatus() noexcept;
} // namespace mongo
diff --git a/src/mongo/util/invariant.h b/src/mongo/util/invariant.h
index 68a1bcb70d0..a630bbec7ef 100644
--- a/src/mongo/util/invariant.h
+++ b/src/mongo/util/invariant.h
@@ -42,7 +42,9 @@ namespace mongo {
#error "Include assert_util.h instead of invariant.h."
#endif
-MONGO_COMPILER_NORETURN void invariantFailed(const char* expr, const char* file, unsigned line);
+MONGO_COMPILER_NORETURN void invariantFailed(const char* expr,
+ const char* file,
+ unsigned line) noexcept;
#define MONGO_invariant(_Expression) \
do { \