In perl.git, the branch maint-5.20 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/889a599c2e07608316e68d3ea74fe1045e54ecc9?hp=879f34634bf378b83723973922fab2ce47f3eae8>

- Log -----------------------------------------------------------------
commit 889a599c2e07608316e68d3ea74fe1045e54ecc9
Author: Steve Hay <[email protected]>
Date:   Mon Jul 28 08:31:14 2014 +0100

    perldelta - Update list of upgraded modules

M       pod/perldelta.pod

commit 0fdd39c4bec9b46edf1d4798a88afb6b08072535
Author: Lukas Mai <[email protected]>
Date:   Sun Jul 27 09:09:50 2014 -0400

    POSIX.pod: Document correct redirect for 'atexit'.
    
    For: RT #122412
    (cherry picked from commit ce5b0b849c4a3e4d77dc60096ae4170609a81644)

M       ext/POSIX/lib/POSIX.pod

commit 3ef89b7f82e9e1612141cc4ad6fb0f79b23efbd0
Author: Karl Williamson <[email protected]>
Date:   Fri Jul 25 14:44:46 2014 -0600

    perlop: Nits
    
    (cherry picked from commit c3e9d7a98ad8340994f5f9d9ddf6c792f0875b81)

M       pod/perlop.pod

commit 308905020c2e83a33ef473c176da40b7ab66e4e7
Author: Karl Williamson <[email protected]>
Date:   Fri Jul 25 11:31:26 2014 -0600

    perlop: Update text to reflect code changes
    
    The warning message is no longer misleading, so no need to point out
    anything about it.
    
    (cherry picked from commit 7ea906bb370ef79b0aee20cbb8768c72eb0d22c6)

M       pod/perlop.pod

commit 022f533d0cc787f500a90d6e86d2a760fd5cd282
Author: Jarkko Hietaniemi <[email protected]>
Date:   Mon Jul 28 08:13:54 2014 +0100

    Use PERL_UNUSED_RESULT.
    
    (1) Enhance its description.
    (2) Simplify it: define only if has warn_unused_result.
    (3) Make it use STMT_START { ... } STMT_END to be less GNU-extensiony.
    (4) Redo 04783dc7 ("fix 'ignoring return value' compiler warnings") with it.
    
    (cherry picked from commit b469f1e0fc5f0ac882161e627a1255ee11e67c37)

M       doio.c
M       ext/SDBM_File/sdbm/sdbm.c
M       mg.c
M       perl.h
M       perlio.c
M       pp_hot.c
M       thread.h
M       util.c

commit f8572ac04929824ffc6e45896476ac3e3610c4e9
Author: Jarkko Hietaniemi <[email protected]>
Date:   Wed May 28 12:46:05 2014 -0400

    Move the PERL_GCC_BRACE_GROUPS_FORBIDDEN earlier.
    
    The PERL_UNUSED_RESULT needs it to avoid using the brace groups
    when going -pedantic.
    
    (cherry picked from commit 24e7ff4ea7e35b5aed3b22dd00848a50f81fad4b)

M       perl.h

commit 91828353d19d496037ed51cb87545371defd4465
Author: Jarkko Hietaniemi <[email protected]>
Date:   Sun Apr 27 20:52:54 2014 -0400

    Add PERL_UNUSED_RESULT() and use that instead of the V_Gconvert().
    
    (cherry picked from commit ffea512f3e5e645945e337a9aa70a304cd695df3)

M       perl.h
M       sv.c
-----------------------------------------------------------------------

Summary of changes:
 doio.c                    | 13 ++++-------
 ext/POSIX/lib/POSIX.pod   |  2 +-
 ext/SDBM_File/sdbm/sdbm.c |  5 ++--
 mg.c                      | 52 ++++++++++++++++++-----------------------
 perl.h                    | 59 ++++++++++++++++++++++++++++++++++++-----------
 perlio.c                  |  7 ++----
 pod/perldelta.pod         | 12 ++++++++++
 pod/perlop.pod            | 18 ++++++---------
 pp_hot.c                  | 45 ++++++++++++++++++------------------
 sv.c                      | 19 ++++-----------
 thread.h                  |  4 +---
 util.c                    |  8 ++-----
 12 files changed, 128 insertions(+), 116 deletions(-)

