summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2018-09-13 11:45:14 +1000
committerJames E Keenan <jkeenan@cpan.org>2018-09-12 21:53:18 -0400
commit048eef38d279ddf78457ab69d37b9f2cdd096c2a (patch)
tree1e70ad15591830645e1c2388675921ae5fa21696 /perlio.c
parent9d3dfe483399b257dc3160af2acd0f8a715070a5 (diff)
downloadperl-048eef38d279ddf78457ab69d37b9f2cdd096c2a.tar.gz
(perl #133510) can't use my_vsnprintf() on quadmath/threaded builds
Since anything with quadmath should be recent enough to have vsnprintf() I've fallen back to that. Calls to PerlIO_debug() in core don't include floating point values and I expect it to be unlikely outside of core - if it is needed they'll just have to use double formatting/types.
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/perlio.c b/perlio.c
index f5eb4851b6..3a2f9120d3 100644
--- a/perlio.c
+++ b/perlio.c
@@ -371,7 +371,19 @@ PerlIO_debug(const char *fmt, ...)
/* Use fixed buffer as sv_catpvf etc. needs SVs */
char buffer[1024];
const STRLEN len1 = my_snprintf(buffer, sizeof(buffer), "%.40s:%" IVdf " ", s ? s : "(none)", (IV) CopLINE(PL_curcop));
+# ifdef USE_QUADMATH
+# ifdef HAS_VSNPRINTF
+ /* my_vsnprintf() isn't available with quadmath, but the native vsnprintf()
+ should be, otherwise the system isn't likely to support quadmath.
+ Nothing should be calling PerlIO_debug() with floating point anyway.
+ */
+ const STRLEN len2 = vsnprintf(buffer + len1, sizeof(buffer) - len1, fmt, ap);
+# else
+ STATIC_ASSERT_STMT(0);
+# endif
+# else
const STRLEN len2 = my_vsnprintf(buffer + len1, sizeof(buffer) - len1, fmt, ap);
+# endif
PERL_UNUSED_RESULT(PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + len2));
#else
const char *s = CopFILE(PL_curcop);