summaryrefslogtreecommitdiff
path: root/include/ruby/defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/ruby/defines.h')
-rw-r--r--include/ruby/defines.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 8603ade340..213956c3eb 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -217,7 +217,12 @@ RUBY_SYMBOL_EXPORT_BEGIN
#if GCC_VERSION_SINCE(4,3,0)
# define RUBY_ATTR_ALLOC_SIZE(params) __attribute__ ((alloc_size params))
-#else
+#elif defined(__has_attribute)
+# if __has_attribute(alloc_size)
+# define RUBY_ATTR_ALLOC_SIZE(params) __attribute__((__alloc_size__ params))
+# endif
+#endif
+#ifndef RUBY_ATTR_ALLOC_SIZE
# define RUBY_ATTR_ALLOC_SIZE(params)
#endif