summaryrefslogtreecommitdiff
path: root/src/mongo/util/assert_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/util/assert_util.h')
-rw-r--r--src/mongo/util/assert_util.h31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/mongo/util/assert_util.h b/src/mongo/util/assert_util.h
index b44dceccafa..fd66dff2699 100644
--- a/src/mongo/util/assert_util.h
+++ b/src/mongo/util/assert_util.h
@@ -437,38 +437,25 @@ inline void massertStatusOKWithLocation(const Status& status, const char* file,
}
/**
- * `internalAssert` is provided as an alternative for `uassert` variants (e.g., `uassertStatusOK`)
+ * `iassert` is provided as an alternative for `uassert` variants (e.g., `uassertStatusOK`)
* to support cases where we expect a failure, the failure is recoverable, or accounting for the
- * failure, updating assertion counters, isn't desired. `internalAssert` logs at D3 instead of D1,
+ * failure, updating assertion counters, isn't desired. `iassert` logs at D3 instead of D1,
* which helps with reducing the noise of assertions in production. The goal is to keep one
- * interface (i.e., `internalAssert(...)`) for all possible assertion variants, and use function
+ * interface (i.e., `iassert(...)`) for all possible assertion variants, and use function
* overloading to expand type support as needed.
*/
-#define internalAssert(...) \
- ::mongo::internalAssertWithLocation(MONGO_SOURCE_LOCATION(), __VA_ARGS__)
+#define iassert(...) ::mongo::iassertWithLocation(MONGO_SOURCE_LOCATION(), __VA_ARGS__)
-void internalAssertWithLocation(SourceLocationHolder loc, const Status& status);
+void iassertWithLocation(SourceLocationHolder loc, const Status& status);
-inline void internalAssertWithLocation(SourceLocationHolder loc, Status&& status) {
- internalAssertWithLocation(std::move(loc), status);
-}
-
-inline void internalAssertWithLocation(SourceLocationHolder loc,
- int msgid,
- const std::string& msg,
- bool expr) {
+inline void iassertWithLocation(SourceLocationHolder loc, int msgid, std::string msg, bool expr) {
if (MONGO_unlikely(!expr))
- internalAssertWithLocation(std::move(loc), Status(ErrorCodes::Error(msgid), msg));
-}
-
-template <typename T>
-inline void internalAssertWithLocation(SourceLocationHolder loc, const StatusWith<T>& sw) {
- internalAssertWithLocation(std::move(loc), sw.getStatus());
+ iassertWithLocation(std::move(loc), Status(ErrorCodes::Error(msgid), std::move(msg)));
}
template <typename T>
-inline void internalAssertWithLocation(SourceLocationHolder loc, StatusWith<T>&& sw) {
- internalAssertWithLocation(std::move(loc), sw);
+void iassertWithLocation(SourceLocationHolder loc, const StatusWith<T>& sw) {
+ iassertWithLocation(std::move(loc), sw.getStatus());
}
/**