diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-15 06:47:56 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-15 06:47:56 +0000 |
commit | 8699a7a00655253ee9e4eedd55fbaea42f975788 (patch) | |
tree | 272e09219381cbdc711958600a7da4521612b388 /include | |
parent | 7c088b9662b9a77dd8bd751bb19c7389dc230fca (diff) |
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.h | 4 |
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 |