aboutsummaryrefslogtreecommitdiffstats
path: root/include/ruby/defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/defines.h')
-rw-r--r--include/ruby/defines.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index fb80813f05..cbf5537790 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -89,6 +89,16 @@ extern "C" {
#define RB_UNLIKELY(x) (x)
#endif /* __GNUC__ >= 3 */
+/*
+ cold attribute for code layout improvements
+ RUBY_FUNC_ATTRIBUTE not used because MSVC does not like nested func macros
+ */
+#if defined(__clang__) || GCC_VERSION_SINCE(4, 3, 0)
+#define COLDFUNC __attribute__((cold))
+#else
+#define COLDFUNC
+#endif
+
#ifdef __GNUC__
#if defined __MINGW_PRINTF_FORMAT
#define PRINTF_ARGS(decl, string_index, first_to_check) \