diff options
author | Andy Schwerin <schwerin@mongodb.com> | 2014-05-22 18:50:54 -0400 |
---|---|---|
committer | Andy Schwerin <schwerin@mongodb.com> | 2014-05-27 15:53:15 -0400 |
commit | 6fea6df0f8065bfa28fa17f94a5150482ed780da (patch) | |
tree | 5dcba5c6c2873f087d85ec2ac3a8b06e2746f8ba /src/mongo/platform | |
parent | a97c9b1a30d60f8a9dca16969747f3f59400cb18 (diff) | |
download | mongo-6fea6df0f8065bfa28fa17f94a5150482ed780da.tar.gz |
SERVER-14035 Introduce MONGO_NOEXCEPT macros in mongo/platform/compiler.h.
These macros expand to "noexcept" in C++11 and "throw ()" in earlier C++
compilers, so we can label methods that should terminate() rather than
allow an exception to escape.
Diffstat (limited to 'src/mongo/platform')
-rw-r--r-- | src/mongo/platform/compiler.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/platform/compiler.h b/src/mongo/platform/compiler.h index 75882011096..b88d9840a84 100644 --- a/src/mongo/platform/compiler.h +++ b/src/mongo/platform/compiler.h @@ -117,8 +117,19 @@ * shared libraries. * * Same correct/incorrect usage as for MONGO_COMPILER_API_EXPORT. + * + * MONGO_NOEXCEPT + * + * Decorates functions that must not throw exceptions. If a function so-decorated + * throws, the runtime will call std::terminate(). */ +#if __cplusplus >= 201103L +#define MONGO_NOEXCEPT noexcept +#else +#define MONGO_NOEXCEPT throw () +#endif + #if defined(_MSC_VER) #include "mongo/platform/compiler_msvc.h" #elif defined(__GNUC__) |