diff --git a/doio.c b/doio.c
index e2bfda5..05213e9 100644
--- a/doio.c
+++ b/doio.c
@@ -963,16 +963,14 @@ Perl_nextargv(pTHX_ GV *gv)
                (void)PerlLIO_chmod(PL_oldname,PL_filemode);
 #endif
                if (fileuid != PL_statbuf.st_uid || filegid != 
PL_statbuf.st_gid) {
-                    int rc = 0;
+                   /* XXX silently ignore failures */
 #ifdef HAS_FCHOWN
-                   rc = fchown(PL_lastfd,fileuid,filegid);
+                   PERL_UNUSED_RESULT(fchown(PL_lastfd,fileuid,filegid));
 #else
 #ifdef HAS_CHOWN
-                   rc = PerlLIO_chown(PL_oldname,fileuid,filegid);
+                   
PERL_UNUSED_RESULT(PerlLIO_chown(PL_oldname,fileuid,filegid));
 #endif
 #endif
-                    /* XXX silently ignore failures */
-                    PERL_UNUSED_VAR(rc);
                }
                 return IoIFP(GvIOp(gv));
            }
@@ -1487,9 +1485,8 @@ S_exec_failed(pTHX_ const char *cmd, int fd, int 
do_report)
        Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't exec \"%s\": %s",
                    cmd, Strerror(e));
     if (do_report) {
-        int rc = PerlLIO_write(fd, (void*)&e, sizeof(int));
-        /* silently ignore failures */
-        PERL_UNUSED_VAR(rc);
+        /* XXX silently ignore failures */
+        PERL_UNUSED_RESULT(PerlLIO_write(fd, (void*)&e, sizeof(int)));
        PerlLIO_close(fd);
     }
 }
diff --git a/ext/POSIX/lib/POSIX.pod b/ext/POSIX/lib/POSIX.pod
index ee1e77a..94a5f9d 100644
--- a/ext/POSIX/lib/POSIX.pod
+++ b/ext/POSIX/lib/POSIX.pod
@@ -146,7 +146,7 @@ coordinate and the I<x> coordinate.  See also L<Math::Trig>.
 
 =item C<atexit>
 
-C<atexit()> is C-specific: use C<END {}> instead, see L<perlsub>.
+C<atexit()> is C-specific: use C<END {}> instead, see L<perlmod>.
 
 =item C<atof>
 
diff --git a/ext/SDBM_File/sdbm/sdbm.c b/ext/SDBM_File/sdbm/sdbm.c
index f5f893c..5241fea 100644
--- a/ext/SDBM_File/sdbm/sdbm.c
+++ b/ext/SDBM_File/sdbm/sdbm.c
@@ -379,8 +379,9 @@ makroom(DBM *db, long int hash, int need)
  */
 #ifdef BADMESS
        rc = write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44);
-        (void)rc;
-
+       /* PERL_UNUSED_VAR() or PERL_UNUSED_RESULT() would be
+        * useful here but that would mean pulling in perl.h */
+       (void)rc;
 #endif
        return 0;
 
