diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2020-11-19 17:22:13 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-11-20 01:12:35 +0000 |
commit | 32c4765e7a29ebbb7470a944dabf70d69134a486 (patch) | |
tree | ca1d1b3e3b39dcb4ee394e84bf9be1d10212f938 /src/mongo/util/assert_util.h | |
parent | 304316278656273caffdd461ead2ef02e2ac7743 (diff) | |
download | mongo-32c4765e7a29ebbb7470a944dabf70d69134a486.tar.gz |
SERVER-50684 rename,cleanup internalAssert->iassert
Diffstat (limited to 'src/mongo/util/assert_util.h')
-rw-r--r-- | src/mongo/util/assert_util.h | 31 |
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()); } /** |