summaryrefslogtreecommitdiff
path: root/src/mongo/platform
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2015-11-10 15:20:33 -0500
committerAdam Midvidy <amidvidy@gmail.com>2015-11-10 15:21:44 -0500
commitb5febb31364d79552976d1311efb98a61e7232d6 (patch)
tree9843d7d7e49ab3fd18e694e733837363f3e5a49d /src/mongo/platform
parente001158d2da317ae36030cf4919ab8ebb9bdf8b2 (diff)
downloadmongo-b5febb31364d79552976d1311efb98a61e7232d6.tar.gz
SERVER-20609 add MONGO_COMPILER_ALWAYS_INLINE
Diffstat (limited to 'src/mongo/platform')
-rw-r--r--src/mongo/platform/compiler.h5
-rw-r--r--src/mongo/platform/compiler_gcc.h2
-rw-r--r--src/mongo/platform/compiler_msvc.h2
3 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/platform/compiler.h b/src/mongo/platform/compiler.h
index 5ce6ed82ee7..4312682f36d 100644
--- a/src/mongo/platform/compiler.h
+++ b/src/mongo/platform/compiler.h
@@ -119,6 +119,11 @@
*
* Same correct/incorrect usage as for MONGO_COMPILER_API_EXPORT.
*
+ *
+ * MONGO_COMPILER_ALWAYS_INLINE
+ *
+ * Overrides compiler heuristics to force that a particular function should always
+ * be inlined.
*/
#if defined(_MSC_VER)
diff --git a/src/mongo/platform/compiler_gcc.h b/src/mongo/platform/compiler_gcc.h
index 46579eab963..a46889a5ad0 100644
--- a/src/mongo/platform/compiler_gcc.h
+++ b/src/mongo/platform/compiler_gcc.h
@@ -64,3 +64,5 @@
#define MONGO_likely(x) static_cast<bool>(__builtin_expect(static_cast<bool>(x), 1))
#define MONGO_unlikely(x) static_cast<bool>(__builtin_expect(static_cast<bool>(x), 0))
+
+#define MONGO_COMPILER_ALWAYS_INLINE [[gnu::always_inline]]
diff --git a/src/mongo/platform/compiler_msvc.h b/src/mongo/platform/compiler_msvc.h
index e1e87cc1744..32c794ee87e 100644
--- a/src/mongo/platform/compiler_msvc.h
+++ b/src/mongo/platform/compiler_msvc.h
@@ -56,3 +56,5 @@
#define MONGO_likely(x) bool(x)
#define MONGO_unlikely(x) bool(x)
+
+#define MONGO_COMPILER_ALWAYS_INLINE __forceinline