diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-21 00:11:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-04-21 00:11:56 +0000 |
commit | c483ae6572f4234ffbe6f3da98e0d91492b09a2a (patch) | |
tree | 4e9f296096faf4a7591a1cb3f2bdb007bc9c1f0f /include | |
parent | 8b31febd1536d821ef2c0e41cba21204ceb0fa80 (diff) | |
download | ruby-c483ae6572f4234ffbe6f3da98e0d91492b09a2a.tar.gz |
Suppress a warning in ruby/win32.h [Fix GH-1591]
Fix a warning in ruby/win32.h which can cause failures with mkmf
The return value is implicit type casted from 'long double' to 'double', currently.
This causes a gcc warning like this:
```
In file included from C:\Ruby24-x64\include\ruby-2.4.0/ruby/defines.h:243:0,
from C:\Ruby24-x64\include\ruby-2.4.0/ruby/ruby.h:36,
from C:\Ruby24-x64\include\ruby-2.4.0/ruby.h:33,
from conftest.c:1:
C:\Ruby24-x64\include\ruby-2.4.0/ruby/win32.h: In function 'rb_w32_pow':
C:\Ruby24-x64\include\ruby-2.4.0/ruby/win32.h:786:12: warning: conversion to 'double' from 'long double' may alter its value [-Wfloat-conversion]
return powl(x, y);
^~~~~~~~~~
```
This is fixed by the attached explicit type cast.
Moreover when CFLAGS is set to '-Wconversion', it prevents the compiler from
building. This is the case at the nokogiri gem.
The original issue arose at RubyInstaller2: https://github.com/oneclick/rubyinstaller2/commit/576a0eb70aa9348b366c3ecfe83c67811b7bcb9b
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/win32.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/ruby/win32.h b/include/ruby/win32.h index ca99ee48f3..a2ba226b59 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -781,7 +781,7 @@ RUBY_SYMBOL_EXPORT_END static inline double rb_w32_pow(double x, double y) { - return powl(x, y); + return (double)powl(x, y); } #elif defined(__MINGW64_VERSION_MAJOR) double rb_w32_pow(double x, double y); |