[前][次][番号順一覧][スレッド一覧]

ruby-changes:58529

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Fri, 1 Nov 2019 16:59:01 +0900 (JST)
Subject: [ruby-changes:58529] 2c889e9b05 (master): RUBY_ATTR_ALOC_SIZE for clang

https://git.ruby-lang.org/ruby.git/commit/?id=2c889e9b05

From 2c889e9b05e2d2902096af02687cc6e3c7424c30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
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.

diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 8603ade..213956c 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -217,7 +217,12 @@ RUBY_SYMBOL_EXPORT_BEGIN https://github.com/ruby/ruby/blob/trunk/include/ruby/defines.h#L217
 
 #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 v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]