diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-27 17:11:48 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-27 17:11:48 +0000 |
commit | ff6e8710ee889cc1f3803468d32ca6f26e937d0f (patch) | |
tree | 3a1a254736420392a954ea9b244f4af58ed45b9a /configure.in | |
parent | 06103f2c1a87226a1c9dbc4cb22783fb5cbbe41c (diff) |
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]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@58182 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/configure.in b/configure.in index 7369730de4..b5876294f1 100644 --- a/configure.in +++ b/configure.in @@ -894,6 +894,33 @@ if test "$GCC" = yes; then # 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() |