From: Andy Lester Date: Tue, 21 Feb 2006 00:27:11 +0000 (-0600) Subject: unused context warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=96a5add60f1f39d38341c09c11f0542e68f782b0;p=p5sagit%2Fp5-mst-13.2.git unused context warnings Message-ID: <20060221062711.GA16160@petdance.com> p4raw-id: //depot/perl@27300 --- diff --git a/deb.c b/deb.c index e246b1a..3907201 100644 --- a/deb.c +++ b/deb.c @@ -47,6 +47,7 @@ Perl_deb(pTHX_ const char *pat, ...) vdeb(pat, &args); va_end(args); #else + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(pat); #endif /* DEBUGGING */ } @@ -62,6 +63,7 @@ Perl_vdeb(pTHX_ const char *pat, va_list *args) (long)CopLINE(PL_curcop)); (void) PerlIO_vprintf(Perl_debug_log, pat, *args); #else + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(pat); PERL_UNUSED_ARG(args); #endif /* DEBUGGING */ @@ -133,6 +135,7 @@ S_deb_stack_n(pTHX_ SV** stack_base, I32 stack_min, I32 stack_max, while (1); PerlIO_printf(Perl_debug_log, "\n"); #else + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(stack_base); PERL_UNUSED_ARG(stack_min); PERL_UNUSED_ARG(stack_max); @@ -306,6 +309,8 @@ Perl_deb_stack_all(pTHX) } /* next stackinfo */ PerlIO_printf(Perl_debug_log, "\n"); +#else + PERL_UNUSED_CONTEXT; #endif /* DEBUGGING */ } diff --git a/embed.pl b/embed.pl index b0677c2..5aee84f 100755 --- a/embed.pl +++ b/embed.pl @@ -876,14 +876,14 @@ START_EXTERN_C #undef PERLVARISC #define PERLVAR(v,t) t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(aTHX->v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); } #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(aTHX->v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); } #define PERLVARI(v,t,i) PERLVAR(v,t) #define PERLVARIC(v,t,i) PERLVAR(v, const t) #define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(aTHX->v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); } #include "thrdvar.h" #include "intrpvar.h" @@ -891,16 +891,16 @@ START_EXTERN_C #undef PERLVAR #undef PERLVARA #define PERLVAR(v,t) t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(PL_##v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(PL_##v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #undef PERLVARIC #undef PERLVARISC #define PERLVARIC(v,t,i) \ const t* Perl_##v##_ptr(pTHX) \ - { return (const t *)&(PL_##v); } + { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); } #define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(PL_##v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #include "perlvars.h" #undef PERLVAR @@ -915,15 +915,18 @@ START_EXTERN_C #undef PL_check #undef PL_fold_locale Perl_ppaddr_t** Perl_Gppaddr_ptr(pTHX) { - static const Perl_ppaddr_t* ppaddr_ptr = PL_ppaddr; + static const Perl_ppaddr_t* const ppaddr_ptr = PL_ppaddr; + PERL_UNUSED_CONTEXT; return (Perl_ppaddr_t**)&ppaddr_ptr; } Perl_check_t** Perl_Gcheck_ptr(pTHX) { - static const Perl_check_t* check_ptr = PL_check; + static const Perl_check_t* const check_ptr = PL_check; + PERL_UNUSED_CONTEXT; return (Perl_check_t**)&check_ptr; } unsigned char** Perl_Gfold_locale_ptr(pTHX) { - static const unsigned char* fold_locale_ptr = PL_fold_locale; + static const unsigned char* const fold_locale_ptr = PL_fold_locale; + PERL_UNUSED_CONTEXT; return (unsigned char**)&fold_locale_ptr; } #endif diff --git a/hv.c b/hv.c index f68f38c..0923f90 100644 --- a/hv.c +++ b/hv.c @@ -1969,6 +1969,7 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, I32 len, int flags) AV ** Perl_hv_backreferences_p(pTHX_ HV *hv) { struct xpvhv_aux * const iter = SvOOK(hv) ? HvAUX(hv) : hv_auxinit(hv); + PERL_UNUSED_CONTEXT; return &(iter->xhv_backreferences); } diff --git a/locale.c b/locale.c index a7f56dd..dd3060f 100644 --- a/locale.c +++ b/locale.c @@ -185,6 +185,7 @@ Perl_new_ctype(pTHX_ const char *newctype) #endif /* USE_LOCALE_CTYPE */ PERL_UNUSED_ARG(newctype); + PERL_UNUSED_CONTEXT; } /* diff --git a/mathoms.c b/mathoms.c index 6cc018b..3636a9b 100644 --- a/mathoms.c +++ b/mathoms.c @@ -1106,6 +1106,7 @@ potentially warn under some level of strict-ness. void Perl_sv_nolocking(pTHX_ SV *sv) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(sv); } @@ -1125,6 +1126,7 @@ potentially warn under some level of strict-ness. void Perl_sv_nounlocking(pTHX_ SV *sv) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(sv); } diff --git a/mg.c b/mg.c index 004f319..760517c 100644 --- a/mg.c +++ b/mg.c @@ -115,6 +115,7 @@ void Perl_mg_magical(pTHX_ SV *sv) { const MAGIC* mg; + PERL_UNUSED_CONTEXT; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { const MGVTBL* const vtbl = mg->mg_virtual; if (vtbl) { @@ -347,6 +348,7 @@ Finds the magic pointer for type matching the SV. See C. MAGIC* Perl_mg_find(pTHX_ const SV *sv, int type) { + PERL_UNUSED_CONTEXT; if (sv) { MAGIC *mg; for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { @@ -2052,6 +2054,7 @@ Perl_magic_killbackrefs(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setmglob(pTHX_ SV *sv, MAGIC *mg) { + PERL_UNUSED_CONTEXT; mg->mg_len = -1; SvSCREAM_off(sv); return 0; @@ -2112,6 +2115,7 @@ Perl_magic_setcollxfrm(pTHX_ SV *sv, MAGIC *mg) * RenE Descartes said "I think not." * and vanished with a faint plop. */ + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(sv); if (mg->mg_ptr) { Safefree(mg->mg_ptr); @@ -2126,6 +2130,7 @@ Perl_magic_setcollxfrm(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setutf8(pTHX_ SV *sv, MAGIC *mg) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(sv); Safefree(mg->mg_ptr); /* The mg_ptr holds the pos cache. */ mg->mg_ptr = 0; @@ -2583,6 +2588,7 @@ I32 Perl_whichsig(pTHX_ const char *sig) { register char* const* sigv; + PERL_UNUSED_CONTEXT; for (sigv = (char* const*)PL_sig_name; *sigv; sigv++) if (strEQ(sig,*sigv)) diff --git a/miniperlmain.c b/miniperlmain.c index bb49f5b..140711b 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -123,6 +123,7 @@ main(int argc, char **argv, char **env) static void xs_init(pTHX) { + PERL_UNUSED_CONTEXT; dXSUB_SYS; } diff --git a/numeric.c b/numeric.c index 0458342..6720726 100644 --- a/numeric.c +++ b/numeric.c @@ -30,6 +30,7 @@ values, including such things as replacements for the OS's atof() function U32 Perl_cast_ulong(pTHX_ NV f) { + PERL_UNUSED_CONTEXT; if (f < 0.0) return f < I32_MIN ? (U32) I32_MIN : (U32)(I32) f; if (f < U32_MAX_P1) { @@ -48,6 +49,7 @@ Perl_cast_ulong(pTHX_ NV f) I32 Perl_cast_i32(pTHX_ NV f) { + PERL_UNUSED_CONTEXT; if (f < I32_MAX_P1) return f < I32_MIN ? I32_MIN : (I32) f; if (f < U32_MAX_P1) { @@ -66,6 +68,7 @@ Perl_cast_i32(pTHX_ NV f) IV Perl_cast_iv(pTHX_ NV f) { + PERL_UNUSED_CONTEXT; if (f < IV_MAX_P1) return f < IV_MIN ? IV_MIN : (IV) f; if (f < UV_MAX_P1) { @@ -85,6 +88,7 @@ Perl_cast_iv(pTHX_ NV f) UV Perl_cast_uv(pTHX_ NV f) { + PERL_UNUSED_CONTEXT; if (f < 0.0) return f < IV_MIN ? (UV) IV_MIN : (UV)(IV) f; if (f < UV_MAX_P1) { diff --git a/op.c b/op.c index 62b0ca2..d65bf16 100644 --- a/op.c +++ b/op.c @@ -485,6 +485,7 @@ void Perl_op_refcnt_lock(pTHX) { dVAR; + PERL_UNUSED_CONTEXT; OP_REFCNT_LOCK; } @@ -492,6 +493,7 @@ void Perl_op_refcnt_unlock(pTHX) { dVAR; + PERL_UNUSED_CONTEXT; OP_REFCNT_UNLOCK; } @@ -1792,6 +1794,7 @@ Perl_my(pTHX_ OP *o) OP * Perl_sawparens(pTHX_ OP *o) { + PERL_UNUSED_CONTEXT; if (o) o->op_flags |= OPf_PARENS; return o; @@ -4296,7 +4299,7 @@ Perl_cv_undef(pTHX_ CV *cv) CvCONST_off(cv); } if (CvISXSUB(cv) && CvXSUB(cv)) { - CvXSUB(cv) = 0; + CvXSUB(cv) = NULL; } /* delete all flags except WEAKOUTSIDE */ CvFLAGS(cv) &= CVf_WEAKOUTSIDE; @@ -4346,6 +4349,7 @@ L. SV * Perl_cv_const_sv(pTHX_ CV *cv) { + PERL_UNUSED_CONTEXT; if (!cv) return NULL; if (!(SvTYPE(cv) == SVt_PVCV || SvTYPE(cv) == SVt_PVFM)) @@ -5205,6 +5209,7 @@ OP * Perl_ck_concat(pTHX_ OP *o) { const OP * const kid = cUNOPo->op_first; + PERL_UNUSED_CONTEXT; if (kid->op_type == OP_CONCAT && !(kid->op_private & OPpTARGET_MY) && !(kUNOP->op_first->op_flags & OPf_MOD)) o->op_flags |= OPf_STACKED; @@ -6125,6 +6130,7 @@ Perl_ck_method(pTHX_ OP *o) OP * Perl_ck_null(pTHX_ OP *o) { + PERL_UNUSED_CONTEXT; return o; } @@ -6759,6 +6765,7 @@ Perl_ck_subr(pTHX_ OP *o) OP * Perl_ck_svconst(pTHX_ OP *o) { + PERL_UNUSED_CONTEXT; SvREADONLY_on(cSVOPo->op_sv); return o; } diff --git a/perl.c b/perl.c index b970bf3..d901cd5 100644 --- a/perl.c +++ b/perl.c @@ -228,7 +228,7 @@ void perl_construct(pTHXx) { dVAR; - PERL_UNUSED_ARG(my_perl); + PERL_UNUSED_CONTEXT; #ifdef MULTIPLICITY init_interp(); PL_perl_destruct_level = 1; @@ -404,6 +404,7 @@ no threads. int Perl_nothreadhook(pTHX) { + PERL_UNUSED_CONTEXT; return 0; } @@ -523,7 +524,7 @@ perl_destruct(pTHXx) pid_t child; #endif - PERL_UNUSED_ARG(my_perl); + PERL_UNUSED_CONTEXT; /* wait for all pseudo-forked children to finish */ PERL_WAIT_FOR_CHILDREN; @@ -2234,7 +2235,7 @@ perl_run(pTHXx) int ret = 0; dJMPENV; - PERL_UNUSED_ARG(my_perl); + PERL_UNUSED_CONTEXT; oldscope = PL_scopestack_ix; #ifdef VMS diff --git a/perl.h b/perl.h index 9f4e806..505c122 100644 --- a/perl.h +++ b/perl.h @@ -137,7 +137,7 @@ # endif #endif -#define pVAR register struct perl_vars* my_vars PERL_UNUSED_DECL +#define pVAR register struct perl_vars* const my_vars PERL_UNUSED_DECL #ifdef PERL_GLOBAL_STRUCT # define dVAR pVAR = (struct perl_vars*)PERL_GET_VARS() @@ -234,6 +234,12 @@ # define PERL_UNUSED_VAR(x) ((void)x) #endif +#ifdef USE_ITHREADS +# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl) +#else +# define PERL_UNUSED_CONTEXT +#endif + #define NOOP (void)0 #define dNOOP extern int Perl___notused PERL_UNUSED_DECL diff --git a/perlapi.c b/perlapi.c index 4ed010b..d5ef77f 100644 --- a/perlapi.c +++ b/perlapi.c @@ -38,14 +38,14 @@ START_EXTERN_C #undef PERLVARISC #define PERLVAR(v,t) t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(aTHX->v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); } #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(aTHX->v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); } #define PERLVARI(v,t,i) PERLVAR(v,t) #define PERLVARIC(v,t,i) PERLVAR(v, const t) #define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(aTHX->v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); } #include "thrdvar.h" #include "intrpvar.h" @@ -53,16 +53,16 @@ START_EXTERN_C #undef PERLVAR #undef PERLVARA #define PERLVAR(v,t) t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(PL_##v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(PL_##v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #undef PERLVARIC #undef PERLVARISC #define PERLVARIC(v,t,i) \ const t* Perl_##v##_ptr(pTHX) \ - { return (const t *)&(PL_##v); } + { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); } #define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \ - { dVAR; return &(PL_##v); } + { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); } #include "perlvars.h" #undef PERLVAR @@ -77,15 +77,18 @@ START_EXTERN_C #undef PL_check #undef PL_fold_locale Perl_ppaddr_t** Perl_Gppaddr_ptr(pTHX) { - static const Perl_ppaddr_t* ppaddr_ptr = PL_ppaddr; + static const Perl_ppaddr_t* const ppaddr_ptr = PL_ppaddr; + PERL_UNUSED_CONTEXT; return (Perl_ppaddr_t**)&ppaddr_ptr; } Perl_check_t** Perl_Gcheck_ptr(pTHX) { - static const Perl_check_t* check_ptr = PL_check; + static const Perl_check_t* const check_ptr = PL_check; + PERL_UNUSED_CONTEXT; return (Perl_check_t**)&check_ptr; } unsigned char** Perl_Gfold_locale_ptr(pTHX) { - static const unsigned char* fold_locale_ptr = PL_fold_locale; + static const unsigned char* const fold_locale_ptr = PL_fold_locale; + PERL_UNUSED_CONTEXT; return (unsigned char**)&fold_locale_ptr; } #endif diff --git a/perlio.c b/perlio.c index f901087..92a2879 100644 --- a/perlio.c +++ b/perlio.c @@ -358,6 +358,7 @@ Perl_boot_core_PerlIO(pTHX) void PerlIO_init(pTHX) { + PERL_UNUSED_CONTEXT; /* * Does nothing (yet) except force this file to be included in perl * binary. That allows this file to force inclusion of other functions @@ -395,6 +396,7 @@ PerlIO_tmpfile(void) void PerlIO_init(pTHX) { + PERL_UNUSED_CONTEXT; /* * Force this file to be included in perl binary. Which allows this * file to force inclusion of other functions that may be required by @@ -571,6 +573,7 @@ PerlIO_list_t * PerlIO_list_alloc(pTHX) { PerlIO_list_t *list; + PERL_UNUSED_CONTEXT; Newxz(list, 1, PerlIO_list_t); list->refcnt = 1; return list; @@ -1833,6 +1836,7 @@ Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR * ptr, int cnt) IV PerlIOUtf8_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(mode); PERL_UNUSED_ARG(arg); if (PerlIOValid(f)) { @@ -2000,6 +2004,7 @@ IV PerlIOBase_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) { PerlIOl * const l = PerlIOBase(f); + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(arg); l->flags &= ~(PERLIO_F_CANREAD | PERLIO_F_CANWRITE | @@ -2058,6 +2063,7 @@ PerlIOBase_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) IV PerlIOBase_popped(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(f); return 0; } @@ -2114,6 +2120,7 @@ PerlIOBase_read(pTHX_ PerlIO *f, void *vbuf, Size_t count) IV PerlIOBase_noop_ok(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(f); return 0; } @@ -2121,6 +2128,7 @@ PerlIOBase_noop_ok(pTHX_ PerlIO *f) IV PerlIOBase_noop_fail(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(f); return -1; } @@ -2157,6 +2165,7 @@ PerlIOBase_close(pTHX_ PerlIO *f) IV PerlIOBase_eof(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; if (PerlIOValid(f)) { return (PerlIOBase(f)->flags & PERLIO_F_EOF) != 0; } @@ -2166,6 +2175,7 @@ PerlIOBase_eof(pTHX_ PerlIO *f) IV PerlIOBase_error(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; if (PerlIOValid(f)) { return (PerlIOBase(f)->flags & PERLIO_F_ERROR) != 0; } @@ -2186,6 +2196,7 @@ PerlIOBase_clearerr(pTHX_ PerlIO *f) void PerlIOBase_setlinebuf(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; if (PerlIOValid(f)) { PerlIOBase(f)->flags |= PERLIO_F_LINEBUF; } @@ -2289,6 +2300,8 @@ PerlIO_init(pTHX) /* Place holder for stdstreams call ??? */ #ifdef USE_THREADS MUTEX_INIT(&PerlIO_mutex); +#else + PERL_UNUSED_CONTEXT; #endif } @@ -2438,6 +2451,7 @@ PerlIOUnix_oflags(const char *mode) IV PerlIOUnix_fileno(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; return PerlIOSelf(f, PerlIOUnix)->fd; } @@ -2460,6 +2474,7 @@ PerlIOUnix_setfd(pTHX_ PerlIO *f, int fd, int imode) s->fd = fd; s->oflags = imode; PerlIOUnix_refcnt_inc(fd); + PERL_UNUSED_CONTEXT; } IV @@ -2487,6 +2502,7 @@ PerlIOUnix_seek(pTHX_ PerlIO *f, Off_t offset, int whence) { const int fd = PerlIOSelf(f, PerlIOUnix)->fd; Off_t new_loc; + PERL_UNUSED_CONTEXT; if (PerlIOBase(f)->flags & PERLIO_F_NOTREG) { #ifdef ESPIPE SETERRNO(ESPIPE, LIB_INVARG); @@ -2630,6 +2646,8 @@ PerlIOUnix_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) Off_t PerlIOUnix_tell(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; + return PerlLIO_lseek(PerlIOSelf(f, PerlIOUnix)->fd, 0, SEEK_CUR); } @@ -2715,6 +2733,8 @@ typedef struct { IV PerlIOStdio_fileno(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; + if (PerlIOValid(f)) { FILE * const s = PerlIOSelf(f, PerlIOStdio)->stdio; if (s) @@ -2936,6 +2956,8 @@ PerlIOStdio_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags) static int PerlIOStdio_invalidate_fileno(pTHX_ FILE *f) { + PERL_UNUSED_CONTEXT; + /* XXX this could use PerlIO_canset_fileno() and * PerlIO_set_fileno() support from Configure */ @@ -3217,6 +3239,8 @@ IV PerlIOStdio_seek(pTHX_ PerlIO *f, Off_t offset, int whence) { FILE * const stdio = PerlIOSelf(f, PerlIOStdio)->stdio; + PERL_UNUSED_CONTEXT; + return PerlSIO_fseek(stdio, offset, whence); } @@ -3224,6 +3248,8 @@ Off_t PerlIOStdio_tell(pTHX_ PerlIO *f) { FILE * const stdio = PerlIOSelf(f, PerlIOStdio)->stdio; + PERL_UNUSED_CONTEXT; + return PerlSIO_ftell(stdio); } @@ -3231,6 +3257,8 @@ IV PerlIOStdio_flush(pTHX_ PerlIO *f) { FILE * const stdio = PerlIOSelf(f, PerlIOStdio)->stdio; + PERL_UNUSED_CONTEXT; + if (PerlIOBase(f)->flags & PERLIO_F_CANWRITE) { return PerlSIO_fflush(stdio); } @@ -3257,24 +3285,32 @@ PerlIOStdio_flush(pTHX_ PerlIO *f) IV PerlIOStdio_eof(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; + return PerlSIO_feof(PerlIOSelf(f, PerlIOStdio)->stdio); } IV PerlIOStdio_error(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; + return PerlSIO_ferror(PerlIOSelf(f, PerlIOStdio)->stdio); } void PerlIOStdio_clearerr(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; + PerlSIO_clearerr(PerlIOSelf(f, PerlIOStdio)->stdio); } void PerlIOStdio_setlinebuf(pTHX_ PerlIO *f) { + PERL_UNUSED_CONTEXT; + #ifdef HAS_SETLINEBUF PerlSIO_setlinebuf(PerlIOSelf(f, PerlIOStdio)->stdio); #else @@ -3359,6 +3395,8 @@ PerlIOStdio_fill(pTHX_ PerlIO *f) { FILE * const stdio = PerlIOSelf(f, PerlIOStdio)->stdio; int c; + PERL_UNUSED_CONTEXT; + /* * fflush()ing read-only streams can cause trouble on some stdio-s */ @@ -3965,6 +4003,8 @@ STDCHAR * PerlIOBuf_get_base(pTHX_ PerlIO *f) { PerlIOBuf * const b = PerlIOSelf(f, PerlIOBuf); + PERL_UNUSED_CONTEXT; + if (!b->buf) { if (!b->bufsiz) b->bufsiz = 4096; diff --git a/pp_ctl.c b/pp_ctl.c index 43cf175..8d20d6f 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -304,6 +304,7 @@ Perl_rxres_save(pTHX_ void **rsp, REGEXP *rx) { UV *p = (UV*)*rsp; U32 i; + PERL_UNUSED_CONTEXT; if (!p || p[1] < rx->nparens) { #ifdef PERL_OLD_COPY_ON_WRITE @@ -341,6 +342,7 @@ Perl_rxres_restore(pTHX_ void **rsp, REGEXP *rx) { UV *p = (UV*)*rsp; U32 i; + PERL_UNUSED_CONTEXT; RX_MATCH_COPY_FREE(rx); RX_MATCH_COPIED_set(rx, *p); @@ -367,6 +369,7 @@ void Perl_rxres_free(pTHX_ void **rsp) { UV * const p = (UV*)*rsp; + PERL_UNUSED_CONTEXT; if (p) { #ifdef PERL_POISON @@ -3656,11 +3659,10 @@ PP(pp_leavegiven) I32 gimme; SV **newsp; PMOP *newpm; - SV **mark; + PERL_UNUSED_CONTEXT; POPBLOCK(cx,newpm); assert(CxTYPE(cx) == CXt_GIVEN); - mark = newsp; SP = newsp; PUTBACK; diff --git a/regcomp.c b/regcomp.c index bb109fe..dba8bfb 100644 --- a/regcomp.c +++ b/regcomp.c @@ -5758,6 +5758,7 @@ Perl_regdump(pTHX_ regexp *r) }); } #else + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(r); #endif /* DEBUGGING */ } @@ -5963,6 +5964,7 @@ Perl_regprop(pTHX_ SV *sv, const regnode *o) else if (k == BRANCHJ && (OP(o) == UNLESSM || OP(o) == IFMATCH)) Perl_sv_catpvf(aTHX_ sv, "[-%d]", o->flags); #else + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(sv); PERL_UNUSED_ARG(o); #endif /* DEBUGGING */ @@ -5973,6 +5975,8 @@ Perl_re_intuit_string(pTHX_ regexp *prog) { /* Assume that RE_INTUIT is set */ dVAR; GET_RE_DEBUG_FLAGS_DECL; + PERL_UNUSED_CONTEXT; + DEBUG_COMPILE_r( { const char * const s = SvPV_nolen_const(prog->check_substr diff --git a/scope.c b/scope.c index afb8678..ff15c35 100644 --- a/scope.c +++ b/scope.c @@ -1060,6 +1060,7 @@ Perl_cx_dump(pTHX_ PERL_CONTEXT *cx) break; } #else + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(cx); #endif /* DEBUGGING */ } diff --git a/sv.c b/sv.c index 1dc7283..1f17c76 100644 --- a/sv.c +++ b/sv.c @@ -435,6 +435,8 @@ Perl_sv_report_used(pTHX) { #ifdef DEBUGGING visit(do_report_used, 0, 0); +#else + PERL_UNUSED_CONTEXT; #endif } @@ -630,7 +632,7 @@ Perl_sv_free_arenas(pTHX) struct arena_set *next, *aroot = (struct arena_set*) PL_body_arenas; for (; aroot; aroot = next) { - int max = aroot->curr; + const int max = aroot->curr; for (i=0; iset[i].arena); Safefree(aroot->set[i].arena); @@ -1063,7 +1065,7 @@ S_more_bodies (pTHX_ svtype sv_type) { dVAR; void ** const root = &PL_body_roots[sv_type]; - const struct body_details *bdp = &bodies_by_type[sv_type]; + const struct body_details * const bdp = &bodies_by_type[sv_type]; const size_t body_size = bdp->body_size; char *start; const char *end; @@ -1393,6 +1395,7 @@ wrapper instead. int Perl_sv_backoff(pTHX_ register SV *sv) { + PERL_UNUSED_CONTEXT; assert(SvOOK(sv)); assert(SvTYPE(sv) != SVt_PVHV); assert(SvTYPE(sv) != SVt_PVAV); @@ -5162,6 +5165,7 @@ instead. SV * Perl_sv_newref(pTHX_ SV *sv) { + PERL_UNUSED_CONTEXT; if (sv) (SvREFCNT(sv))++; return sv; @@ -9348,6 +9352,7 @@ Perl_fp_dup(pTHX_ PerlIO *fp, char type, CLONE_PARAMS *param) DIR * Perl_dirp_dup(pTHX_ DIR *dp) { + PERL_UNUSED_CONTEXT; if (!dp) return (DIR*)NULL; /* XXX TODO */ @@ -9460,6 +9465,8 @@ PTR_TBL_t * Perl_ptr_table_new(pTHX) { PTR_TBL_t *tbl; + PERL_UNUSED_CONTEXT; + Newxz(tbl, 1, PTR_TBL_t); tbl->tbl_max = 511; tbl->tbl_items = 0; @@ -9497,6 +9504,7 @@ void * Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *tbl, const void *sv) { PTR_TBL_ENT_t const *const tblent = ptr_table_find(tbl, sv); + PERL_UNUSED_CONTEXT; return tblent ? tblent->newval : (void *) 0; } @@ -9506,6 +9514,7 @@ void Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, const void *oldsv, void *newsv) { PTR_TBL_ENT_t *tblent = S_ptr_table_find(tbl, oldsv); + PERL_UNUSED_CONTEXT; if (tblent) { tblent->newval = newsv; @@ -9533,6 +9542,7 @@ Perl_ptr_table_split(pTHX_ PTR_TBL_t *tbl) const UV oldsize = tbl->tbl_max + 1; UV newsize = oldsize * 2; UV i; + PERL_UNUSED_CONTEXT; Renew(ary, newsize, PTR_TBL_ENT_t*); Zero(&ary[oldsize], newsize-oldsize, PTR_TBL_ENT_t*); diff --git a/toke.c b/toke.c index 44eae03..1ef9b18 100644 --- a/toke.c +++ b/toke.c @@ -1215,7 +1215,7 @@ S_sublex_start(pTHX) if (SvTYPE(sv) == SVt_PVIV) { /* Overloaded constants, nothing fancy: Convert to SVt_PV: */ STRLEN len; - const char *p = SvPV_const(sv, len); + const char * const p = SvPV_const(sv, len); SV * const nsv = newSVpvn(p, len); if (SvUTF8(sv)) SvUTF8_on(nsv); @@ -9552,6 +9552,7 @@ S_scan_ident(pTHX_ register char *s, register const char *send, char *dest, STRL void Perl_pmflag(pTHX_ U32* pmfl, int ch) { + PERL_UNUSED_CONTEXT; if (ch == 'i') *pmfl |= PMf_FOLD; else if (ch == 'g') @@ -10924,7 +10925,7 @@ S_set_csh(pTHX) PL_cshlen = strlen(PL_cshname); #else #if defined(USE_ITHREADS) - PERL_UNUSED_ARG(my_perl); + PERL_UNUSED_CONTEXT; #endif #endif } diff --git a/universal.c b/universal.c index 2eeddb6..98efe0f 100644 --- a/universal.c +++ b/universal.c @@ -819,6 +819,7 @@ XS(XS_Internals_hv_clear_placehold) XS(XS_Regexp_DESTROY) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(cv); } diff --git a/utf8.c b/utf8.c index 1ab15cc..e5079cb 100644 --- a/utf8.c +++ b/utf8.c @@ -238,6 +238,7 @@ STRLEN Perl_is_utf8_char(pTHX_ const U8 *s) { const STRLEN len = UTF8SKIP(s); + PERL_UNUSED_CONTEXT; #ifdef IS_UTF8_CHAR if (IS_UTF8_CHAR_FAST(len)) return IS_UTF8_CHAR(s, len) ? len : 0; @@ -264,6 +265,7 @@ Perl_is_utf8_string(pTHX_ const U8 *s, STRLEN len) const U8* x = s; const U8* send; + PERL_UNUSED_CONTEXT; if (!len) len = strlen((const char *)s); send = s + len; @@ -329,6 +331,7 @@ Perl_is_utf8_string_loclen(pTHX_ const U8 *s, STRLEN len, const U8 **ep, STRLEN const U8* x = s; const U8* send; STRLEN c; + PERL_UNUSED_CONTEXT; if (!len) len = strlen((const char *)s); @@ -755,6 +758,7 @@ on the first byte of character or just after the last byte of a character. U8 * Perl_utf8_hop(pTHX_ const U8 *s, I32 off) { + PERL_UNUSED_CONTEXT; /* Note: cannot use UTF8_IS_...() too eagerly here since e.g * the bitops (especially ~) can create illegal UTF-8. * In other words: in Perl UTF-8 is not just for Unicode. */ @@ -835,6 +839,7 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, STRLEN *len, bool *is_utf8) const U8 *send; I32 count = 0; + PERL_UNUSED_CONTEXT; if (!*is_utf8) return (U8 *)start; @@ -887,6 +892,7 @@ Perl_bytes_to_utf8(pTHX_ const U8 *s, STRLEN *len) const U8 * const send = s + (*len); U8 *d; U8 *dst; + PERL_UNUSED_CONTEXT; Newx(d, (*len) * 2 + 1, U8); dst = d; diff --git a/util.c b/util.c index 065a4c7..4022bb0 100644 --- a/util.c +++ b/util.c @@ -340,6 +340,7 @@ char * Perl_delimcpy(pTHX_ register char *to, register const char *toend, register const char *from, register const char *fromend, register int delim, I32 *retlen) { register I32 tolen; + PERL_UNUSED_CONTEXT; for (tolen = 0; from < fromend; from++, tolen++) { if (*from == '\\') { if (from[1] == delim) @@ -369,6 +370,7 @@ char * Perl_instr(pTHX_ register const char *big, register const char *little) { register I32 first; + PERL_UNUSED_CONTEXT; if (!little) return (char*)big; @@ -400,6 +402,7 @@ Perl_instr(pTHX_ register const char *big, register const char *little) char * Perl_ninstr(pTHX_ const char *big, const char *bigend, const char *little, const char *lend) { + PERL_UNUSED_CONTEXT; if (little >= lend) return (char*)big; { @@ -428,6 +431,7 @@ Perl_rninstr(pTHX_ register const char *big, const char *bigend, const char *lit register const char *bigbeg; register const I32 first = *little; register const char * const littleend = lend; + PERL_UNUSED_CONTEXT; if (little >= littleend) return (char*)bigend; @@ -829,6 +833,8 @@ Perl_ibcmp(pTHX_ const char *s1, const char *s2, register I32 len) { register const U8 *a = (const U8 *)s1; register const U8 *b = (const U8 *)s2; + PERL_UNUSED_CONTEXT; + while (len--) { if (*a != *b && *a != PL_fold[*b]) return 1; @@ -843,6 +849,8 @@ Perl_ibcmp_locale(pTHX_ const char *s1, const char *s2, register I32 len) dVAR; register const U8 *a = (const U8 *)s1; register const U8 *b = (const U8 *)s2; + PERL_UNUSED_CONTEXT; + while (len--) { if (*a != *b && *a != PL_fold_locale[*b]) return 1; @@ -869,6 +877,7 @@ be freed with the C function. char * Perl_savepv(pTHX_ const char *pv) { + PERL_UNUSED_CONTEXT; if (!pv) return NULL; else { @@ -877,7 +886,6 @@ Perl_savepv(pTHX_ const char *pv) Newx(newaddr,pvlen,char); return memcpy(newaddr,pv,pvlen); } - } /* same thing but with a known length */ @@ -897,6 +905,7 @@ char * Perl_savepvn(pTHX_ const char *pv, register I32 len) { register char *newaddr; + PERL_UNUSED_CONTEXT; Newx(newaddr,len+1,char); /* Give a meaning to NULL pointer mainly for the use in sv_magic() */ @@ -1659,6 +1668,7 @@ Perl_setenv_getix(pTHX_ const char *nam) { register I32 i; register const I32 len = strlen(nam); + PERL_UNUSED_CONTEXT; for (i = 0; environ[i]; i++) { if ( @@ -2556,6 +2566,7 @@ Sighandler_t Perl_rsignal_state(pTHX_ int signo) { struct sigaction oact; + PERL_UNUSED_CONTEXT; if (sigaction(signo, (struct sigaction *)NULL, &oact) == -1) return (Sighandler_t) SIG_ERR; @@ -2861,6 +2872,7 @@ Perl_repeatcpy(pTHX_ register char *to, register const char *from, I32 len, regi { register I32 todo; register const char * const frombase = from; + PERL_UNUSED_CONTEXT; if (len == 1) { register const char c = *from; @@ -3202,32 +3214,37 @@ Perl_GetVars(pTHX) char ** Perl_get_op_names(pTHX) { - return (char **)PL_op_name; + PERL_UNUSED_CONTEXT; + return (char **)PL_op_name; } char ** Perl_get_op_descs(pTHX) { - return (char **)PL_op_desc; + PERL_UNUSED_CONTEXT; + return (char **)PL_op_desc; } const char * Perl_get_no_modify(pTHX) { - return PL_no_modify; + PERL_UNUSED_CONTEXT; + return PL_no_modify; } U32 * Perl_get_opargs(pTHX) { - return (U32 *)PL_opargs; + PERL_UNUSED_CONTEXT; + return (U32 *)PL_opargs; } PPADDR_t* Perl_get_ppaddr(pTHX) { - dVAR; - return (PPADDR_t*)PL_ppaddr; + dVAR; + PERL_UNUSED_CONTEXT; + return (PPADDR_t*)PL_ppaddr; } #ifndef HAS_GETENV_LEN @@ -3235,6 +3252,7 @@ char * Perl_getenv_len(pTHX_ const char *env_elem, unsigned long *len) { char * const env_trans = PerlEnv_getenv(env_elem); + PERL_UNUSED_CONTEXT; if (env_trans) *len = strlen(env_trans); return env_trans; @@ -3246,6 +3264,7 @@ MGVTBL* Perl_get_vtbl(pTHX_ int vtbl_id) { const MGVTBL* result; + PERL_UNUSED_CONTEXT; switch(vtbl_id) { case want_vtbl_sv: @@ -3545,6 +3564,7 @@ Perl_mini_mktime(pTHX_ struct tm *ptm) int secs; int month, mday, year, jday; int odd_cent, odd_year; + PERL_UNUSED_CONTEXT; #define DAYS_PER_YEAR 365 #define DAYS_PER_QYEAR (4*DAYS_PER_YEAR+1) @@ -4854,6 +4874,7 @@ potentially warn under some level of strict-ness. void Perl_sv_nosharing(pTHX_ SV *sv) { + PERL_UNUSED_CONTEXT; PERL_UNUSED_ARG(sv); } @@ -5037,6 +5058,7 @@ Perl_stashpv_hvname_match(pTHX_ const COP *c, const HV *hv) { const char * const stashpv = CopSTASHPV(c); const char * const name = HvNAME_get(hv); + PERL_UNUSED_CONTEXT; if (stashpv == name) return TRUE;