diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-15 02:35:17 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-15 02:35:17 +0000 |
commit | 21429b1488faf58b6683eef2c9c24e00796a32ae (patch) | |
tree | fb40e9ac8dc96491b6a2e3fefc221384784974c9 /configure.ac | |
parent | f089a52865bd82a327fe9ef460cecdb812dcb56c (diff) | |
download | ruby-21429b1488faf58b6683eef2c9c24e00796a32ae.tar.gz |
__alignof__ to take alignment of a type
C11 and C++11 has this feature so why not use it when available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index f7707b761d..49c2b76bd3 100644 --- a/configure.ac +++ b/configure.ac @@ -1767,6 +1767,24 @@ AS_IF([test "$rb_cv_have_alignas" != no], [ AC_DEFINE_UNQUOTED([RUBY_ALIGNAS(x)], $rb_cv_have_alignas) ]) +AC_CACHE_CHECK([for alignof() syntax], rb_cv_have_alignof,[ +rb_cv_have_alignof=no +RUBY_WERROR_FLAG([ +for expr in \ + "_Alignof" \ + "alignof" \ + "__alignof" \ + "__alignof__" \ +; +do + AC_TRY_COMPILE([],[return (int)$expr(int);], + [rb_cv_have_alignof="$expr"; break], []) +done +])]) +AS_IF([test "$rb_cv_have_alignof" != no], [ + AC_DEFINE_UNQUOTED(RUBY_ALIGNOF, $rb_cv_have_alignof) +]) + dnl RUBY_DECL_ATTRIBUTE(attrib, macroname, cachevar, condition, type, code) AC_DEFUN([RUBY_DECL_ATTRIBUTE], [dnl m4_ifval([$2], dnl |