summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2005-06-23 21:04:00 +0000
committerNicholas Clark <nick@ccl4.org>2005-09-21 19:54:07 +0000
commit4f1e9d25b766da22826656b12e84d2ee6ca88713 (patch)
tree172ad1769afdfce9c3579987df2db342356baa24
parentce7d4f40f5243e87bdc55395b666f88ce041345e (diff)
downloadperl-4f1e9d25b766da22826656b12e84d2ee6ca88713.tar.gz
Integrate:
[ 24965] Subject: [PATCH] Pre-YAPC consting fun Message-ID: <20050623190423.GA13835@petdance.com> p4raw-link: @24965 on //depot/perl: 8772537cf6d022a54f738ccb84b65a7f21ccf1b2 p4raw-id: //depot/maint-5.8/perl@25555 p4raw-integrated: from //depot/perl@25554 'merge in' taint.c (@24800..) p4raw-edited: from //depot/perl@24965 'edit in' locale.c (@24445..) embed.fnc proto.h (@24962..) p4raw-integrated: from //depot/perl@24965 'edit in' mg.c (@24943..) util.c (@24945..) 'merge in' perlio.c (@24945..) pp_ctl.c scope.c (@24959..) embed.h (@24962..) pp_sys.c (@24963..)
-rw-r--r--embed.fnc17
-rw-r--r--embed.h4
-rw-r--r--locale.c33
-rw-r--r--mg.c165
-rw-r--r--perlio.c50
-rw-r--r--pp_ctl.c3
-rw-r--r--pp_sys.c4
-rw-r--r--proto.h124
-rw-r--r--scope.c2
-rw-r--r--taint.c22
-rw-r--r--util.c8
11 files changed, 240 insertions, 192 deletions
diff --git a/embed.fnc b/embed.fnc
index d7e1bc5344..9dd15f8fc7 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -258,7 +258,7 @@ Ap |char* |vform |const char* pat|va_list* args
Ap |void |free_tmps
p |OP* |gen_constant_list|OP* o
#if !defined(HAS_GETENV_LEN)
-p |char* |getenv_len |const char* key|unsigned long *len
+p |char* |getenv_len |NN const char* key|NN unsigned long *len
#endif
Ap |void |gp_free |GV* gv
Ap |GP* |gp_ref |GP* gp
@@ -405,7 +405,7 @@ p |int |magic_existspack|SV* sv|MAGIC* mg
p |int |magic_freeregexp|SV* sv|MAGIC* mg
p |int |magic_freeovrld|SV* sv|MAGIC* mg
p |int |magic_get |SV* sv|MAGIC* mg
-p |int |magic_getarylen|SV* sv|MAGIC* mg
+p |int |magic_getarylen|NN SV* sv|NN MAGIC* mg
p |int |magic_getdefelem|SV* sv|MAGIC* mg
p |int |magic_getglob |SV* sv|MAGIC* mg
p |int |magic_getnkeys |SV* sv|MAGIC* mg
@@ -603,9 +603,9 @@ Apd |HV* |get_hv |const char* name|I32 create
Apd |CV* |get_cv |const char* name|I32 create
Ap |int |init_i18nl10n |int printwarn
Ap |int |init_i18nl14n |int printwarn
-Ap |void |new_collate |NN char* newcoll
+Ap |void |new_collate |NULLOK char* newcoll
Ap |void |new_ctype |NN char* newctype
-Ap |void |new_numeric |NN char* newcoll
+Ap |void |new_numeric |NULLOK char* newcoll
Ap |void |set_numeric_local
Ap |void |set_numeric_radix
Ap |void |set_numeric_standard
@@ -823,7 +823,7 @@ Ap |SV* |swash_init |char* pkg|char* name|SV* listsv \
|I32 minbits|I32 none
Ap |UV |swash_fetch |SV *sv|U8 *ptr|bool do_utf8
Ap |void |taint_env
-Ap |void |taint_proper |const char* f|const char* s
+Ap |void |taint_proper |NULLOK const char* f|NN const char* s
Apd |UV |to_utf8_case |NN U8 *p|NN U8* ustrp|STRLEN *lenp \
|SV **swash|char *normal|char *special
Apd |UV |to_utf8_lower |NN U8 *p|NN U8* ustrp|STRLEN *lenp
@@ -1031,6 +1031,9 @@ s |void |save_magic |I32 mgs_ix|NN SV *sv
s |int |magic_methpack |NN SV *sv|NN const MAGIC *mg|NN const char *meth
s |int |magic_methcall |NN SV *sv|NN const MAGIC *mg|NN const char *meth|I32 f \
|int n|SV *val
+s |void |restore_magic |NN const void *p
+s |void |unwind_handler_stack|NN const void *p
+
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT)
@@ -1321,11 +1324,11 @@ s |SV*|isa_lookup |HV *stash|const char *name|HV *name_stash|int len|int level
#endif
#if defined(PERL_IN_LOCALE_C) || defined(PERL_DECL_PROT)
-s |char* |stdize_locale |char* locs
+s |char* |stdize_locale |NN char* locs
#endif
#if defined(PERL_IN_UTIL_C) || defined(PERL_DECL_PROT)
-s |COP* |closest_cop |COP *cop|OP *o
+s |COP* |closest_cop |NN COP *cop|NULLOK const OP *o
s |SV* |mess_alloc
#endif
diff --git a/embed.h b/embed.h
index 91abc89cc4..8dcbbabd47 100644
--- a/embed.h
+++ b/embed.h
@@ -1080,6 +1080,8 @@
#define save_magic S_save_magic
#define magic_methpack S_magic_methpack
#define magic_methcall S_magic_methcall
+#define restore_magic S_restore_magic
+#define unwind_handler_stack S_unwind_handler_stack
#endif
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT)
@@ -3107,6 +3109,8 @@
#define save_magic(a,b) S_save_magic(aTHX_ a,b)
#define magic_methpack(a,b,c) S_magic_methpack(aTHX_ a,b,c)
#define magic_methcall(a,b,c,d,e,f) S_magic_methcall(aTHX_ a,b,c,d,e,f)
+#define restore_magic(a) S_restore_magic(aTHX_ a)
+#define unwind_handler_stack(a) S_unwind_handler_stack(aTHX_ a)
#endif
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT)
diff --git a/locale.c b/locale.c
index 3779279e57..2590fd7bc3 100644
--- a/locale.c
+++ b/locale.c
@@ -52,24 +52,19 @@
STATIC char *
S_stdize_locale(pTHX_ char *locs)
{
- char *s;
+ const char *s = strchr(locs, '=');
bool okay = TRUE;
- if ((s = strchr(locs, '='))) {
- char *t;
-
+ if (s) {
+ const char * const t = strchr(s, '.');
okay = FALSE;
- if ((t = strchr(s, '.'))) {
- char *u;
-
- if ((u = strchr(t, '\n'))) {
-
- if (u[1] == 0) {
- STRLEN len = u - s;
- Move(s + 1, locs, len, char);
- locs[len] = 0;
- okay = TRUE;
- }
+ if (t) {
+ const char * const u = strchr(t, '\n');
+ if (u && (u[1] == 0)) {
+ const STRLEN len = u - s;
+ Move(s + 1, locs, len, char);
+ locs[len] = 0;
+ okay = TRUE;
}
}
}
@@ -186,7 +181,7 @@ Perl_new_ctype(pTHX_ char *newctype)
}
#endif /* USE_LOCALE_CTYPE */
- (void)newctype;
+ PERL_UNUSED_ARG(newctype);
}
/*
@@ -221,9 +216,9 @@ Perl_new_collate(pTHX_ char *newcoll)
/* 50: surely no system expands a char more. */
#define XFRMBUFSIZE (2 * 50)
char xbuf[XFRMBUFSIZE];
- Size_t fa = strxfrm(xbuf, "a", XFRMBUFSIZE);
- Size_t fb = strxfrm(xbuf, "ab", XFRMBUFSIZE);
- SSize_t mult = fb - fa;
+ const Size_t fa = strxfrm(xbuf, "a", XFRMBUFSIZE);
+ const Size_t fb = strxfrm(xbuf, "ab", XFRMBUFSIZE);
+ const SSize_t mult = fb - fa;
if (mult < 1)
Perl_croak(aTHX_ "strxfrm() gets absurd");
PL_collxfrm_base = (fa > (Size_t)mult) ? (fa - mult) : 0;
diff --git a/mg.c b/mg.c
index 6bb879687d..2fd8afe92c 100644
--- a/mg.c
+++ b/mg.c
@@ -63,9 +63,6 @@ Signal_t Perl_csighandler(int sig);
# define FAKE_DEFAULT_SIGNAL_HANDLERS
#endif
-static void restore_magic(pTHX_ const void *p);
-static void unwind_handler_stack(pTHX_ const void *p);
-
#ifdef __Lynx__
/* Missing protos on LynxOS */
void setruid(uid_t id);
@@ -91,7 +88,7 @@ S_save_magic(pTHX_ I32 mgs_ix, SV *sv)
MGS* mgs;
assert(SvMAGICAL(sv));
- SAVEDESTRUCTOR_X(restore_magic, INT2PTR(void*, (IV)mgs_ix));
+ SAVEDESTRUCTOR_X(S_restore_magic, INT2PTR(void*, (IV)mgs_ix));
mgs = SSPTR(mgs_ix, MGS*);
mgs->mgs_sv = sv;
@@ -198,7 +195,7 @@ Perl_mg_get(pTHX_ SV *sv)
}
}
- restore_magic(aTHX_ INT2PTR(void *, (IV)mgs_ix));
+ restore_magic(INT2PTR(void *, (IV)mgs_ix));
if (SvREFCNT(sv) == 1) {
/* We hold the last reference to this SV, which implies that the
@@ -236,7 +233,7 @@ Perl_mg_set(pTHX_ SV *sv)
CALL_FPTR(vtbl->svt_set)(aTHX_ sv, mg);
}
- restore_magic(aTHX_ INT2PTR(void*, (IV)mgs_ix));
+ restore_magic(INT2PTR(void*, (IV)mgs_ix));
return 0;
}
@@ -261,7 +258,7 @@ Perl_mg_length(pTHX_ SV *sv)
save_magic(mgs_ix, sv);
/* omit MGf_GSKIP -- not changed here */
len = CALL_FPTR(vtbl->svt_len)(aTHX_ sv, mg);
- restore_magic(aTHX_ INT2PTR(void*, (IV)mgs_ix));
+ restore_magic(INT2PTR(void*, (IV)mgs_ix));
return len;
}
}
@@ -288,7 +285,7 @@ Perl_mg_size(pTHX_ SV *sv)
save_magic(mgs_ix, sv);
/* omit MGf_GSKIP -- not changed here */
len = CALL_FPTR(vtbl->svt_len)(aTHX_ sv, mg);
- restore_magic(aTHX_ INT2PTR(void*, (IV)mgs_ix));
+ restore_magic(INT2PTR(void*, (IV)mgs_ix));
return len;
}
}
@@ -329,7 +326,7 @@ Perl_mg_clear(pTHX_ SV *sv)
CALL_FPTR(vtbl->svt_clear)(aTHX_ sv, mg);
}
- restore_magic(aTHX_ INT2PTR(void*, (IV)mgs_ix));
+ restore_magic(INT2PTR(void*, (IV)mgs_ix));
return 0;
}
@@ -422,7 +419,7 @@ U32
Perl_magic_regdata_cnt(pTHX_ SV *sv, MAGIC *mg)
{
register const REGEXP *rx;
- (void)sv;
+ PERL_UNUSED_ARG(sv);
if (PL_curpm && (rx = PM_GETRE(PL_curpm))) {
if (mg->mg_obj) /* @+ */
@@ -456,7 +453,7 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg)
i = s;
if (i > 0 && RX_MATCH_UTF8(rx)) {
- char *b = rx->subbeg;
+ const char * const b = rx->subbeg;
if (b)
i = Perl_utf8_length(aTHX_ (U8*)b, (U8*)(b+i));
}
@@ -470,7 +467,7 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_regdatum_set(pTHX_ SV *sv, MAGIC *mg)
{
- (void)sv; (void)mg;
+ PERL_UNUSED_ARG(sv); PERL_UNUSED_ARG(mg);
Perl_croak(aTHX_ PL_no_modify);
NORETURN_FUNCTION_END;
}
@@ -640,7 +637,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
}
#else
{
- int saveerrno = errno;
+ const int saveerrno = errno;
sv_setnv(sv, (NV)errno);
sv_setpv(sv, errno ? Strerror(errno) : "");
errno = saveerrno;
@@ -889,7 +886,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
sv_setpv(sv, errno ? Strerror(errno) : "");
#else
{
- int saveerrno = errno;
+ const int saveerrno = errno;
sv_setnv(sv, (NV)errno);
#ifdef OS2
if (errno == errno_isOS2 || errno == errno_isOS2_set)
@@ -948,7 +945,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_getuvar(pTHX_ SV *sv, MAGIC *mg)
{
- struct ufuncs *uf = (struct ufuncs *)mg->mg_ptr;
+ struct ufuncs * const uf = (struct ufuncs *)mg->mg_ptr;
if (uf && uf->uf_val)
(*uf->uf_val)(aTHX_ uf->uf_index, sv);
@@ -1008,7 +1005,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
}
#endif /* VMS */
if (s && klen == 4 && strEQ(ptr,"PATH")) {
- const char *strend = s + len;
+ const char * const strend = s + len;
while (s < strend) {
char tmpbuf[256];
@@ -1034,7 +1031,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_clearenv(pTHX_ SV *sv, MAGIC *mg)
{
- (void)sv;
+ PERL_UNUSED_ARG(sv);
my_setenv(MgPV_nolen_const(mg),Nullch);
return 0;
}
@@ -1093,8 +1090,8 @@ Perl_magic_clear_all_env(pTHX_ SV *sv, MAGIC *mg)
# endif /* PERL_IMPLICIT_SYS || WIN32 */
#endif /* VMS || EPOC */
#endif /* !PERL_MICRO */
- (void)sv;
- (void)mg;
+ PERL_UNUSED_ARG(sv);
+ PERL_UNUSED_ARG(mg);
return 0;
}
@@ -1120,9 +1117,8 @@ restore_sigmask(pTHX_ SV *save_sv)
int
Perl_magic_getsig(pTHX_ SV *sv, MAGIC *mg)
{
- I32 i;
/* Are we fetching a signal entry? */
- i = whichsig(MgPV_nolen_const(mg));
+ const I32 i = whichsig(MgPV_nolen_const(mg));
if (i > 0) {
if(PL_psig_ptr[i])
sv_setsv(sv,PL_psig_ptr[i]);
@@ -1152,8 +1148,8 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg)
/* XXX Some of this code was copied from Perl_magic_setsig. A little
* refactoring might be in order.
*/
- register const char *s = MgPV_nolen_const(mg);
- (void)sv;
+ register const char * const s = MgPV_nolen_const(mg);
+ PERL_UNUSED_ARG(sv);
if (*s == '_') {
SV** svp;
if (strEQ(s,"__DIE__"))
@@ -1163,15 +1159,14 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg)
else
Perl_croak(aTHX_ "No such hook: %s", s);
if (*svp) {
- SV *to_dec = *svp;
+ SV * const to_dec = *svp;
*svp = 0;
SvREFCNT_dec(to_dec);
}
}
else {
- I32 i;
/* Are we clearing a signal entry? */
- i = whichsig(s);
+ const I32 i = whichsig(s);
if (i > 0) {
#ifdef HAS_SIGPROCMASK
sigset_t set, save;
@@ -1411,8 +1406,8 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg)
{
- (void)sv;
- (void)mg;
+ PERL_UNUSED_ARG(sv);
+ PERL_UNUSED_ARG(mg);
PL_sub_generation++;
return 0;
}
@@ -1420,8 +1415,8 @@ Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setamagic(pTHX_ SV *sv, MAGIC *mg)
{
- (void)sv;
- (void)mg;
+ PERL_UNUSED_ARG(sv);
+ PERL_UNUSED_ARG(mg);
/* HV_badAMAGIC_on(Sv_STASH(sv)); */
PL_amagic_generation++;
@@ -1433,7 +1428,7 @@ Perl_magic_getnkeys(pTHX_ SV *sv, MAGIC *mg)
{
HV * const hv = (HV*)LvTARG(sv);
I32 i = 0;
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (hv) {
(void) hv_iterinit(hv);
@@ -1452,7 +1447,7 @@ Perl_magic_getnkeys(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setnkeys(pTHX_ SV *sv, MAGIC *mg)
{
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (LvTARG(sv)) {
hv_ksplit((HV*)LvTARG(sv), SvIV(sv));
}
@@ -1606,8 +1601,8 @@ Perl_magic_scalarpack(pTHX_ HV *hv, MAGIC *mg)
{
dSP;
SV *retval = &PL_sv_undef;
- SV *tied = SvTIED_obj((SV*)hv, mg);
- HV *pkg = SvSTASH((SV*)SvRV(tied));
+ SV * const tied = SvTIED_obj((SV*)hv, mg);
+ HV * const pkg = SvSTASH((SV*)SvRV(tied));
if (!gv_fetchmethod_autoload(pkg, "SCALAR", FALSE)) {
SV *key;
@@ -1639,21 +1634,19 @@ Perl_magic_scalarpack(pTHX_ HV *hv, MAGIC *mg)
int
Perl_magic_setdbline(pTHX_ SV *sv, MAGIC *mg)
{
- OP *o;
- I32 i;
- GV* gv;
- SV** svp;
-
- gv = PL_DBline;
- i = SvTRUE(sv);
- svp = av_fetch(GvAV(gv),
+ GV * const gv = PL_DBline;
+ const I32 i = SvTRUE(sv);
+ SV ** const svp = av_fetch(GvAV(gv),
atoi(MgPV_nolen_const(mg)), FALSE);
- if (svp && SvIOKp(*svp) && (o = INT2PTR(OP*,SvIVX(*svp)))) {
- /* set or clear breakpoint in the relevant control op */
- if (i)
- o->op_flags |= OPf_SPECIAL;
- else
- o->op_flags &= ~OPf_SPECIAL;
+ if (svp && SvIOKp(*svp)) {
+ OP * const o = INT2PTR(OP*,SvIVX(*svp));
+ if (o) {
+ /* set or clear breakpoint in the relevant control op */
+ if (i)
+ o->op_flags |= OPf_SPECIAL;
+ else
+ o->op_flags &= ~OPf_SPECIAL;
+ }
}
return 0;
}
@@ -1675,7 +1668,7 @@ Perl_magic_setarylen(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_getpos(pTHX_ SV *sv, MAGIC *mg)
{
- SV* lsv = LvTARG(sv);
+ SV* const lsv = LvTARG(sv);
if (SvTYPE(lsv) >= SVt_PVMG && SvMAGIC(lsv)) {
mg = mg_find(lsv, PERL_MAGIC_regex_global);
@@ -1694,7 +1687,7 @@ Perl_magic_getpos(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg)
{
- SV* lsv = LvTARG(sv);
+ SV* const lsv = LvTARG(sv);
SSize_t pos;
STRLEN len;
STRLEN ulen = 0;
@@ -1746,7 +1739,7 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_getglob(pTHX_ SV *sv, MAGIC *mg)
{
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (SvFAKE(sv)) { /* FAKE globs can get coerced */
SvFAKE_off(sv);
gv_efullname3(sv,((GV*)sv), "*");
@@ -1763,7 +1756,7 @@ Perl_magic_setglob(pTHX_ SV *sv, MAGIC *mg)
register char *s;
GV* gv;
STRLEN n_a;
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (!SvOK(sv))
return 0;
@@ -1787,7 +1780,7 @@ Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg)
const char * const tmps = SvPV_const(lsv,len);
I32 offs = LvTARGOFF(sv);
I32 rem = LvTARGLEN(sv);
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (SvUTF8(lsv))
sv_pos_u2b(lsv, &offs, &rem);
@@ -1809,7 +1802,7 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
SV * const lsv = LvTARG(sv);
I32 lvoff = LvTARGOFF(sv);
I32 lvlen = LvTARGLEN(sv);
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (DO_UTF8(sv)) {
sv_utf8_upgrade(lsv);
@@ -1832,6 +1825,7 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_gettaint(pTHX_ SV *sv, MAGIC *mg)
{
+ PERL_UNUSED_ARG(sv);
TAINT_IF((mg->mg_len & 1) ||
((mg->mg_len & 2) && mg->mg_obj == sv)); /* kludge */
return 0;
@@ -1840,7 +1834,7 @@ Perl_magic_gettaint(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_settaint(pTHX_ SV *sv, MAGIC *mg)
{
- (void)sv;
+ PERL_UNUSED_ARG(sv);
if (PL_localizing) {
if (PL_localizing == 1)
mg->mg_len <<= 1;
@@ -1858,7 +1852,7 @@ int
Perl_magic_getvec(pTHX_ SV *sv, MAGIC *mg)
{
SV * const lsv = LvTARG(sv);
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (!lsv) {
SvOK_off(sv);
@@ -1872,7 +1866,7 @@ Perl_magic_getvec(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setvec(pTHX_ SV *sv, MAGIC *mg)
{
- (void)mg;
+ PERL_UNUSED_ARG(mg);
do_vecset(sv); /* XXX slurp this routine */
return 0;
}
@@ -1883,9 +1877,9 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg)
SV *targ = Nullsv;
if (LvTARGLEN(sv)) {
if (mg->mg_obj) {
- SV *ahv = LvTARG(sv);
+ SV * const ahv = LvTARG(sv);
if (SvTYPE(ahv) == SVt_PVHV) {
- HE *he = hv_fetch_ent((HV*)ahv, mg->mg_obj, FALSE, 0);
+ HE * const he = hv_fetch_ent((HV*)ahv, mg->mg_obj, FALSE, 0);
if (he)
targ = HeVAL(he);
}
@@ -1896,7 +1890,7 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg)
}
}
else {
- AV* av = (AV*)LvTARG(sv);
+ AV* const av = (AV*)LvTARG(sv);
if ((I32)LvTARGOFF(sv) <= AvFILL(av))
targ = AvARRAY(av)[LvTARGOFF(sv)];
}
@@ -1919,7 +1913,7 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setdefelem(pTHX_ SV *sv, MAGIC *mg)
{
- (void)mg;
+ PERL_UNUSED_ARG(mg);
if (LvTARGLEN(sv))
vivify_defelem(sv);
if (LvTARG(sv)) {
@@ -1938,9 +1932,9 @@ Perl_vivify_defelem(pTHX_ SV *sv)
if (!LvTARGLEN(sv) || !(mg = mg_find(sv, PERL_MAGIC_defelem)))
return;
if (mg->mg_obj) {
- SV *ahv = LvTARG(sv);
+ SV * const ahv = LvTARG(sv);
if (SvTYPE(ahv) == SVt_PVHV) {
- HE *he = hv_fetch_ent((HV*)ahv, mg->mg_obj, TRUE, 0);
+ HE * const he = hv_fetch_ent((HV*)ahv, mg->mg_obj, TRUE, 0);
if (he)
value = HeVAL(he);
}
@@ -1953,7 +1947,7 @@ Perl_vivify_defelem(pTHX_ SV *sv)
Perl_croak(aTHX_ PL_no_helem_sv, mg->mg_obj);
}
else {
- AV* av = (AV*)LvTARG(sv);
+ AV* const av = (AV*)LvTARG(sv);
if ((I32)LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av))
LvTARG(sv) = Nullsv; /* array can't be extended */
else {
@@ -1974,10 +1968,10 @@ Perl_vivify_defelem(pTHX_ SV *sv)
int
Perl_magic_killbackrefs(pTHX_ SV *sv, MAGIC *mg)
{
- AV *av = (AV*)mg->mg_obj;
- SV **svp = AvARRAY(av);
+ AV * const av = (AV*)mg->mg_obj;
+ SV ** const svp = AvARRAY(av);
I32 i = AvFILLp(av);
- (void)sv;
+ PERL_UNUSED_ARG(sv);
while (i >= 0) {
if (svp[i]) {
@@ -2006,7 +2000,7 @@ Perl_magic_setmglob(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setbm(pTHX_ SV *sv, MAGIC *mg)
{
- (void)mg;
+ PERL_UNUSED_ARG(mg);
sv_unmagic(sv, PERL_MAGIC_bm);
SvVALID_off(sv);
return 0;
@@ -2015,7 +2009,7 @@ Perl_magic_setbm(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setfm(pTHX_ SV *sv, MAGIC *mg)
{
- (void)mg;
+ PERL_UNUSED_ARG(mg);
sv_unmagic(sv, PERL_MAGIC_fm);
SvCOMPILED_off(sv);
return 0;
@@ -2034,7 +2028,7 @@ Perl_magic_setuvar(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setregexp(pTHX_ SV *sv, MAGIC *mg)
{
- (void)mg;
+ PERL_UNUSED_ARG(mg);
sv_unmagic(sv, PERL_MAGIC_qr);
return 0;
}
@@ -2042,9 +2036,10 @@ Perl_magic_setregexp(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_freeregexp(pTHX_ SV *sv, MAGIC *mg)
{
- regexp *re = (regexp *)mg->mg_obj;
+ regexp * const re = (regexp *)mg->mg_obj;
+ PERL_UNUSED_ARG(sv);
+
ReREFCNT_dec(re);
- (void)sv;
return 0;
}
@@ -2056,7 +2051,7 @@ Perl_magic_setcollxfrm(pTHX_ SV *sv, MAGIC *mg)
* RenE<eacute> Descartes said "I think not."
* and vanished with a faint plop.
*/
- (void)sv;
+ PERL_UNUSED_ARG(sv);
if (mg->mg_ptr) {
Safefree(mg->mg_ptr);
mg->mg_ptr = NULL;
@@ -2070,7 +2065,7 @@ Perl_magic_setcollxfrm(pTHX_ SV *sv, MAGIC *mg)
int
Perl_magic_setutf8(pTHX_ SV *sv, MAGIC *mg)
{
- (void)sv;
+ PERL_UNUSED_ARG(sv);
Safefree(mg->mg_ptr); /* The mg_ptr holds the pos cache. */
mg->mg_ptr = 0;
mg->mg_len = -1; /* The mg_len holds the len cache. */
@@ -2250,7 +2245,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
break;
case '|':
{
- IO *io = GvIOp(PL_defoutgv);
+ IO * const io = GvIOp(PL_defoutgv);
if(!io)
break;
if ((SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv)) == 0)
@@ -2581,12 +2576,12 @@ Perl_sighandler(int sig)
#endif
dSP;
GV *gv = Nullgv;
- HV *st;
- SV *sv = Nullsv, *tSv = PL_Sv;
+ SV *sv = Nullsv;
+ SV * const tSv = PL_Sv;
CV *cv = Nullcv;
OP *myop = PL_op;
U32 flags = 0;
- XPV *tXpv = PL_Xpv;
+ XPV * const tXpv = PL_Xpv;
if (PL_savestack_ix + 15 <= PL_savestack_max)
flags |= 1;
@@ -2607,7 +2602,7 @@ Perl_sighandler(int sig)
infinity, so we fix 4 (in fact 5): */
if (flags & 1) {
PL_savestack_ix += 5; /* Protect save in progress. */
- SAVEDESTRUCTOR_X(unwind_handler_stack, (void*)&flags);
+ SAVEDESTRUCTOR_X(S_unwind_handler_stack, (void*)&flags);
}
if (flags & 4)
PL_markstack_ptr++; /* Protect mark. */
@@ -2619,8 +2614,10 @@ Perl_sighandler(int sig)
PL_scopestack_ix += 1;
/* sv_2cv is too complicated, try a simpler variant first: */
if (!SvROK(PL_psig_ptr[sig]) || !(cv = (CV*)SvRV(PL_psig_ptr[sig]))
- || SvTYPE(cv) != SVt_PVCV)
+ || SvTYPE(cv) != SVt_PVCV) {
+ HV *st;
cv = sv_2cv(PL_psig_ptr[sig],&st,&gv,TRUE);
+ }
if (!cv || !CvROOT(cv)) {
if (ckWARN(WARN_SIGNAL))
@@ -2690,10 +2687,10 @@ cleanup:
static void
-restore_magic(pTHX_ const void *p)
+S_restore_magic(pTHX_ const void *p)
{
- MGS* mgs = SSPTR(PTR2IV(p), MGS*);
- SV* sv = mgs->mgs_sv;
+ MGS* const mgs = SSPTR(PTR2IV(p), MGS*);
+ SV* const sv = mgs->mgs_sv;
if (!sv)
return;
@@ -2731,7 +2728,7 @@ restore_magic(pTHX_ const void *p)
}
static void
-unwind_handler_stack(pTHX_ const void *p)
+S_unwind_handler_stack(pTHX_ const void *p)
{
const U32 flags = *(const U32*)p;
diff --git a/perlio.c b/perlio.c
index a57ff9efd5..9bb3c9ef0d 100644
--- a/perlio.c
+++ b/perlio.c
@@ -163,9 +163,9 @@ perlsio_binmode(FILE *fp, int iotype, int mode)
else
return 0;
# else
- (void)fp;
- (void)iotype;
- (void)mode;
+ PERL_UNUSED_ARG(fp);
+ PERL_UNUSED_ARG(iotype);
+ PERL_UNUSED_ARG(mode);
return 1;
# endif
#endif
@@ -248,9 +248,9 @@ int
PerlIO_binmode(pTHX_ PerlIO *fp, int iotype, int mode, const char *names)
{
#ifdef USE_SFIO
- (void)iotype;
- (void)mode;
- (void)names;
+ PERL_UNUSED_ARG(iotype);
+ PERL_UNUSED_ARG(mode);
+ PERL_UNUSED_ARG(names);
return 1;
#else
return perlsio_binmode(fp, iotype, mode);
@@ -1039,9 +1039,9 @@ PerlIO_layer_fetch(pTHX_ PerlIO_list_t *av, IV n, PerlIO_funcs *def)
IV
PerlIOPop_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab)
{
- (void)mode;
- (void)arg;
- (void)tab;
+ PERL_UNUSED_ARG(mode);
+ PERL_UNUSED_ARG(arg);
+ PERL_UNUSED_ARG(tab);
if (PerlIOValid(f)) {
PerlIO_flush(f);
PerlIO_pop(aTHX_ f);
@@ -1216,9 +1216,9 @@ PerlIOBase_binmode(pTHX_ PerlIO *f)
IV
PerlIORaw_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab)
{
- (void)mode;
- (void)arg;
- (void)tab;
+ PERL_UNUSED_ARG(mode);
+ PERL_UNUSED_ARG(arg);
+ PERL_UNUSED_ARG(tab);
if (PerlIOValid(f)) {
PerlIO *t;
@@ -1260,7 +1260,7 @@ PerlIO_apply_layera(pTHX_ PerlIO *f, const char *mode,
{
int code = 0;
while (n < max) {
- PerlIO_funcs *tab = PerlIO_layer_fetch(aTHX_ layers, n, NULL);
+ PerlIO_funcs * const tab = PerlIO_layer_fetch(aTHX_ layers, n, NULL);
if (tab) {
if (!PerlIO_push(aTHX_ f, tab, mode, PerlIOArg)) {
code = -1;
@@ -1277,7 +1277,7 @@ PerlIO_apply_layers(pTHX_ PerlIO *f, const char *mode, const char *names)
{
int code = 0;
if (f && names) {
- PerlIO_list_t *layers = PerlIO_list_alloc(aTHX);
+ PerlIO_list_t * const layers = PerlIO_list_alloc(aTHX);
code = PerlIO_parse_layers(aTHX_ layers, names);
if (code == 0) {
code = PerlIO_apply_layera(aTHX_ f, mode, layers, 0, layers->cur);
@@ -1815,8 +1815,8 @@ 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)
{
- (void)mode;
- (void)arg;
+ PERL_UNUSED_ARG(mode);
+ PERL_UNUSED_ARG(arg);
if (PerlIOValid(f)) {
if (tab->kind & PERLIO_K_UTF8)
PerlIOBase(f)->flags |= PERLIO_F_UTF8;
@@ -1894,8 +1894,8 @@ PerlIORaw_open(pTHX_ PerlIO_funcs *self, PerlIO_list_t *layers,
IV n, const char *mode, int fd, int imode, int perm,
PerlIO *old, int narg, SV **args)
{
- PerlIO_funcs *tab = PerlIO_default_btm();
- (void)self;
+ PerlIO_funcs * const tab = PerlIO_default_btm();
+ PERL_UNUSED_ARG(self);
if (tab && tab->Open)
return (*tab->Open) (aTHX_ tab, layers, n - 1, mode, fd, imode, perm,
old, narg, args);
@@ -1982,7 +1982,7 @@ IV
PerlIOBase_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab)
{
PerlIOl * const l = PerlIOBase(f);
- (void)arg;
+ PERL_UNUSED_ARG(arg);
l->flags &= ~(PERLIO_F_CANREAD | PERLIO_F_CANWRITE |
PERLIO_F_TRUNCATE | PERLIO_F_APPEND);
@@ -2040,7 +2040,7 @@ PerlIOBase_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab)
IV
PerlIOBase_popped(pTHX_ PerlIO *f)
{
- (void)f;
+ PERL_UNUSED_ARG(f);
return 0;
}
@@ -2091,14 +2091,14 @@ PerlIOBase_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
IV
PerlIOBase_noop_ok(pTHX_ PerlIO *f)
{
- (void)f;
+ PERL_UNUSED_ARG(f);
return 0;
}
IV
PerlIOBase_noop_fail(pTHX_ PerlIO *f)
{
- (void)f;
+ PERL_UNUSED_ARG(f);
return -1;
}
@@ -2949,7 +2949,7 @@ PerlIOStdio_invalidate_fileno(pTHX_ FILE *f)
*/
# error "Don't know how to set FILE.fileno on your platform"
#endif
- (void)f;
+ PERL_UNUSED_ARG(f);
return 0;
# endif
}
@@ -4770,8 +4770,8 @@ PerlIO_getname(PerlIO *f, char *buf)
}
return name;
#else
- (void)f;
- (void)buf;
+ PERL_UNUSED_ARG(f);
+ PERL_UNUSED_ARG(buf);
Perl_croak(aTHX_ "Don't know how to get file name");
return Nullch;
#endif
diff --git a/pp_ctl.c b/pp_ctl.c
index dfe2caa744..9b6bd7ee4b 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1939,12 +1939,13 @@ PP(pp_last)
register PERL_CONTEXT *cx;
I32 pop2 = 0;
I32 gimme;
- I32 optype = 0;
+ I32 optype;
OP *nextop;
SV **newsp;
PMOP *newpm;
SV **mark;
SV *sv = Nullsv;
+ PERL_UNUSED_VAR(optype);
if (PL_op->op_flags & OPf_SPECIAL) {
cxix = dopoptoloop(cxstack_ix);
diff --git a/pp_sys.c b/pp_sys.c
index a3ce987d87..e08ea0b543 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1307,8 +1307,8 @@ PP(pp_leavewrite)
register IO * const io = GvIOp(gv);
PerlIO * const ofp = IoOFP(io);
PerlIO *fp;
- SV **newsp = Null(SV**);
- I32 gimme = 0;
+ SV **newsp;
+ I32 gimme;
register PERL_CONTEXT *cx;
PERL_UNUSED_VAR(newsp);
PERL_UNUSED_VAR(gimme);
diff --git a/proto.h b/proto.h
index e1dbfa361b..c68cf68a58 100644
--- a/proto.h
+++ b/proto.h
@@ -87,9 +87,7 @@ PERL_CALLCONV HE* Perl_avhv_iternext(pTHX_ AV *ar);
PERL_CALLCONV SV* Perl_avhv_iterval(pTHX_ AV *ar, HE* entry);
PERL_CALLCONV HV* Perl_avhv_keys(pTHX_ AV *ar);
PERL_CALLCONV void Perl_av_clear(pTHX_ AV* ar);
-PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV* ar, I32 key, I32 flags)
- __attribute__warn_unused_result__;
-
+PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV* ar, I32 key, I32 flags);
PERL_CALLCONV bool Perl_av_exists(pTHX_ AV* ar, I32 key)
__attribute__warn_unused_result__;
@@ -111,9 +109,7 @@ PERL_CALLCONV AV* Perl_av_make(pTHX_ I32 size, SV** svp)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_2);
-PERL_CALLCONV SV* Perl_av_pop(pTHX_ AV* ar)
- __attribute__warn_unused_result__;
-
+PERL_CALLCONV SV* Perl_av_pop(pTHX_ AV* ar);
PERL_CALLCONV void Perl_av_push(pTHX_ AV* ar, SV* val);
PERL_CALLCONV void Perl_av_reify(pTHX_ AV* ar);
PERL_CALLCONV SV* Perl_av_shift(pTHX_ AV* ar)
@@ -381,7 +377,10 @@ PERL_CALLCONV char* Perl_vform(pTHX_ const char* pat, va_list* args);
PERL_CALLCONV void Perl_free_tmps(pTHX);
PERL_CALLCONV OP* Perl_gen_constant_list(pTHX_ OP* o);
#if !defined(HAS_GETENV_LEN)
-PERL_CALLCONV char* Perl_getenv_len(pTHX_ const char* key, unsigned long *len);
+PERL_CALLCONV char* Perl_getenv_len(pTHX_ const char* key, unsigned long *len)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+
#endif
PERL_CALLCONV void Perl_gp_free(pTHX_ GV* gv);
PERL_CALLCONV GP* Perl_gp_ref(pTHX_ GP* gp);
@@ -415,7 +414,6 @@ PERL_CALLCONV void Perl_gv_fullname(pTHX_ SV* sv, GV* gv);
PERL_CALLCONV void Perl_gv_fullname4(pTHX_ SV* sv, GV* gv, const char* prefix, bool keepmain);
PERL_CALLCONV void Perl_gv_init(pTHX_ GV* gv, HV* stash, const char* name, STRLEN len, int multi)
__attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3);
PERL_CALLCONV HV* Perl_gv_stashpv(pTHX_ const char* name, I32 create);
@@ -779,7 +777,10 @@ PERL_CALLCONV int Perl_magic_existspack(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_freeregexp(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_freeovrld(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_get(pTHX_ SV* sv, MAGIC* mg);
-PERL_CALLCONV int Perl_magic_getarylen(pTHX_ SV* sv, MAGIC* mg);
+PERL_CALLCONV int Perl_magic_getarylen(pTHX_ SV* sv, MAGIC* mg)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+
PERL_CALLCONV int Perl_magic_getdefelem(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_getglob(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_getnkeys(pTHX_ SV* sv, MAGIC* mg);
@@ -1096,7 +1097,8 @@ PERL_CALLCONV SV* Perl_newSVpvf(pTHX_ const char* pat, ...)
PERL_CALLCONV SV* Perl_vnewSVpvf(pTHX_ const char* pat, va_list* args);
PERL_CALLCONV SV* Perl_newSVrv(pTHX_ SV* rv, const char* classname)
__attribute__malloc__
- __attribute__warn_unused_result__;
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_newSVsv(pTHX_ SV* old)
__attribute__malloc__
@@ -1185,15 +1187,11 @@ PERL_CALLCONV HV* Perl_get_hv(pTHX_ const char* name, I32 create);
PERL_CALLCONV CV* Perl_get_cv(pTHX_ const char* name, I32 create);
PERL_CALLCONV int Perl_init_i18nl10n(pTHX_ int printwarn);
PERL_CALLCONV int Perl_init_i18nl14n(pTHX_ int printwarn);
-PERL_CALLCONV void Perl_new_collate(pTHX_ char* newcoll)
- __attribute__nonnull__(pTHX_1);
-
+PERL_CALLCONV void Perl_new_collate(pTHX_ char* newcoll);
PERL_CALLCONV void Perl_new_ctype(pTHX_ char* newctype)
__attribute__nonnull__(pTHX_1);
-PERL_CALLCONV void Perl_new_numeric(pTHX_ char* newcoll)
- __attribute__nonnull__(pTHX_1);
-
+PERL_CALLCONV void Perl_new_numeric(pTHX_ char* newcoll);
PERL_CALLCONV void Perl_set_numeric_local(pTHX);
PERL_CALLCONV void Perl_set_numeric_radix(pTHX);
PERL_CALLCONV void Perl_set_numeric_standard(pTHX);
@@ -1532,7 +1530,8 @@ PERL_CALLCONV MAGIC * Perl_sv_magicext(pTHX_ SV* sv, SV* obj, int how, MGVTBL *v
__attribute__nonnull__(pTHX_1);
PERL_CALLCONV SV* Perl_sv_mortalcopy(pTHX_ SV* oldsv)
- __attribute__nonnull__(pTHX_1);
+ __attribute__malloc__
+ __attribute__warn_unused_result__;
PERL_CALLCONV SV* Perl_sv_newmortal(pTHX)
__attribute__warn_unused_result__;
@@ -1576,7 +1575,9 @@ PERL_CALLCONV SV* Perl_sv_setref_iv(pTHX_ SV* rv, const char* classname, IV iv);
PERL_CALLCONV SV* Perl_sv_setref_uv(pTHX_ SV* rv, const char* classname, UV uv);
PERL_CALLCONV SV* Perl_sv_setref_nv(pTHX_ SV* rv, const char* classname, NV nv);
PERL_CALLCONV SV* Perl_sv_setref_pv(pTHX_ SV* rv, const char* classname, void* pv);
-PERL_CALLCONV SV* Perl_sv_setref_pvn(pTHX_ SV* rv, const char* classname, char* pv, STRLEN n);
+PERL_CALLCONV SV* Perl_sv_setref_pvn(pTHX_ SV* rv, const char* classname, char* pv, STRLEN n)
+ __attribute__nonnull__(pTHX_3);
+
PERL_CALLCONV void Perl_sv_setpv(pTHX_ SV* sv, const char* ptr);
PERL_CALLCONV void Perl_sv_setpvn(pTHX_ SV* sv, const char* ptr, STRLEN len)
__attribute__nonnull__(pTHX_1);
@@ -1616,7 +1617,9 @@ PERL_CALLCONV NV Perl_str_to_version(pTHX_ SV *sv);
PERL_CALLCONV SV* Perl_swash_init(pTHX_ char* pkg, char* name, SV* listsv, I32 minbits, I32 none);
PERL_CALLCONV UV Perl_swash_fetch(pTHX_ SV *sv, U8 *ptr, bool do_utf8);
PERL_CALLCONV void Perl_taint_env(pTHX);
-PERL_CALLCONV void Perl_taint_proper(pTHX_ const char* f, const char* s);
+PERL_CALLCONV void Perl_taint_proper(pTHX_ const char* f, const char* s)
+ __attribute__nonnull__(pTHX_2);
+
PERL_CALLCONV UV Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swash, char *normal, char *special)
__attribute__nonnull__(pTHX_1)
__attribute__nonnull__(pTHX_2);
@@ -1768,16 +1771,33 @@ PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len);
PERL_CALLCONV MGVTBL* Perl_get_vtbl(pTHX_ int vtbl_id);
PERL_CALLCONV char* Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim);
PERL_CALLCONV void Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
- __attribute__format__(__printf__,pTHX_3,pTHX_4);
-
-PERL_CALLCONV void Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args);
-PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv);
-PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv);
-PERL_CALLCONV void Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv);
-PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
-PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o);
-PERL_CALLCONV void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP *pm);
-PERL_CALLCONV void Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim);
+ __attribute__format__(__printf__,pTHX_3,pTHX_4)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file, char *name, GV *sv)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_hv_dump(pTHX_ I32 level, PerlIO *file, char *name, HV *sv)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, MAGIC *mg, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, PMOP *pm)
+ __attribute__nonnull__(pTHX_2);
+
+PERL_CALLCONV void Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim)
+ __attribute__nonnull__(pTHX_2);
+
PERL_CALLCONV void Perl_magic_dump(pTHX_ MAGIC *mg);
#if defined(PERL_FLEXIBLE_EXCEPTIONS)
PERL_CALLCONV void* Perl_default_protect(pTHX_ volatile JMPENV *je, int *excpt, protect_body_t body, ...);
@@ -1996,6 +2016,13 @@ STATIC int S_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32
__attribute__nonnull__(pTHX_2)
__attribute__nonnull__(pTHX_3);
+STATIC void S_restore_magic(pTHX_ const void *p)
+ __attribute__nonnull__(pTHX_1);
+
+STATIC void S_unwind_handler_stack(pTHX_ const void *p)
+ __attribute__nonnull__(pTHX_1);
+
+
#endif
#if defined(PERL_IN_OP_C) || defined(PERL_DECL_PROT)
@@ -2377,8 +2404,14 @@ STATIC SV* S_save_scalar_at(pTHX_ SV **sptr);
#endif
#if defined(PERL_IN_SV_C) || defined(PERL_DECL_PROT)
-STATIC IV S_asIV(pTHX_ SV* sv);
-STATIC UV S_asUV(pTHX_ SV* sv);
+STATIC IV S_asIV(pTHX_ SV* sv)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
+STATIC UV S_asUV(pTHX_ SV* sv)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1);
+
STATIC XPVIV* S_new_xiv(pTHX);
STATIC XPVNV* S_new_xnv(pTHX);
STATIC XPV* S_new_xpv(pTHX);
@@ -2405,11 +2438,22 @@ STATIC void S_del_xpvgv(pTHX_ XPVGV* p);
STATIC void S_del_xpvlv(pTHX_ XPVLV* p);
STATIC void S_del_xpvbm(pTHX_ XPVBM* p);
STATIC void S_del_xrv(pTHX_ XRV* p);
-STATIC void S_sv_unglob(pTHX_ SV* sv);
-STATIC void S_not_a_number(pTHX_ SV *sv);
-STATIC I32 S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask);
-STATIC void S_sv_add_backref(pTHX_ SV *tsv, SV *sv);
-STATIC void S_sv_del_backref(pTHX_ SV *sv);
+STATIC void S_sv_unglob(pTHX_ SV* sv)
+ __attribute__nonnull__(pTHX_1);
+
+STATIC void S_not_a_number(pTHX_ SV *sv)
+ __attribute__nonnull__(pTHX_1);
+
+STATIC I32 S_visit(pTHX_ SVFUNC_t f, U32 flags, U32 mask)
+ __attribute__nonnull__(pTHX_1);
+
+STATIC void S_sv_add_backref(pTHX_ SV *tsv, SV *sv)
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+
+STATIC void S_sv_del_backref(pTHX_ SV *sv)
+ __attribute__nonnull__(pTHX_1);
+
# ifdef DEBUGGING
STATIC void S_del_sv(pTHX_ SV *p);
# endif
@@ -2509,11 +2553,15 @@ STATIC SV* S_isa_lookup(pTHX_ HV *stash, const char *name, HV *name_stash, int l
#endif
#if defined(PERL_IN_LOCALE_C) || defined(PERL_DECL_PROT)
-STATIC char* S_stdize_locale(pTHX_ char* locs);
+STATIC char* S_stdize_locale(pTHX_ char* locs)
+ __attribute__nonnull__(pTHX_1);
+
#endif
#if defined(PERL_IN_UTIL_C) || defined(PERL_DECL_PROT)
-STATIC COP* S_closest_cop(pTHX_ COP *cop, OP *o);
+STATIC COP* S_closest_cop(pTHX_ COP *cop, const OP *o)
+ __attribute__nonnull__(pTHX_1);
+
STATIC SV* S_mess_alloc(pTHX);
#endif
diff --git a/scope.c b/scope.c
index 3869104b1b..ceba5db347 100644
--- a/scope.c
+++ b/scope.c
@@ -502,7 +502,7 @@ Perl_save_threadsv(pTHX_ PADOFFSET i)
return svp;
#else
Perl_croak(aTHX_ "panic: save_threadsv called in non-threaded perl");
- (void)i;
+ PERL_UNUSED_ARG(i);
NORETURN_FUNCTION_END;
#endif /* USE_5005THREADS */
}
diff --git a/taint.c b/taint.c
index 79b3350d0c..16bbd4be65 100644
--- a/taint.c
+++ b/taint.c
@@ -24,24 +24,22 @@
void
Perl_taint_proper(pTHX_ const char *f, const char *s)
{
- const char *ug;
-
#if defined(HAS_SETEUID) && defined(DEBUGGING)
# if Uid_t_size == 1
{
- UV uid = PL_uid;
- UV euid = PL_euid;
+ const UV uid = PL_uid;
+ const UV euid = PL_euid;
- DEBUG_u(PerlIO_printf(Perl_debug_log,
+ DEBUG_u(PerlIO_printf(Perl_debug_log,
"%s %d %"UVuf" %"UVuf"\n",
s, PL_tainted, uid, euid));
}
# else
{
- IV uid = PL_uid;
- IV euid = PL_euid;
+ const IV uid = PL_uid;
+ const IV euid = PL_euid;
- DEBUG_u(PerlIO_printf(Perl_debug_log,
+ DEBUG_u(PerlIO_printf(Perl_debug_log,
"%s %d %"IVdf" %"IVdf"\n",
s, PL_tainted, uid, euid));
}
@@ -49,6 +47,8 @@ Perl_taint_proper(pTHX_ const char *f, const char *s)
#endif
if (PL_tainted) {
+ const char *ug;
+
if (!f)
f = PL_no_security;
if (PL_euid != PL_uid)
@@ -91,7 +91,7 @@ Perl_taint_env(pTHX)
if (!GvHV(PL_envgv) || !(SvRMAGICAL(GvHV(PL_envgv))
&& mg_find((SV*)GvHV(PL_envgv), PERL_MAGIC_env))) {
const bool was_tainted = PL_tainted;
- const char *name = GvENAME(PL_envgv);
+ const char * const name = GvENAME(PL_envgv);
PL_tainted = TRUE;
if (strEQ(name,"ENV"))
/* hash alias */
@@ -146,7 +146,7 @@ Perl_taint_env(pTHX)
STRLEN len;
const bool was_tainted = PL_tainted;
const char *t = SvPV_const(*svp, len);
- const char *e = t + len;
+ const char * const e = t + len;
PL_tainted = was_tainted;
if (t < e && isALNUM(*t))
t++;
@@ -160,7 +160,7 @@ Perl_taint_env(pTHX)
#endif /* !VMS */
for (e = misc_env; *e; e++) {
- svp = hv_fetch(GvHVn(PL_envgv), *e, strlen(*e), FALSE);
+ SV ** const svp = hv_fetch(GvHVn(PL_envgv), *e, strlen(*e), FALSE);
if (svp && *svp != &PL_sv_undef && SvTAINTED(*svp)) {
TAINT;
taint_proper("Insecure $ENV{%s}%s", *e);
diff --git a/util.c b/util.c
index b6cb13ae31..0d149cd028 100644
--- a/util.c
+++ b/util.c
@@ -947,7 +947,7 @@ Perl_mess(pTHX_ const char *pat, ...)
}
STATIC COP*
-S_closest_cop(pTHX_ COP *cop, OP *o)
+S_closest_cop(pTHX_ COP *cop, const OP *o)
{
/* Look for PL_op starting from o. cop is the last COP we've seen. */
@@ -974,7 +974,7 @@ S_closest_cop(pTHX_ COP *cop, OP *o)
/* Nothing found. */
- return 0;
+ return Null(COP *);
}
SV *
@@ -2996,7 +2996,7 @@ Perl_set_context(void *t)
Perl_croak_nocontext("panic: pthread_setspecific");
# endif
#else
- (void)t;
+ PERL_UNUSED_ARG(t);
#endif
}
@@ -3322,7 +3322,7 @@ Perl_get_ppaddr(pTHX)
char *
Perl_getenv_len(pTHX_ const char *env_elem, unsigned long *len)
{
- char *env_trans = PerlEnv_getenv(env_elem);
+ char * const env_trans = PerlEnv_getenv(env_elem);
if (env_trans)
*len = strlen(env_trans);
return env_trans;