From 8699a7a00655253ee9e4eedd55fbaea42f975788 Mon Sep 17 00:00:00 2001 From: shyouhei Date: Mon, 15 Jan 2018 06:47:56 +0000 Subject: 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 --- include/ruby/ruby.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/ruby') 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 -- cgit v1.2.3