diff --git a/mg.c b/mg.c
index 76912bd..c18d4b7 100644
--- a/mg.c
+++ b/mg.c
@@ -2831,7 +2831,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
        break;
     case '<':
        {
-        int rc = 0;
+        /* XXX $< currently silently ignores failures */
        const Uid_t new_uid = SvUID(sv);
        PL_delaymagic_uid = new_uid;
        if (PL_delaymagic) {
@@ -2839,34 +2839,32 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
            break;                              /* don't do magic till later */
        }
 #ifdef HAS_SETRUID
-       rc = setruid(new_uid);
+       PERL_UNUSED_RESULT(setruid(new_uid));
 #else
 #ifdef HAS_SETREUID
-        rc = setreuid(new_uid, (Uid_t)-1);
+        PERL_UNUSED_RESULT(setreuid(new_uid, (Uid_t)-1));
 #else
 #ifdef HAS_SETRESUID
-       rc = setresuid(new_uid, (Uid_t)-1, (Uid_t)-1);
+        PERL_UNUSED_RESULT(setresuid(new_uid, (Uid_t)-1, (Uid_t)-1));
 #else
        if (new_uid == PerlProc_geteuid()) {            /* special case $< = $> 
*/
 #ifdef PERL_DARWIN
            /* workaround for Darwin's setuid peculiarity, cf [perl #24122] */
            if (new_uid != 0 && PerlProc_getuid() == 0)
-                rc = PerlProc_setuid(0);
+                PERL_UNUSED_RESULT(PerlProc_setuid(0));
 #endif
-            rc = PerlProc_setuid(new_uid);
+            PERL_UNUSED_RESULT(PerlProc_setuid(new_uid));
        } else {
            Perl_croak(aTHX_ "setruid() not implemented");
        }
 #endif
 #endif
 #endif
-        /* XXX $< currently silently ignores failures */
-        PERL_UNUSED_VAR(rc);
        break;
        }
     case '>':
        {
-        int rc = 0;
+        /* XXX $> currently silently ignores failures */
        const Uid_t new_euid = SvUID(sv);
        PL_delaymagic_euid = new_euid;
        if (PL_delaymagic) {
@@ -2874,29 +2872,27 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
            break;                              /* don't do magic till later */
        }
 #ifdef HAS_SETEUID
-       rc = seteuid(new_euid);
+       PERL_UNUSED_RESULT(seteuid(new_euid));
 #else
 #ifdef HAS_SETREUID
-       rc = setreuid((Uid_t)-1, new_euid);
+       PERL_UNUSED_RESULT(setreuid((Uid_t)-1, new_euid));
 #else
 #ifdef HAS_SETRESUID
-       rc = setresuid((Uid_t)-1, new_euid, (Uid_t)-1);
+       PERL_UNUSED_RESULT(setresuid((Uid_t)-1, new_euid, (Uid_t)-1));
 #else
        if (new_euid == PerlProc_getuid())              /* special case $> = $< 
*/
-           rc = PerlProc_setuid(new_euid);
+           PERL_UNUSED_RESULT(PerlProc_setuid(new_euid));
        else {
            Perl_croak(aTHX_ "seteuid() not implemented");
        }
 #endif
 #endif
 #endif
-        /* XXX $> currently silently ignores failures */
-        PERL_UNUSED_VAR(rc);
        break;
        }
     case '(':
        {
-        int rc = 0;
+        /* XXX $( currently silently ignores failures */
        const Gid_t new_gid = SvGID(sv);
        PL_delaymagic_gid = new_gid;
        if (PL_delaymagic) {
@@ -2904,29 +2900,27 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
            break;                              /* don't do magic till later */
        }
 #ifdef HAS_SETRGID
-       rc = setrgid(new_gid);
+       PERL_UNUSED_RESULT(setrgid(new_gid));
 #else
 #ifdef HAS_SETREGID
-       rc = setregid(new_gid, (Gid_t)-1);
+       PERL_UNUSED_RESULT(setregid(new_gid, (Gid_t)-1));
 #else
 #ifdef HAS_SETRESGID
-        rc = setresgid(new_gid, (Gid_t)-1, (Gid_t) -1);
+        PERL_UNUSED_RESULT(setresgid(new_gid, (Gid_t)-1, (Gid_t) -1));
 #else
        if (new_gid == PerlProc_getegid())                      /* special case 
$( = $) */
-           rc = PerlProc_setgid(new_gid);
+           PERL_UNUSED_RESULT(PerlProc_setgid(new_gid));
        else {
            Perl_croak(aTHX_ "setrgid() not implemented");
        }
 #endif
 #endif
 #endif
-        /* XXX $( currently silently ignores failures */
-        PERL_UNUSED_VAR(rc);
        break;
        }
     case ')':
        {
-        int rc = 0;
+        /* XXX $) currently silently ignores failures */
        Gid_t new_egid;
 #ifdef HAS_SETGROUPS
        {
@@ -2958,7 +2952,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
                 gary[i] = (Groups_t)Atol(p);
             }
             if (i)
-                rc = setgroups(i, gary);
+                PERL_UNUSED_RESULT(setgroups(i, gary));
            Safefree(gary);
        }
 #else  /* HAS_SETGROUPS */
@@ -2970,24 +2964,22 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
            break;                              /* don't do magic till later */
        }
 #ifdef HAS_SETEGID
-       rc = setegid(new_egid);
+       PERL_UNUSED_RESULT(setegid(new_egid));
 #else
 #ifdef HAS_SETREGID
-       rc = setregid((Gid_t)-1, new_egid);
+       PERL_UNUSED_RESULT(setregid((Gid_t)-1, new_egid));
 #else
 #ifdef HAS_SETRESGID
