ruby-changes:50916
From: shyouhei <ko1@a...>
Date: Mon, 9 Apr 2018 11:40:21 +0900 (JST)
Subject: [ruby-changes:50916] shyouhei:r63123 (trunk): Prefer alignof() over _Alignof()
shyouhei 2018-04-09 11:40:12 +0900 (Mon, 09 Apr 2018) New Revision: 63123 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63123 Log: Prefer alignof() over _Alignof() to allow C++ programs include <ruby.h>. [Bug #14668] Modified files: trunk/configure.ac trunk/include/ruby/defines.h Index: configure.ac =================================================================== --- configure.ac (revision 63122) +++ configure.ac (revision 63123) @@ -984,6 +984,7 @@ AC_CHECK_HEADERS(net/socket.h) https://github.com/ruby/ruby/blob/trunk/configure.ac#L984 AC_CHECK_HEADERS(process.h) AC_CHECK_HEADERS(pwd.h) AC_CHECK_HEADERS(setjmpex.h) +AC_CHECK_HEADERS(stdalign.h) AC_CHECK_HEADERS(sys/attr.h) AC_CHECK_HEADERS(sys/fcntl.h) AC_CHECK_HEADERS(sys/file.h) @@ -1279,13 +1280,16 @@ AC_CACHE_CHECK([for alignof() syntax], r https://github.com/ruby/ruby/blob/trunk/configure.ac#L1280 rb_cv_have_alignof=no RUBY_WERROR_FLAG([ for expr in \ - "_Alignof" \ "alignof" \ + "_Alignof" \ "__alignof" \ "__alignof__" \ ; do - AC_TRY_COMPILE([],[return (int)$expr(int);], + AC_TRY_COMPILE([ + @%:@ifdef HAVE_STDALIGN_H + @%:@include <stdalign.h> + @%:@endif],[return (int)$expr(int);], [rb_cv_have_alignof="$expr"; break], []) done ])]) Index: include/ruby/defines.h =================================================================== --- include/ruby/defines.h (revision 63122) +++ include/ruby/defines.h (revision 63123) @@ -135,6 +135,9 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/include/ruby/defines.h#L135 #ifdef HAVE_STDINT_H # include <stdint.h> #endif +#ifdef HAVE_STDALIGN_H +# include <stdalign.h> +#endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/