diff options
author | David Mitchell <davem@iabyn.com> | 2013-11-24 19:44:41 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-11-24 20:24:25 +0000 |
commit | 04783dc7025287c5d75ab531602c7ec786a1e787 (patch) | |
tree | 049174f15e0cc2c532f5e4b5b072a8fa42350df6 /perlio.c | |
parent | 7616a0c2898b38b86404e7b0afa635e0bf786677 (diff) | |
download | perl-04783dc7025287c5d75ab531602c7ec786a1e787.tar.gz |
fix 'ignoring return value' compiler warnings
Various system functions like write() are marked with the
__warn_unused_result__ attribute, which causes an 'ignoring return value'
warning to be emitted, even if the function call result is cast to (void).
The generic solution seems to be
int rc = write(...);
PERL_UNUSED_VAR(rc);
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -457,13 +457,14 @@ PerlIO_debug(const char *fmt, ...) } } if (PL_perlio_debug_fd > 0) { + int rc = 0; #ifdef USE_ITHREADS const char * const s = CopFILE(PL_curcop); /* 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)); const STRLEN len2 = my_vsnprintf(buffer + len1, sizeof(buffer) - len1, fmt, ap); - (void)PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + len2); + rc = PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + len2); #else const char *s = CopFILE(PL_curcop); STRLEN len; @@ -472,9 +473,11 @@ PerlIO_debug(const char *fmt, ...) Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap); s = SvPV_const(sv, len); - (void)PerlLIO_write(PL_perlio_debug_fd, s, len); + rc = PerlLIO_write(PL_perlio_debug_fd, s, len); SvREFCNT_dec(sv); #endif + /* silently ignore failures */ + PERL_UNUSED_VAR(rc); } va_end(ap); } |