-       rc = setresgid((Gid_t)-1, new_egid, (Gid_t)-1);
+       PERL_UNUSED_RESULT(setresgid((Gid_t)-1, new_egid, (Gid_t)-1));
 #else
        if (new_egid == PerlProc_getgid())                      /* special case 
$) = $( */
-           rc = PerlProc_setgid(new_egid);
+           PERL_UNUSED_RESULT(PerlProc_setgid(new_egid));
        else {
            Perl_croak(aTHX_ "setegid() not implemented");
        }
 #endif
 #endif
 #endif
-        /* XXX $) currently silently ignores failures */
-        PERL_UNUSED_VAR(rc);
        break;
        }
     case ':':
diff --git a/perl.h b/perl.h
index 6da39f3..961216b 100644
--- a/perl.h
+++ b/perl.h
@@ -327,6 +327,52 @@
 #  define PERL_UNUSED_CONTEXT
 #endif
 
+/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions,
+ * g++ allows them but seems to have problems with them
+ * (insane errors ensue).
+ * g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2).
+ */
+#if defined(PERL_GCC_PEDANTIC) || \
+    (defined(__GNUC__) && defined(__cplusplus) && \
+       ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2))))
+#  ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
+#    define PERL_GCC_BRACE_GROUPS_FORBIDDEN
+#  endif
+#endif
+
+/* Use PERL_UNUSED_RESULT() to suppress the warnings about unused results
+ * of function calls, e.g. PERL_UNUSED_RESULT(foo(a, b)).
+ *
+ * The main reason for this is that the combination of gcc -Wunused-result
+ * (part of -Wall) and the __attribute__((warn_unused_result)) cannot
+ * be silenced with casting to void.  This causes trouble when the system
+ * header files use the attribute.
+ *
+ * Use PERL_UNUSED_RESULT sparingly, though, since usually the warning
+ * is there for a good reason: you might lose success/failure information,
+ * or leak resources, or changes in resources.
+ *
+ * But sometimes you just want to ignore the return value, e.g. on
+ * codepaths soon ending up in abort, or in "best effort" attempts,
+ * or in situations where there is no good way to handle failures.
+ *
+ * Sometimes PERL_UNUSED_RESULT might not be the most natural way:
+ * another possibility is that you can capture the return value
+ * and use PERL_UNUSED_VAR on that.
+ *
+ * The __typeof__() is used instead of typeof() since typeof() is not
+ * available under strict C89, and because of compilers masquerading
+ * as gcc (clang and icc), we want exactly the gcc extension
+ * __typeof__ and nothing else.
+ */
+#ifndef PERL_UNUSED_RESULT
+#  if defined(__GNUC__) && defined(HASATTRIBUTE_WARN_UNUSED_RESULT)
+#    define PERL_UNUSED_RESULT(v) STMT_START { __typeof__(v) z = (v); 
(void)sizeof(z); } STMT_END
+#  else
+#    define PERL_UNUSED_RESULT(v) ((void)(v))
+#  endif
+#endif
+
 /* on gcc (and clang), specify that a warning should be temporarily
  * ignored; e.g.
  *
@@ -447,19 +493,6 @@
 #  endif
 #endif
 
-/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions,
- * g++ allows them but seems to have problems with them
- * (insane errors ensue).
- * g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2).
- */
-#if defined(PERL_GCC_PEDANTIC) || \
-    (defined(__GNUC__) && defined(__cplusplus) && \
-       ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2))))
-#  ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
-#    define PERL_GCC_BRACE_GROUPS_FORBIDDEN
-#  endif
-#endif
-
 #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && 
!defined(__cplusplus)
 #  ifndef PERL_USE_GCC_BRACE_GROUPS
 #    define PERL_USE_GCC_BRACE_GROUPS
diff --git a/perlio.c b/perlio.c
index 36bdb37..69c1b32 100644
--- a/perlio.c
+++ b/perlio.c
@@ -387,14 +387,13 @@ 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);
-       rc = PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + len2);
+       PERL_UNUSED_RESULT(PerlLIO_write(PL_perlio_debug_fd, buffer, len1 + 
len2));
 #else
        const char *s = CopFILE(PL_curcop);
        STRLEN len;
@@ -403,11 +402,9 @@ PerlIO_debug(const char *fmt, ...)
        Perl_sv_vcatpvf(aTHX_ sv, fmt, &ap);
 
        s = SvPV_const(sv, len);
-       rc = PerlLIO_write(PL_perlio_debug_fd, s, len);
+       PERL_UNUSED_RESULT(PerlLIO_write(PL_perlio_debug_fd, s, len));
        SvREFCNT_dec(sv);
 #endif
