From 048eef38d279ddf78457ab69d37b9f2cdd096c2a Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Thu, 13 Sep 2018 11:45:14 +1000 Subject: (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. --- perlio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'perlio.c') 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); -- cgit v1.2.1