[前][次][番号順一覧][スレッド一覧]

ruby-changes:33429

From: nobu <ko1@a...>
Date: Wed, 2 Apr 2014 21:50:12 +0900 (JST)
Subject: [ruby-changes:33429] nobu:r45508 (trunk): configure.in: fix for clang 5.1 __builtin_longjmp

nobu	2014-04-02 21:50:07 +0900 (Wed, 02 Apr 2014)

  New Revision: 45508

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45508

  Log:
    configure.in: fix for clang 5.1 __builtin_longjmp
    
    * configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp() in
      clang 5.1 uses `void**`, not `jmp_buf`.  [Bug #9692]

  Modified files:
    trunk/ChangeLog
    trunk/configure.in
Index: configure.in
===================================================================
--- configure.in	(revision 45507)
+++ configure.in	(revision 45508)
@@ -2074,18 +2074,25 @@ AC_CACHE_CHECK(for sigsetjmp as a macro https://github.com/ruby/ruby/blob/trunk/configure.in#L2074
 	ac_cv_func_sigsetjmp=yes,
 	ac_cv_func_sigsetjmp=no)])
 
+if test x"${ac_cv_func___builtin_setjmp}" = xyes; then
+   unset ac_cv_func___builtin_setjmp
+fi
 AC_CACHE_CHECK(for __builtin_setjmp, ac_cv_func___builtin_setjmp,
+[
+for cast in "" "(void *)"; do
+RUBY_WERROR_FLAG(
 [AC_TRY_LINK([@%:@include <setjmp.h>
     @%:@include <stdio.h>
     jmp_buf jb;
-    void t(void) {__builtin_longjmp(jb, 1);}],
+    void t(void) {__builtin_longjmp($cast jb, 1);}],
     [
     void (*volatile f)(void) = t;
-    if (!__builtin_setjmp(jb)) printf("%d\n", f != 0);
+    if (!__builtin_setjmp($cast jb)) printf("%d\n", f != 0);
     ],
-    [ac_cv_func___builtin_setjmp=yes],
+    [ac_cv_func___builtin_setjmp="yes with cast ($cast)"],
     [ac_cv_func___builtin_setjmp=no])
 ])
+done])
 
 # we don't use _setjmp if _longjmp doesn't exist.
 test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
@@ -2103,11 +2110,13 @@ AC_ARG_WITH(setjmp-type, https://github.com/ruby/ruby/blob/trunk/configure.in#L2110
 	[setjmpex], [ setjmp_prefix= setjmp_suffix=ex],
 	[''], [ unset setjmp_prefix],
 	[   AC_MSG_ERROR(invalid setjmp type: $withval)])], [unset setjmp_prefix])
+setjmp_cast=
 if test ${setjmp_prefix+set}; then
     if test "${setjmp_prefix}" && eval test '$ac_cv_func_'${setjmp_prefix}setjmp${setjmp_suffix} = no; then
 	AC_MSG_ERROR(${setjmp_prefix}setjmp${setjmp_suffix} is not available)
     fi
-elif test "$ac_cv_func___builtin_setjmp" = yes; then
+elif { AS_CASE("$ac_cv_func___builtin_setjmp", [yes*], [true], [false]); }; then
+    setjmp_cast=`expr "$ac_cv_func___builtin_setjmp" : "yes with cast (\(.*\))"`
     setjmp_prefix=__builtin_
     setjmp_suffix=
 elif test "$ac_cv_header_setjmpex_h:$ac_cv_func__setjmpex" = yes:yes; then
@@ -2128,9 +2137,9 @@ if test x$setjmp_prefix = xsig; then https://github.com/ruby/ruby/blob/trunk/configure.in#L2137
 else
     unset setjmp_sigmask
 fi
-AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix})
-AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}(env${setjmp_sigmask+,0})])
-AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
+AC_MSG_RESULT(${setjmp_prefix}setjmp${setjmp_suffix}${setjmp_cast:+($setjmp_cast)})
+AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp${setjmp_suffix}($setjmp_cast(env)${setjmp_sigmask+,0})])
+AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp($setjmp_cast(env),val)])
 AC_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
 # End of setjmp check.
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45507)
+++ ChangeLog	(revision 45508)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Apr  2 21:50:06 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp() in
+	  clang 5.1 uses `void**`, not `jmp_buf`.  [Bug #9692]
+
 Wed Apr  2 20:57:15 2014  Koichi Sasada  <ko1@a...>
 
 	* gc.c, gc.h (rb_objspace_each_objects_without_setup):

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]