diff options
author | Karl Williamson <khw@cpan.org> | 2016-11-17 06:21:54 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2016-11-18 09:41:07 -0700 |
commit | 147e38468b8279e26a0ca11e4efd8492016f2702 (patch) | |
tree | 4d3c3b5b692937fc40e2fed20aaa1b7afd3ba56e /pp_sys.c | |
parent | 51d89e3583b4182c42c21b343376f2286f67fc3b (diff) | |
download | perl-147e38468b8279e26a0ca11e4efd8492016f2702.tar.gz |
Change white space to avoid C++ deprecation warning
C++11 requires space between the end of a string literal and a macro, so
that a feature can unambiguously be added to the language. Starting in
g++ 6.2, the compiler emits a warning when there isn't a space
(presumably so that future versions can support C++11). Unfortunately
there are many such instances in the perl core. This commit fixes
those, including those in ext/, but individual commits will be used for
the other modules, those in dist/ and cpan/.
This commit also inserts space at the end of a macro before a string
literal, even though that is not deprecated, and removes useless ""
literals following a macro (instead of inserting a blank). The result
is easier to read, making the macro stand out, and be clearer as to the
intention.
Code and modules included with the Perl core need to be compilable using
C++. This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.) So we need to accommodate
changes to the C++ language.
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 54 |
1 files changed, 27 insertions, 27 deletions
@@ -462,7 +462,7 @@ PP(pp_warn) } } if (SvROK(exsv) && !PL_warnhook) - Perl_warn(aTHX_ "%"SVf, SVfARG(exsv)); + Perl_warn(aTHX_ "%" SVf, SVfARG(exsv)); else warn_sv(exsv); RETSETYES; } @@ -630,7 +630,7 @@ PP(pp_open) if (IoDIRP(io)) Perl_ck_warner_d(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED), - "Opening dirhandle %"HEKf" also as a file", + "Opening dirhandle %" HEKf " also as a file", HEKfARG(GvENAME_HEK(gv))); mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); @@ -706,8 +706,8 @@ PP(pp_pipe_op) if (PerlProc_pipe(fd) < 0) goto badexit; - IoIFP(rstio) = PerlIO_fdopen(fd[0], "r"PIPE_OPEN_MODE); - IoOFP(wstio) = PerlIO_fdopen(fd[1], "w"PIPE_OPEN_MODE); + IoIFP(rstio) = PerlIO_fdopen(fd[0], "r" PIPE_OPEN_MODE); + IoOFP(wstio) = PerlIO_fdopen(fd[1], "w" PIPE_OPEN_MODE); IoOFP(rstio) = IoIFP(rstio); IoIFP(wstio) = IoOFP(wstio); IoTYPE(rstio) = IoTYPE_RDONLY; @@ -957,8 +957,8 @@ PP(pp_tie) if (!SvCUR(*MARK)) { stashname = sv_2mortal(newSVpvs("main")); } - DIE(aTHX_ "Can't locate object method \"%s\" via package \"%"SVf"\"" - " (perhaps you forgot to load \"%"SVf"\"?)", + DIE(aTHX_ "Can't locate object method \"%s\" via package \"%" SVf "\"" + " (perhaps you forgot to load \"%" SVf "\"?)", methname, SVfARG(stashname), SVfARG(stashname)); } else if (!(gv = gv_fetchmethod(stash, methname))) { @@ -966,7 +966,7 @@ PP(pp_tie) * been deleted from the symbol table, which this one can't * be, since we just looked it up by name. */ - DIE(aTHX_ "Can't locate object method \"%s\" via package \"%"HEKf"\"", + DIE(aTHX_ "Can't locate object method \"%s\" via package \"%" HEKf "\"", methname, HvENAME_HEK_NN(stash)); } ENTER_with_name("call_TIE"); @@ -1032,7 +1032,7 @@ PP(pp_untie) } else if (mg && SvREFCNT(obj) > 1) { Perl_ck_warner(aTHX_ packWARN(WARN_UNTIE), - "untie attempted while %"UVuf" inner references still exist", + "untie attempted while %" UVuf " inner references still exist", (UV)SvREFCNT(obj) - 1 ) ; } } @@ -1445,7 +1445,7 @@ PP(pp_enterwrite) if (!cv) { tmpsv = sv_newmortal(); gv_efullname4(tmpsv, fgv, NULL, FALSE); - DIE(aTHX_ "Undefined format \"%"SVf"\" called", SVfARG(tmpsv)); + DIE(aTHX_ "Undefined format \"%" SVf "\" called", SVfARG(tmpsv)); } IoFLAGS(io) &= ~IOf_DIDTOP; RETURNOP(doform(cv,gv,PL_op->op_next)); @@ -1480,7 +1480,7 @@ PP(pp_leavewrite) SV *topname; if (!IoFMT_NAME(io)) IoFMT_NAME(io) = savepv(GvNAME(gv)); - topname = sv_2mortal(Perl_newSVpvf(aTHX_ "%"HEKf"_TOP", + topname = sv_2mortal(Perl_newSVpvf(aTHX_ "%" HEKf "_TOP", HEKfARG(GvNAME_HEK(gv)))); topgv = gv_fetchsv(topname, 0, SVt_PVFM); if ((topgv && GvFORM(topgv)) || @@ -1528,7 +1528,7 @@ PP(pp_leavewrite) if (!cv) { SV * const sv = sv_newmortal(); gv_efullname4(sv, fgv, NULL, FALSE); - DIE(aTHX_ "Undefined top format \"%"SVf"\" called", SVfARG(sv)); + DIE(aTHX_ "Undefined top format \"%" SVf "\" called", SVfARG(sv)); } return doform(cv, gv, PL_op); } @@ -2512,8 +2512,8 @@ PP(pp_socket) if (fd < 0) { RETPUSHUNDEF; } - IoIFP(io) = PerlIO_fdopen(fd, "r"SOCKET_OPEN_MODE); /* stdio gets confused about sockets */ - IoOFP(io) = PerlIO_fdopen(fd, "w"SOCKET_OPEN_MODE); + IoIFP(io) = PerlIO_fdopen(fd, "r" SOCKET_OPEN_MODE); /* stdio gets confused about sockets */ + IoOFP(io) = PerlIO_fdopen(fd, "w" SOCKET_OPEN_MODE); IoTYPE(io) = IoTYPE_SOCKET; if (!IoIFP(io) || !IoOFP(io)) { if (IoIFP(io)) PerlIO_close(IoIFP(io)); @@ -2553,11 +2553,11 @@ PP(pp_sockpair) TAINT_PROPER("socketpair"); if (PerlSock_socketpair(domain, type, protocol, fd) < 0) RETPUSHUNDEF; - IoIFP(io1) = PerlIO_fdopen(fd[0], "r"SOCKET_OPEN_MODE); - IoOFP(io1) = PerlIO_fdopen(fd[0], "w"SOCKET_OPEN_MODE); + IoIFP(io1) = PerlIO_fdopen(fd[0], "r" SOCKET_OPEN_MODE); + IoOFP(io1) = PerlIO_fdopen(fd[0], "w" SOCKET_OPEN_MODE); IoTYPE(io1) = IoTYPE_SOCKET; - IoIFP(io2) = PerlIO_fdopen(fd[1], "r"SOCKET_OPEN_MODE); - IoOFP(io2) = PerlIO_fdopen(fd[1], "w"SOCKET_OPEN_MODE); + IoIFP(io2) = PerlIO_fdopen(fd[1], "r" SOCKET_OPEN_MODE); + IoOFP(io2) = PerlIO_fdopen(fd[1], "w" SOCKET_OPEN_MODE); IoTYPE(io2) = IoTYPE_SOCKET; if (!IoIFP(io1) || !IoOFP(io1) || !IoIFP(io2) || !IoOFP(io2)) { if (IoIFP(io1)) PerlIO_close(IoIFP(io1)); @@ -2676,8 +2676,8 @@ PP(pp_accept) goto badexit; if (IoIFP(nstio)) do_close(ngv, FALSE); - IoIFP(nstio) = PerlIO_fdopen(fd, "r"SOCKET_OPEN_MODE); - IoOFP(nstio) = PerlIO_fdopen(fd, "w"SOCKET_OPEN_MODE); + IoIFP(nstio) = PerlIO_fdopen(fd, "r" SOCKET_OPEN_MODE); + IoOFP(nstio) = PerlIO_fdopen(fd, "w" SOCKET_OPEN_MODE); IoTYPE(nstio) = IoTYPE_SOCKET; if (!IoIFP(nstio) || !IoOFP(nstio)) { if (IoIFP(nstio)) PerlIO_close(IoIFP(nstio)); @@ -2892,7 +2892,7 @@ PP(pp_stat) if (gv != PL_defgv) { do_fstat_warning_check: Perl_ck_warner(aTHX_ packWARN(WARN_IO), - "lstat() on filehandle%s%"SVf, + "lstat() on filehandle%s%" SVf, gv ? " " : "", SVfARG(gv ? sv_2mortal(newSVhek(GvENAME_HEK(gv))) @@ -4008,7 +4008,7 @@ PP(pp_open_dir) if ((IoIFP(io) || IoOFP(io))) Perl_ck_warner_d(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED), - "Opening filehandle %"HEKf" also as a directory", + "Opening filehandle %" HEKf " also as a directory", HEKfARG(GvENAME_HEK(gv)) ); if (IoDIRP(io)) PerlDir_close(IoDIRP(io)); @@ -4043,7 +4043,7 @@ PP(pp_readdir) if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), - "readdir() attempted on invalid dirhandle %"HEKf, + "readdir() attempted on invalid dirhandle %" HEKf, HEKfARG(GvENAME_HEK(gv))); goto nope; } @@ -4093,7 +4093,7 @@ PP(pp_telldir) if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), - "telldir() attempted on invalid dirhandle %"HEKf, + "telldir() attempted on invalid dirhandle %" HEKf, HEKfARG(GvENAME_HEK(gv))); goto nope; } @@ -4119,7 +4119,7 @@ PP(pp_seekdir) if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), - "seekdir() attempted on invalid dirhandle %"HEKf, + "seekdir() attempted on invalid dirhandle %" HEKf, HEKfARG(GvENAME_HEK(gv))); goto nope; } @@ -4144,7 +4144,7 @@ PP(pp_rewinddir) if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), - "rewinddir() attempted on invalid dirhandle %"HEKf, + "rewinddir() attempted on invalid dirhandle %" HEKf, HEKfARG(GvENAME_HEK(gv))); goto nope; } @@ -4168,7 +4168,7 @@ PP(pp_closedir) if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), - "closedir() attempted on invalid dirhandle %"HEKf, + "closedir() attempted on invalid dirhandle %" HEKf, HEKfARG(GvENAME_HEK(gv))); goto nope; } @@ -4771,7 +4771,7 @@ PP(pp_gmtime) else { dTARGET; PUSHs(TARG); - Perl_sv_setpvf_mg(aTHX_ TARG, "%s %s %2d %02d:%02d:%02d %"IVdf, + Perl_sv_setpvf_mg(aTHX_ TARG, "%s %s %2d %02d:%02d:%02d %" IVdf, dayname[tmbuf.tm_wday], monname[tmbuf.tm_mon], tmbuf.tm_mday, |