From 2c889e9b05e2d2902096af02687cc6e3c7424c30 Mon Sep 17 00:00:00 2001 From: 卜部昌平 Date: Fri, 1 Nov 2019 14:32:05 +0900 Subject: RUBY_ATTR_ALOC_SIZE for clang clang also supports __attribute__((__alloc_size__)) so why not use it when the compiler says it does. --- include/ruby/defines.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3