summaryrefslogtreecommitdiff
path: root/src/mongo/platform
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-06-03 15:01:20 -0400
committerMathias Stearn <mathias@10gen.com>2016-06-09 13:00:49 -0400
commitccbcb85c68bf03f6ecc024a32a2b6c6a35c23c33 (patch)
tree46e9090bad41e4dd5aa9453d26fe09c7cdfc610e /src/mongo/platform
parentb354fbae71aea007759e174c31a869f55fe6502f (diff)
downloadmongo-ccbcb85c68bf03f6ecc024a32a2b6c6a35c23c33.tar.gz
SERVER-23974 Don't use attribute((cold)) with clang
Diffstat (limited to 'src/mongo/platform')
-rw-r--r--src/mongo/platform/compiler_gcc.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mongo/platform/compiler_gcc.h b/src/mongo/platform/compiler_gcc.h
index 2db2dd30fc0..cf3b239db35 100644
--- a/src/mongo/platform/compiler_gcc.h
+++ b/src/mongo/platform/compiler_gcc.h
@@ -35,9 +35,17 @@
#pragma once
+#ifdef __clang__
+// Our minimum clang version (3.4) doesn't support the "cold" attribute. We could try to use it with
+// clang versions that support the attribute, but since Apple uses weird version numbers on clang
+// and the main goal with the attribute is to improve our production builds with gcc, it didn't seem
+// worth it.
+#define MONGO_COMPILER_COLD_FUNCTION
+#define MONGO_COMPILER_NORETURN __attribute__((__noreturn__))
+#else
#define MONGO_COMPILER_COLD_FUNCTION __attribute__((__cold__))
-
#define MONGO_COMPILER_NORETURN __attribute__((__noreturn__, __cold__))
+#endif
#define MONGO_COMPILER_VARIABLE_UNUSED __attribute__((__unused__))