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 /gv.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 'gv.c')
-rw-r--r-- | gv.c | 48 |
1 files changed, 24 insertions, 24 deletions
@@ -785,7 +785,7 @@ S_gv_fetchmeth_internal(pTHX_ HV* stash, SV* meth, const char* name, STRLEN len, if (!cstash) { Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX), - "Can't locate package %"SVf" for @%"HEKf"::ISA", + "Can't locate package %" SVf " for @%" HEKf "::ISA", SVfARG(linear_sv), HEKfARG(HvNAME_HEK(stash))); continue; @@ -1105,8 +1105,8 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV *stash, const char *name, const STRLEN le return gv; } Perl_croak(aTHX_ - "Can't locate object method \"%"UTF8f - "\" via package \"%"HEKf"\"", + "Can't locate object method \"%" UTF8f + "\" via package \"%" HEKf "\"", UTF8fARG(is_utf8, name_end - name, name), HEKfARG(HvNAME_HEK(stash))); } @@ -1121,9 +1121,9 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV *stash, const char *name, const STRLEN le } Perl_croak(aTHX_ - "Can't locate object method \"%"UTF8f - "\" via package \"%"SVf"\"" - " (perhaps you forgot to load \"%"SVf"\"?)", + "Can't locate object method \"%" UTF8f + "\" via package \"%" SVf "\"" + " (perhaps you forgot to load \"%" SVf "\"?)", UTF8fARG(is_utf8, name_end - name, name), SVfARG(packnamesv), SVfARG(packnamesv)); } @@ -1216,8 +1216,8 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, const char *name, STRLEN len, U32 flags) && (GvCVGEN(gv) || GvSTASH(gv) != stash) ) Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), - "Use of inherited AUTOLOAD for non-method %"SVf - "::%"UTF8f"() is deprecated", + "Use of inherited AUTOLOAD for non-method %" SVf + "::%" UTF8f "() is deprecated", SVfARG(packname), UTF8fARG(is_utf8, len, name)); @@ -1766,14 +1766,14 @@ S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len, /* diag_listed_as: Variable "%s" is not imported%s */ Perl_ck_warner_d( aTHX_ packWARN(WARN_MISC), - "Variable \"%c%"UTF8f"\" is not imported", + "Variable \"%c%" UTF8f "\" is not imported", sv_type == SVt_PVAV ? '@' : sv_type == SVt_PVHV ? '%' : '$', UTF8fARG(is_utf8, len, name)); if (GvCVu(*gvp)) Perl_ck_warner_d( aTHX_ packWARN(WARN_MISC), - "\t(Did you mean &%"UTF8f" instead?)\n", + "\t(Did you mean &%" UTF8f " instead?)\n", UTF8fARG(is_utf8, len, name) ); *stash = NULL; @@ -1790,9 +1790,9 @@ S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len, if (add && !PL_in_clean_all) { GV *gv; qerror(Perl_mess(aTHX_ - "Global symbol \"%s%"UTF8f + "Global symbol \"%s%" UTF8f "\" requires explicit package name (did you forget to " - "declare \"my %s%"UTF8f"\"?)", + "declare \"my %s%" UTF8f "\"?)", (sv_type == SVt_PV ? "$" : sv_type == SVt_PVAV ? "@" : sv_type == SVt_PVHV ? "%" @@ -2396,7 +2396,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, if (add & GV_ADDWARN) Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL), - "Had to create %"UTF8f" unexpectedly", + "Had to create %" UTF8f " unexpectedly", UTF8fARG(is_utf8, name_end-nambeg, nambeg)); gv_init_pvn(gv, stash, name, len, (add & GV_ADDMULTI)|is_utf8); @@ -2507,7 +2507,7 @@ Perl_gv_check(pTHX_ HV *stash) = gv_fetchfile_flags(file, HEK_LEN(GvFILE_HEK(gv)), 0); #endif Perl_warner(aTHX_ packWARN(WARN_ONCE), - "Name \"%"HEKf"::%"HEKf + "Name \"%" HEKf "::%" HEKf "\" used only once: possible typo", HEKfARG(HvNAME_HEK(stash)), HEKfARG(GvNAME_HEK(gv))); @@ -2523,7 +2523,7 @@ Perl_newGVgen_flags(pTHX_ const char *pack, U32 flags) PERL_ARGS_ASSERT_NEWGVGEN_FLAGS; assert(!(flags & ~SVf_UTF8)); - return gv_fetchpv(Perl_form(aTHX_ "%"UTF8f"::_GEN_%ld", + return gv_fetchpv(Perl_form(aTHX_ "%" UTF8f "::_GEN_%ld", UTF8fARG(flags, strlen(pack), pack), (long)PL_gensym++), GV_ADD, SVt_PVGV); @@ -2603,7 +2603,7 @@ Perl_gp_free(pTHX_ GV *gv) const HEK *hvname_hek = HvNAME_HEK(hv); if (PL_stashcache && hvname_hek) { DEBUG_o(Perl_deb(aTHX_ - "gp_free clearing PL_stashcache for '%"HEKf"'\n", + "gp_free clearing PL_stashcache for '%" HEKf "'\n", HEKfARG(hvname_hek))); (void)hv_deletehek(PL_stashcache, hvname_hek, G_DISCARD); } @@ -2772,7 +2772,7 @@ Perl_Gv_AMupdate(pTHX_ HV *stash, bool destructing) GV *ngv = NULL; SV *gvsv = GvSV(gv); - DEBUG_o( Perl_deb(aTHX_ "Resolving method \"%"SVf256\ + DEBUG_o( Perl_deb(aTHX_ "Resolving method \"%" SVf256\ "\" for overloaded \"%s\" in package \"%.256s\"\n", (void*)GvSV(gv), cp, HvNAME(stash)) ); if (!gvsv || !SvPOK(gvsv) @@ -2787,9 +2787,9 @@ Perl_Gv_AMupdate(pTHX_ HV *stash, bool destructing) ? gvsv : newSVpvs_flags("???", SVs_TEMP); /* diag_listed_as: Can't resolve method "%s" overloading "%s" in package "%s" */ - Perl_croak(aTHX_ "%s method \"%"SVf256 + Perl_croak(aTHX_ "%s method \"%" SVf256 "\" overloading \"%s\" "\ - "in package \"%"HEKf256"\"", + "in package \"%" HEKf256 "\"", (GvCVGEN(gv) ? "Stub found while resolving" : "Can't resolve"), SVfARG(name), cp, @@ -3275,7 +3275,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) SV *msg; if (off==-1) off=method; msg = sv_2mortal(Perl_newSVpvf(aTHX_ - "Operation \"%s\": no method found,%sargument %s%"SVf"%s%"SVf, + "Operation \"%s\": no method found,%sargument %s%" SVf "%s%" SVf, AMG_id2name(method + assignshift), (flags & AMGf_unary ? " " : "\n\tleft "), SvAMAGIC(left)? @@ -3293,9 +3293,9 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) SVfARG(sv_2mortal(newSVhek(HvNAME_HEK(SvSTASH(SvRV(right)))))): SVfARG(&PL_sv_no))); if (use_default_op) { - DEBUG_o( Perl_deb(aTHX_ "%"SVf, SVfARG(msg)) ); + DEBUG_o( Perl_deb(aTHX_ "%" SVf, SVfARG(msg)) ); } else { - Perl_croak(aTHX_ "%"SVf, SVfARG(msg)); + Perl_croak(aTHX_ "%" SVf, SVfARG(msg)); } return NULL; } @@ -3366,7 +3366,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) #ifdef DEBUGGING if (!notfound) { DEBUG_o(Perl_deb(aTHX_ - "Overloaded operator \"%s\"%s%s%s:\n\tmethod%s found%s in package %"SVf"%s\n", + "Overloaded operator \"%s\"%s%s%s:\n\tmethod%s found%s in package %" SVf "%s\n", AMG_id2name(off), method+assignshift==off? "" : " (initially \"", @@ -3553,7 +3553,7 @@ Perl_gv_name_set(pTHX_ GV *gv, const char *name, U32 len, U32 flags) PERL_ARGS_ASSERT_GV_NAME_SET; if (len > I32_MAX) - Perl_croak(aTHX_ "panic: gv name too long (%"UVuf")", (UV) len); + Perl_croak(aTHX_ "panic: gv name too long (%" UVuf ")", (UV) len); if (!(flags & GV_ADD) && GvNAME_HEK(gv)) { unshare_hek(GvNAME_HEK(gv)); |