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

ruby-changes:46111

From: nagachika <ko1@a...>
Date: Tue, 28 Mar 2017 02:11:53 +0900 (JST)
Subject: [ruby-changes:46111] nagachika:r58182 (ruby_2_3): merge revision(s) 57762: [Backport #13267]

nagachika	2017-03-28 02:11:48 +0900 (Tue, 28 Mar 2017)

  New Revision: 58182

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58182

  Log:
    merge revision(s) 57762: [Backport #13267]
    
    broken mingw
    
    * configure.in: check whether frexp and modf are broken.
    
    * include/ruby/win32.h (frexp, modf): ignore bad declarations when
      compiling as C++.  [ruby-core:79859] [Bug #13267]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/configure.in
    branches/ruby_2_3/include/ruby/win32.h
    branches/ruby_2_3/version.h
Index: ruby_2_3/configure.in
===================================================================
--- ruby_2_3/configure.in	(revision 58181)
+++ ruby_2_3/configure.in	(revision 58182)
@@ -894,6 +894,33 @@ if test "$GCC" = yes; then https://github.com/ruby/ruby/blob/trunk/ruby_2_3/configure.in#L894
       # various  headers.  Most frequent  situation is  the use  of //
       # comments.   We  bypass  ANSI   C  mode  for  them.   Otherwise
       # extension libs cannot include those headers.
+
+      # Since math.h in some mingw64 wrongly delcares frexp and modf
+      # to be pure, the variables pointed by the second arguments are
+      # considered uninitialized unexpectedly.
+      AC_CACHE_CHECK([whether frexp and modf are broken],
+	rb_cv_mingw64_broken_frexp_modf,
+	[
+	  save_CFLAGS="$CFLAGS"
+	  if test "$particular_werror_flags" = "yes"; then
+	    CFLAGS="$CFLAGS -Werror=uninitialized"
+	  else
+	    CFLAGS="$CFLAGS -Werror -Wuninitialized"
+	  fi
+	  AC_TRY_COMPILE([@%:@include <math.h>
+	    int foo(double x)
+	    {
+	      int exp;
+	      frexp(x, &exp);
+	      return exp;
+	    }], [if (foo(0.0)) return 1;],
+	    [rb_cv_mingw64_broken_frexp_modf=no],
+	    [rb_cv_mingw64_broken_frexp_modf=yes])
+	  CFLAGS="$save_CFLAGS"
+	])
+      if test "$rb_cv_mingw64_broken_frexp_modf" = yes; then
+	AC_DEFINE(RUBY_MINGW64_BROKEN_FREXP_MODF)
+      fi
     ],
     [cygwin*|darwin*|netbsd*|nacl], [
       # need lgamma_r(), finite()
Index: ruby_2_3/include/ruby/win32.h
===================================================================
--- ruby_2_3/include/ruby/win32.h	(revision 58181)
+++ ruby_2_3/include/ruby/win32.h	(revision 58182)
@@ -752,7 +752,8 @@ uintptr_t rb_w32_asynchronize(asynchrono https://github.com/ruby/ruby/blob/trunk/ruby_2_3/include/ruby/win32.h#L752
 
 RUBY_SYMBOL_EXPORT_END
 
-#ifdef __MINGW_ATTRIB_PURE
+#if (defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)) && !defined(__cplusplus)
+#ifdef RUBY_MINGW64_BROKEN_FREXP_MODF
 /* License: Ruby's */
 /* get rid of bugs in math.h of mingw */
 #define frexp(_X, _Y) __extension__ ({\
@@ -770,13 +771,6 @@ RUBY_SYMBOL_EXPORT_END https://github.com/ruby/ruby/blob/trunk/ruby_2_3/include/ruby/win32.h#L771
 })
 #endif
 
-#if defined(__cplusplus)
-#if 0
-{ /* satisfy cc-mode */
-#endif
-}  /* extern "C" { */
-#endif
-
 #if defined(__MINGW64__)
 /*
  * Use powl() instead of broken pow() of x86_64-w64-mingw32.
@@ -791,8 +785,14 @@ rb_w32_pow(double x, double y) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/include/ruby/win32.h#L785
 #elif defined(__MINGW64_VERSION_MAJOR)
 double rb_w32_pow(double x, double y);
 #endif
-#if defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)
 #define pow rb_w32_pow
 #endif
 
+#if defined(__cplusplus)
+#if 0
+{ /* satisfy cc-mode */
+#endif
+}  /* extern "C" { */
+#endif
+
 #endif /* RUBY_WIN32_H */
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 58181)
+++ ruby_2_3/version.h	(revision 58182)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.3"
 #define RUBY_RELEASE_DATE "2017-03-28"
-#define RUBY_PATCHLEVEL 291
+#define RUBY_PATCHLEVEL 292
 
 #define RUBY_RELEASE_YEAR 2017
 #define RUBY_RELEASE_MONTH 3

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r57762


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

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