ruby-changes:60140
From: Yusuke <ko1@a...>
Date: Thu, 20 Feb 2020 22:38:20 +0900 (JST)
Subject: [ruby-changes:60140] df26d36e5b (master): Prefer alignas() over _Alignas()
https://git.ruby-lang.org/ruby.git/commit/?id=df26d36e5b From df26d36e5ba0edc7ad031be9fb2047d68cd686c7 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 20 Feb 2020 22:36:53 +0900 Subject: Prefer alignas() over _Alignas() to allow Intel C++ compiler to read ruby.h. This is similar to 9930481a239fa7182429f3c3942ea033fb9b0320 diff --git a/configure.ac b/configure.ac index b0e09a5..83c8519 100644 --- a/configure.ac +++ b/configure.ac @@ -1359,10 +1359,11 @@ AS_IF([test "$rb_cv_va_args_macro" = yes], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L1359 AC_CACHE_CHECK([for alignas() syntax], rb_cv_have_alignas, [ rb_cv_have_alignas=no +# Prefer alignas over _Alignas to allow C++ compiler to read ruby.h RUBY_WERROR_FLAG([ for attr in \ - "_Alignas(x)" \ "alignas(x)" \ + "_Alignas(x)" \ "@<:@@<:@alignas(x)@:>@@:>@" \ "__declspec(aligned(x))" \ "__attribute__((__aligned__(x)))" \ @@ -1371,8 +1372,11 @@ do https://github.com/ruby/ruby/blob/trunk/configure.ac#L1372 # C11 _Alignas and GCC __attribute__((__aligned__)) behave # slightly differently. What we want is GCC's. Check that # here by something C11 does not allow (`struct ALIGNAS ...`) - AC_TRY_COMPILE( - [@%:@define ALIGNAS(x) $attr + AC_TRY_COMPILE([ + @%:@ifdef HAVE_STDALIGN_H + @%:@include <stdalign.h> + @%:@endif + @%:@define ALIGNAS(x) $attr struct ALIGNAS(128) conftest_tag { int foo; } foo; ], [], [rb_cv_have_alignas="$attr"; break], []) done @@ -1383,6 +1387,7 @@ AS_IF([test "$rb_cv_have_alignas" != no], [ https://github.com/ruby/ruby/blob/trunk/configure.ac#L1387 AC_CACHE_CHECK([for alignof() syntax], rb_cv_have_alignof,[ rb_cv_have_alignof=no +# Prefer alignof over _Alignof to allow C++ compiler to read ruby.h RUBY_WERROR_FLAG([ for expr in \ "alignof" \ -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/