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/trunk@57762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2f3ff53f86
commit
85ac60cfd1
27
configure.in
27
configure.in
@ -940,6 +940,33 @@ if test "$GCC" = yes; then
|
|||||||
# various headers. Most frequent situation is the use of //
|
# various headers. Most frequent situation is the use of //
|
||||||
# comments. We bypass ANSI C mode for them. Otherwise
|
# comments. We bypass ANSI C mode for them. Otherwise
|
||||||
# extension libs cannot include those headers.
|
# 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], [
|
[cygwin*|darwin*|netbsd*|nacl], [
|
||||||
# need lgamma_r(), finite()
|
# need lgamma_r(), finite()
|
||||||
|
@ -753,7 +753,8 @@ uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc
|
|||||||
|
|
||||||
RUBY_SYMBOL_EXPORT_END
|
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 */
|
/* License: Ruby's */
|
||||||
/* get rid of bugs in math.h of mingw */
|
/* get rid of bugs in math.h of mingw */
|
||||||
#define frexp(_X, _Y) __extension__ ({\
|
#define frexp(_X, _Y) __extension__ ({\
|
||||||
@ -771,13 +772,6 @@ RUBY_SYMBOL_EXPORT_END
|
|||||||
})
|
})
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
|
||||||
#if 0
|
|
||||||
{ /* satisfy cc-mode */
|
|
||||||
#endif
|
|
||||||
} /* extern "C" { */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__MINGW64__)
|
#if defined(__MINGW64__)
|
||||||
/*
|
/*
|
||||||
* Use powl() instead of broken pow() of x86_64-w64-mingw32.
|
* Use powl() instead of broken pow() of x86_64-w64-mingw32.
|
||||||
@ -792,8 +786,14 @@ rb_w32_pow(double x, double y)
|
|||||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||||
double rb_w32_pow(double x, double y);
|
double rb_w32_pow(double x, double y);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)
|
|
||||||
#define pow rb_w32_pow
|
#define pow rb_w32_pow
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#if 0
|
||||||
|
{ /* satisfy cc-mode */
|
||||||
|
#endif
|
||||||
|
} /* extern "C" { */
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* RUBY_WIN32_H */
|
#endif /* RUBY_WIN32_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user