summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2020-10-21 11:02:20 +1100
committerTony Cook <tony@develop-help.com>2020-10-26 22:34:54 +0000
commitdfee93524089fd4fa372ce7e0dd15e2809b5c540 (patch)
tree07349e82abd751f7d5881f455730967d1c3a9d46 /numeric.c
parente8581bc2c747ca29bf14cd33600912bfc5a00bf0 (diff)
downloadperl-dfee93524089fd4fa372ce7e0dd15e2809b5c540.tar.gz
remove dead code when using Perl_strtod for numeric conversion
which is the common case. If strtod() is disabled, (and USE_PERL_ATOF isn't also disabled) this code is used, so I moved it into the #elif block. It's also possible to Configure disabling both strtod() and USE_PERL_ATOF with: ./Configure ... -Ud_strtod -Accflags=-DUSE_PERL_ATOF=0 ... which resulted in a build with a broken Perl_my_atof3(), so fail the build early with #error in that case.
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 5fb7623136..154830b13a 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1843,9 +1843,15 @@ Perl_my_atof3(pTHX_ const char* orig, NV* value, const STRLEN len)
/* now apply the sign */
if (negative)
result[2] = -result[2];
-#endif /* USE_PERL_ATOF */
*value = result[2];
return (char *)s;
+#else /* USE_PERL_ATOF */
+ /* If you see this error you both don't have strtod (or configured -Ud_strtod or
+ or it's long double/quadmath equivalent) and disabled USE_PERL_ATOF, thus
+ removing any way for perl to convert strings to floating point numbers.
+ */
+# error No mechanism to convert strings to numbers available
+#endif
}
/*