diff options
author | Mathias Stearn <mathias@10gen.com> | 2016-04-29 19:03:08 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2016-05-09 17:52:12 -0400 |
commit | fb439046f73ce10b862750df853746c41e9e2e81 (patch) | |
tree | 57f253aede294d574f0d7400460d643b7fe97ad5 /src/mongo/util/assert_util.h | |
parent | 47e3245fa23e778376a4a3492ebaba471a29417f (diff) | |
download | mongo-fb439046f73ce10b862750df853746c41e9e2e81.tar.gz |
SERVER-24082 Hint the compiler that error functions are cold
Diffstat (limited to 'src/mongo/util/assert_util.h')
-rw-r--r-- | src/mongo/util/assert_util.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/mongo/util/assert_util.h b/src/mongo/util/assert_util.h index 32a0946c6e0..82369810174 100644 --- a/src/mongo/util/assert_util.h +++ b/src/mongo/util/assert_util.h @@ -236,12 +236,12 @@ inline void fassertNoTrace(int msgid, const Status& status) { * MONGO_COMPILER_UNREACHABLE as it is impossible to mark a lambda noreturn. */ #define uassert MONGO_uassert -#define MONGO_uassert(msgid, msg, expr) \ - do { \ - if (MONGO_unlikely(!(expr))) { \ - [&]() { ::mongo::uasserted(msgid, msg); }(); \ - MONGO_COMPILER_UNREACHABLE; \ - } \ +#define MONGO_uassert(msgid, msg, expr) \ + do { \ + if (MONGO_unlikely(!(expr))) { \ + [&]() MONGO_COMPILER_COLD_FUNCTION { ::mongo::uasserted(msgid, msg); }(); \ + MONGO_COMPILER_UNREACHABLE; \ + } \ } while (false) inline void uassertStatusOK(const Status& status) { @@ -285,12 +285,12 @@ inline void fassertStatusOK(int msgid, const Status& s) { display happening. */ #define massert MONGO_massert -#define MONGO_massert(msgid, msg, expr) \ - do { \ - if (MONGO_unlikely(!(expr))) { \ - [&] { ::mongo::msgasserted(msgid, msg); }(); \ - MONGO_COMPILER_UNREACHABLE; \ - } \ +#define MONGO_massert(msgid, msg, expr) \ + do { \ + if (MONGO_unlikely(!(expr))) { \ + [&]() MONGO_COMPILER_COLD_FUNCTION { ::mongo::msgasserted(msgid, msg); }(); \ + MONGO_COMPILER_UNREACHABLE; \ + } \ } while (false) inline void massertStatusOK(const Status& status) { @@ -301,7 +301,7 @@ inline void massertStatusOK(const Status& status) { inline void massertNoTraceStatusOK(const Status& status) { if (MONGO_unlikely(!status.isOK())) { - [&] { + [&]() MONGO_COMPILER_COLD_FUNCTION { msgassertedNoTrace((status.location() != 0 ? status.location() : status.code()), status.reason()); }(); |