-        /* silently ignore failures */
-        PERL_UNUSED_VAR(rc);
     }
     va_end(ap);
 }
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index f19d1aa..bdbaf2c 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -79,6 +79,12 @@ Illegal POD syntax in the documentation has been corrected.
 
 =item *
 
+L<File::Copy> has been upgraded from version 2.29 to 2.30.
+
+The documentation now notes that C<copy> will not overwrite read-only files.
+
+=item *
+
 L<Module::CoreList> has been upgraded from version 3.11 to 5.020001.
 
 The list of Perl versions covered has been updated.
@@ -93,6 +99,12 @@ L<[perl 
#121963]|https://rt.perl.org/Ticket/Display.html?id=121963>
 
 =item *
 
+L<PerlIO::via> has been upgraded from version 0.14 to 0.15.
+
+A minor portability improvement has been made to the XS implementation.
+
+=item *
+
 L<Unicode::UCD> has been upgraded from version 0.57 to 0.58.
 
 The documentation includes many clarifications and fixes.
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 0535bfd..888ba53 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -1434,10 +1434,12 @@ table:
    \c[      chr(27)
    \c]      chr(29)
    \c^      chr(30)
-   \c?      chr(127)
+   \c_      chr(31)
+   \c?      chr(127) # (on ASCII platforms)
 
 In other words, it's the character whose code point has had 64 xor'd with
-its uppercase.  C<\c?> is DELETE because C<ord("?") ^ 64> is 127, and
+its uppercase.  C<\c?> is DELETE on ASCII platforms because
+S<C<ord("?") ^ 64>> is 127, and
 C<\c@> is NULL because the ord of "@" is 64, so xor'ing 64 itself produces 0.
 
 Also, C<\c\I<X>> yields C< chr(28) . "I<X>"> for any I<X>, but cannot come at 
the
@@ -1446,10 +1448,10 @@ quote.
 
 On ASCII platforms, the resulting characters from the list above are the
 complete set of ASCII controls.  This isn't the case on EBCDIC platforms; see
-L<perlebcdic/OPERATOR DIFFERENCES> for the complete list of what these
-sequences mean on both ASCII and EBCDIC platforms.
+L<perlebcdic/OPERATOR DIFFERENCES> for a full discussion of the
+differences between these for ASCII versus EBCDIC platforms.
 
-Use of any other character following the "c" besides those listed above is
+Use of any other character following the C<"c"> besides those listed above is
 discouraged, and some are deprecated with the intention of removing
 those in a later Perl version.  What happens for any of these
 other characters currently though, is that the value is derived by xor'ing
@@ -1483,12 +1485,6 @@ the left with zeros to make three digits.  For larger 
ordinals, either use
 C<\o{}>, or convert to something else, such as to hex and use C<\x{}>
 instead.
 
-Having fewer than 3 digits may lead to a misleading warning message that says
-that what follows is ignored.  For example, C<"\128"> in the ASCII character 
set
-is equivalent to the two characters C<"\n8">, but the warning C<Illegal octal
-digit '8' ignored> will be thrown.  If C<"\n8"> is what you want, you can
-avoid this warning by padding your octal number with C<0>'s: C<"\0128">.
-
 =item [8]
 
 Several constructs above specify a character by a number.  That number
diff --git a/pp_hot.c b/pp_hot.c
index 2cccc48..7b92187 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1182,82 +1182,81 @@ PP(pp_aassign)
        }
     }
     if (UNLIKELY(PL_delaymagic & ~DM_DELAY)) {
-        int rc = 0;
        /* Will be used to set PL_tainting below */
        Uid_t tmp_uid  = PerlProc_getuid();
        Uid_t tmp_euid = PerlProc_geteuid();
        Gid_t tmp_gid  = PerlProc_getgid();
        Gid_t tmp_egid = PerlProc_getegid();
 
+        /* XXX $> et al currently silently ignore failures */
        if (PL_delaymagic & DM_UID) {
 #ifdef HAS_SETRESUID
-           rc = setresuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid  : 
(Uid_t)-1,
-                           (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : 
(Uid_t)-1,
-                           (Uid_t)-1);
+           PERL_UNUSED_RESULT(
+               setresuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid  : 
(Uid_t)-1,
+                         (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : 
(Uid_t)-1,
+                         (Uid_t)-1));
 #else
 #  ifdef HAS_SETREUID
-           rc = setreuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid  : 
(Uid_t)-1,
-                          (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : 
(Uid_t)-1);
+            PERL_UNUSED_RESULT(
+                setreuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid  : 
(Uid_t)-1,
+                         (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : 
(Uid_t)-1));
 #  else
 #    ifdef HAS_SETRUID
            if ((PL_delaymagic & DM_UID) == DM_RUID) {
-               rc = setruid(PL_delaymagic_uid);
+               PERL_UNUSED_RESULT(setruid(PL_delaymagic_uid));
                PL_delaymagic &= ~DM_RUID;
            }
 #    endif /* HAS_SETRUID */
 #    ifdef HAS_SETEUID
            if ((PL_delaymagic & DM_UID) == DM_EUID) {
-               rc = seteuid(PL_delaymagic_euid);
+               PERL_UNUSED_RESULT(seteuid(PL_delaymagic_euid));
                PL_delaymagic &= ~DM_EUID;
            }
 #    endif /* HAS_SETEUID */
            if (PL_delaymagic & DM_UID) {
                if (PL_delaymagic_uid != PL_delaymagic_euid)
                    DIE(aTHX_ "No setreuid available");
-               rc = PerlProc_setuid(PL_delaymagic_uid);
+               PERL_UNUSED_RESULT(PerlProc_setuid(PL_delaymagic_uid));
            }
 #  endif /* HAS_SETREUID */
 #endif /* HAS_SETRESUID */
 
-            /* XXX $> et al currently silently ignore failures */
-            PERL_UNUSED_VAR(rc);
-
            tmp_uid  = PerlProc_getuid();
            tmp_euid = PerlProc_geteuid();
        }
+        /* XXX $> et al currently silently ignore failures */
        if (PL_delaymagic & DM_GID) {
 #ifdef HAS_SETRESGID
-           rc = setresgid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid  : 
(Gid_t)-1,
-                           (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : 
(Gid_t)-1,
-                           (Gid_t)-1);
+           PERL_UNUSED_RESULT(
+                setresgid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid  : 
(Gid_t)-1,
+                          (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : 
(Gid_t)-1,
+                          (Gid_t)-1));
 #else
 #  ifdef HAS_SETREGID
-           rc = setregid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid  : 
(Gid_t)-1,
-                          (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : 
(Gid_t)-1);
+           PERL_UNUSED_RESULT(
+                setregid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid  : 
(Gid_t)-1,
+                         (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : 
(Gid_t)-1));
 #  else
 #    ifdef HAS_SETRGID
            if ((PL_delaymagic & DM_GID) == DM_RGID) {
-               rc = setrgid(PL_delaymagic_gid);
+               PERL_UNUSED_RESULT(setrgid(PL_delaymagic_gid));
                PL_delaymagic &= ~DM_RGID;
            }
 #    endif /* HAS_SETRGID */
 #    ifdef HAS_SETEGID
            if ((PL_delaymagic & DM_GID) == DM_EGID) {
-               rc = setegid(PL_delaymagic_egid);
+               PERL_UNUSED_RESULT(setegid(PL_delaymagic_egid));
                PL_delaymagic &= ~DM_EGID;
            }
 #    endif /* HAS_SETEGID */
            if (PL_delaymagic & DM_GID) {
                if (PL_delaymagic_gid != PL_delaymagic_egid)
                    DIE(aTHX_ "No setregid available");
-               rc = PerlProc_setgid(PL_delaymagic_gid);
+               PERL_UNUSED_RESULT(PerlProc_setgid(PL_delaymagic_gid));
            }
 #  endif /* HAS_SETREGID */
 #endif /* HAS_SETRESGID */
 
-            /* XXX $> et al currently silently ignore failures */
-            PERL_UNUSED_VAR(rc);
-
            tmp_gid  = PerlProc_getgid();
            tmp_egid = PerlProc_getegid();
        }
diff --git a/sv.c b/sv.c
index e1a93fa..e1962ce 100644
--- a/sv.c
+++ b/sv.c
@@ -113,13 +113,6 @@
  * has a mandatory return value, even though that value is just the same
  * as the buf arg */
 
-#define V_Gconvert(x,n,t,b) \
-{ \
-    char *rc = (char *)Gconvert(x,n,t,b); \
-    PERL_UNUSED_VAR(rc); \
-}
-
-
 #ifdef PERL_UTF8_CACHE_ASSERT
 /* if adding more checks watch out for the following tests:
  *   t/op/index.t t/op/length.t t/op/pat.t t/op/substr.t
@@ -2993,12 +2986,12 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, 
const I32 flags)
            /* some Xenix systems wipe out errno here */
 
 #ifndef USE_LOCALE_NUMERIC
-            V_Gconvert(SvNVX(sv), NV_DIG, 0, s);
+            PERL_UNUSED_RESULT(Gconvert(SvNVX(sv), NV_DIG, 0, s));
             SvPOK_on(sv);
 #else
             {
                 DECLARE_STORE_LC_NUMERIC_SET_TO_NEEDED();
-                V_Gconvert(SvNVX(sv), NV_DIG, 0, s);
+                PERL_UNUSED_RESULT(Gconvert(SvNVX(sv), NV_DIG, 0, s));
 
                 /* If the radix character is UTF-8, and actually is in the
                  * output, turn on the UTF-8 flag for the scalar */
@@ -10696,7 +10689,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char 
*const pat, const STRLEN p
                if (digits && digits < sizeof(ebuf) - NV_DIG - 10) {
                     /* 0, point, slack */
                     STORE_LC_NUMERIC_SET_TO_NEEDED();
-                   V_Gconvert(nv, (int)digits, 0, ebuf);
+                   PERL_UNUSED_RESULT(Gconvert(nv, (int)digits, 0, ebuf));
                    sv_catpv_nomg(sv, ebuf);
                    if (*ebuf)  /* May return an empty string for digits==0 */
                        return;
@@ -11554,7 +11547,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char 
*const pat, const STRLEN p
                   aka precis is 0  */
                if ( c == 'g' && precis) {
                     STORE_LC_NUMERIC_SET_TO_NEEDED();
-                   V_Gconvert((NV)nv, (int)precis, 0, PL_efloatbuf);
+                   PERL_UNUSED_RESULT(Gconvert((NV)nv, (int)precis, 0, 
PL_efloatbuf));
                    /* May return an empty string for digits==0 */
                    if (*PL_efloatbuf) {
                        elen = strlen(PL_efloatbuf);
@@ -11985,7 +11978,6 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const 
param)
     DIR *ret;
 
 #if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
-    int rc = 0;
     DIR *pwd;
     const Direntry_t *dirent;
     char smallbuf[256];
@@ -12022,9 +12014,8 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const 
param)
     /* Now we should have two dir handles pointing to the same dir. */
 
     /* Be nice to the calling code and chdir back to where we were. */
-    rc = fchdir(my_dirfd(pwd));
     /* XXX If this fails, then what? */
-    PERL_UNUSED_VAR(rc);
+    PERL_UNUSED_RESULT(fchdir(my_dirfd(pwd)));
 
     /* We have no need of the pwd handle any more. */
     PerlDir_close(pwd);
diff --git a/thread.h b/thread.h
index cd55635..43932fb 100644
--- a/thread.h
+++ b/thread.h
@@ -336,9 +336,7 @@
 #  define ALLOC_THREAD_KEY \
     STMT_START {                                               \
        if (pthread_key_create(&PL_thr_key, 0)) {               \
-            int rc;                                             \
-            rc = write(2, STR_WITH_LEN("panic: pthread_key_create failed\n")); 
\
-            PERL_UNUSED_VAR(rc);                                \
+            PERL_UNUSED_RESULT(write(2, STR_WITH_LEN("panic: 
pthread_key_create failed\n"))); \
            exit(1);                                            \
        }                                                       \
     } STMT_END
diff --git a/util.c b/util.c
index 998f0a0..4d28e36 100644
--- a/util.c
+++ b/util.c
@@ -1711,13 +1711,9 @@ void
 Perl_croak_no_mem(void)
 {
     dTHX;
-    int rc;
-
     /* Can't use PerlIO to write as it allocates memory */
-    rc = PerlLIO_write(PerlIO_fileno(Perl_error_log),
-                 PL_no_mem, sizeof(PL_no_mem)-1);
-    /* silently ignore failures */
-    PERL_UNUSED_VAR(rc);
+    PERL_UNUSED_RESULT(PerlLIO_write(PerlIO_fileno(Perl_error_log),
+                 PL_no_mem, sizeof(PL_no_mem)-1));
     my_exit(1);
 }
 

--
Perl5 Master Repository

Reply via email to