aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-15 06:47:56 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-15 06:47:56 +0000
commit80cbe22314beb4271ee881008eb764678cd96271 (patch)
tree272e09219381cbdc711958600a7da4521612b388 /include
parent3b70d4cf1519c4d9be26986a0e23d49ec3d2167d (diff)
downloadruby-80cbe22314beb4271ee881008eb764678cd96271.tar.gz
take alignof instead of sizeof
win32ole.c includes ALLOCA_N(struct myCPINFOEX, 1). On such case it is not a wise idea to align to the size of that struct. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/ruby.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index ea8f6eba00..b1d470163c 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1603,12 +1603,12 @@ rb_num2char_inline(VALUE x)
# undef HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
#endif
-#ifdef HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN
+#if defined(HAVE_BUILTIN___BUILTIN_ALLOCA_WITH_ALIGN) && defined(RUBY_ALIGNOF)
/* I don't know why but __builtin_alloca_with_align's second argument
takes bits rather than bytes. */
#define ALLOCA_N(type, n) \
(type*)__builtin_alloca_with_align((sizeof(type)*(n)), \
- sizeof(type) * CHAR_BIT)
+ RUBY_ALIGNOF(type) * CHAR_BIT)
#else
#define ALLOCA_N(type,n) ((type*)alloca(sizeof(type)*(n)))
#endif