[ruby/prism] _finitef is unavailable on Windows x86
Instead cast it inline to a double on Windows. https://github.com/ruby/prism/commit/9064d872aa
This commit is contained in:
parent
05346b19b9
commit
c8dd047955
@ -136,17 +136,6 @@
|
|||||||
# define PRISM_HAS_FILESYSTEM
|
# define PRISM_HAS_FILESYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* isinf on Windows is defined as accepting a float, but on POSIX systems it
|
|
||||||
* accepts a float, a double, or a long double. We want to mirror this behavior
|
|
||||||
* on windows.
|
|
||||||
*/
|
|
||||||
#ifdef _WIN32
|
|
||||||
# include <float.h>
|
|
||||||
# undef isinf
|
|
||||||
# define isinf(x) (sizeof(x) == sizeof(float) ? !_finitef(x) : !_finite(x))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you build prism with a custom allocator, configure it with
|
* If you build prism with a custom allocator, configure it with
|
||||||
* "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc,
|
* "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc,
|
||||||
|
@ -4142,7 +4142,14 @@ pm_double_parse(pm_parser_t *parser, const pm_token_t *token) {
|
|||||||
|
|
||||||
// If errno is set, then it should only be ERANGE. At this point we need to
|
// If errno is set, then it should only be ERANGE. At this point we need to
|
||||||
// check if it's infinity (it should be).
|
// check if it's infinity (it should be).
|
||||||
if (errno == ERANGE && isinf(value)) {
|
if (
|
||||||
|
errno == ERANGE &&
|
||||||
|
#ifdef _WIN32
|
||||||
|
!_finite(value)
|
||||||
|
#else
|
||||||
|
isinf(value)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
int warn_width;
|
int warn_width;
|
||||||
const char *ellipsis;
|
const char *ellipsis;
|
||||||
|
|
||||||
|
@ -501,7 +501,13 @@ pm_static_literal_inspect_node(pm_buffer_t *buffer, const pm_static_literals_met
|
|||||||
case PM_FLOAT_NODE: {
|
case PM_FLOAT_NODE: {
|
||||||
const double value = ((const pm_float_node_t *) node)->value;
|
const double value = ((const pm_float_node_t *) node)->value;
|
||||||
|
|
||||||
if (isinf(value)) {
|
if (
|
||||||
|
#ifdef _WIN32
|
||||||
|
!_finite(value)
|
||||||
|
#else
|
||||||
|
isinf(value)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
if (*node->location.start == '-') {
|
if (*node->location.start == '-') {
|
||||||
pm_buffer_append_byte(buffer, '-');
|
pm_buffer_append_byte(buffer, '-');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user