diff options
author | Kevin Newton <[email protected]> | 2024-12-02 14:40:55 -0500 |
---|---|---|
committer | git <[email protected]> | 2024-12-02 20:19:52 +0000 |
commit | c8dd0479553d4c872b41d667c8fc7a9340594a08 (patch) | |
tree | 5d2af2991067171cdd3c338ef74e14eccbf3a949 | |
parent | 05346b19b994eb254c5144d168197f2a5eb0ba76 (diff) |
[ruby/prism] _finitef is unavailable on Windows x86
Instead cast it inline to a double on Windows.
https://github.com/ruby/prism/commit/9064d872aa
-rw-r--r-- | prism/defines.h | 11 | ||||
-rw-r--r-- | prism/prism.c | 9 | ||||
-rw-r--r-- | prism/static_literals.c | 8 |
3 files changed, 15 insertions, 13 deletions
diff --git a/prism/defines.h b/prism/defines.h index e78c7dd75c..785361728e 100644 --- a/prism/defines.h +++ b/prism/defines.h @@ -137,17 +137,6 @@ #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 * "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc, * xrealloc, xcalloc, and xfree. diff --git a/prism/prism.c b/prism/prism.c index 01e92aa817..d547c7a2d2 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -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 // 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; const char *ellipsis; diff --git a/prism/static_literals.c b/prism/static_literals.c index b8604321c9..a2935db86e 100644 --- a/prism/static_literals.c +++ b/prism/static_literals.c @@ -501,7 +501,13 @@ pm_static_literal_inspect_node(pm_buffer_t *buffer, const pm_static_literals_met case PM_FLOAT_NODE: { 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 == '-') { pm_buffer_append_byte(buffer, '-'); } |