From: Andy Lester Date: Fri, 25 Mar 2005 17:14:09 +0000 (-0600) Subject: Consting five X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd374669df59cc2457708a01ea0f6d332912530b;p=p5sagit%2Fp5-mst-13.2.git Consting five Message-ID: <20050325231409.GB17660@petdance.com> [with modification - the extra argument to incpush was supposed to be being used] p4raw-id: //depot/perl@24081 --- diff --git a/av.c b/av.c index df2cf23..5dd0222 100644 --- a/av.c +++ b/av.c @@ -380,13 +380,13 @@ AV * Perl_av_make(pTHX_ register I32 size, register SV **strp) { register AV *av; - register I32 i; - register SV** ary; av = (AV*)NEWSV(8,0); sv_upgrade((SV *) av,SVt_PVAV); AvFLAGS(av) = AVf_REAL; if (size) { /* `defined' was returning undef for size==0 anyway. */ + register SV** ary; + register I32 i; New(4,ary,size,SV*); AvALLOC(av) = ary; SvPVX(av) = (char*)ary; @@ -438,7 +438,6 @@ void Perl_av_clear(pTHX_ register AV *av) { register I32 key; - SV** ary; #ifdef DEBUGGING if (SvREFCNT(av) == 0 && ckWARN_d(WARN_DEBUGGING)) { @@ -460,7 +459,7 @@ Perl_av_clear(pTHX_ register AV *av) return; if (AvREAL(av)) { - ary = AvARRAY(av); + SV** ary = AvARRAY(av); key = AvFILLp(av) + 1; while (key) { SV * sv = ary[--key]; diff --git a/embed.fnc b/embed.fnc index 4faf632..b66185b 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1028,7 +1028,7 @@ Ap |void |Slab_Free |void *op #if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT) s |void |find_beginning s |void |forbid_setid |const char * s -s |void |incpush |const char *|int|int|int|int +s |void |incpush |const char *dir|bool addsubdirs|bool addoldvers|bool usesep|bool canrelocate s |void |init_interp s |void |init_ids s |void |init_lexer @@ -1038,15 +1038,15 @@ s |void |init_postdump_symbols|int|char **|char ** s |void |init_predump_symbols rs |void |my_exit_jump s |void |nuke_stacks -s |void |open_script |char *|bool|SV * -s |void |usage |const char * +s |void |open_script |const char *scriptname|bool dosearch|SV *sv +s |void |usage |const char *name s |void |validate_suid |const char *validarg|const char *scriptname # if defined(IAMSUID) s |int |fd_on_nosuid_fs|int fd # endif s |void* |parse_body |char **env|XSINIT_t xsinit -s |void* |run_body |I32 oldscope -s |void |call_body |const OP *myop|int is_eval +rs |void |run_body |I32 oldscope +s |void |call_body |const OP *myop|bool is_eval s |void* |call_list_body |CV *cv #endif diff --git a/ext/DynaLoader/dlutils.c b/ext/DynaLoader/dlutils.c index 2bd73ad..474c93d 100644 --- a/ext/DynaLoader/dlutils.c +++ b/ext/DynaLoader/dlutils.c @@ -112,12 +112,12 @@ dl_generic_private_init(pTHX) /* called by dl_*.xs dl_private_init() */ /* SaveError() takes printf style args and saves the result in dl_last_error */ static void -SaveError(pTHX_ char* pat, ...) +SaveError(pTHX_ const char* pat, ...) { dMY_CXT; va_list args; SV *msv; - char *message; + const char *message; STRLEN len; /* This code is based on croak/warn, see mess() in util.c */ diff --git a/gv.c b/gv.c index 77d35a7..f85b5fd 100644 --- a/gv.c +++ b/gv.c @@ -672,7 +672,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, I32 len; register const char *namend; HV *stash = 0; - I32 add = flags & ~SVf_UTF8; + const I32 add = flags & ~SVf_UTF8; + (void)full_len; if (*name == '*' && isALPHA(name[1])) /* accidental stringify on a GV? */ name++; @@ -1230,7 +1231,7 @@ Perl_gv_check(pTHX_ HV *stash) } CopLINE_set(PL_curcop, GvLINE(gv)); #ifdef USE_ITHREADS - CopFILE(PL_curcop) = file; /* set for warning */ + CopFILE(PL_curcop) = (char *)file; /* set for warning */ #else CopFILEGV(PL_curcop) = gv_fetchfile(file); #endif @@ -1317,6 +1318,8 @@ int Perl_magic_freeovrld(pTHX_ SV *sv, MAGIC *mg) { AMT *amtp = (AMT*)mg->mg_ptr; + (void)sv; + if (amtp && AMT_AMAGIC(amtp)) { int i; for (i = 1; i < NofAMmeth; i++) { @@ -1867,6 +1870,7 @@ pointers returned by SvPV. bool Perl_is_gv_magical(pTHX_ const char *name, STRLEN len, U32 flags) { + (void)flags; if (len > 1) { const char *name1 = name + 1; switch (*name) { diff --git a/intrpvar.h b/intrpvar.h index 6a7bc36..3159b28 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -30,7 +30,7 @@ PERLVAR(Iwarnhook, SV *) PERLVAR(Iminus_c, bool) PERLVAR(Ipatchlevel, SV *) PERLVAR(Ilocalpatches, const char **) -PERLVARI(Isplitstr, char *, " ") +PERLVARI(Isplitstr, const char *, " ") PERLVAR(Ipreprocess, bool) PERLVAR(Iminus_n, bool) PERLVAR(Iminus_p, bool) @@ -243,7 +243,7 @@ PERLVARI(Imaxo, int, MAXO) /* maximum number of ops */ PERLVAR(Iosname, char *) /* operating system */ /* For binary compatibility with older versions only */ -PERLVARI(Ish_path_compat, char *, SH_PATH)/* full path of shell */ +PERLVARI(Ish_path_compat, const char *, SH_PATH)/* full path of shell */ PERLVAR(Isighandlerp, Sighandler_t) @@ -288,7 +288,7 @@ PERLVAR(Isv_no, SV) PERLVAR(Isv_yes, SV) #ifdef CSH -PERLVARI(Icshname, char *, CSH) +PERLVARI(Icshname, const char *, CSH) PERLVARI(Icshlen, I32, 0) #endif diff --git a/locale.c b/locale.c index c6b8782..7f336a6 100644 --- a/locale.c +++ b/locale.c @@ -186,6 +186,7 @@ Perl_new_ctype(pTHX_ char *newctype) } #endif /* USE_LOCALE_CTYPE */ + (void)newctype; } /* @@ -530,7 +531,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn) This is an alternative to using the -C command line switch (the -C if present will override this). */ { - char *p = PerlEnv_getenv("PERL_UNICODE"); + const char *p = PerlEnv_getenv("PERL_UNICODE"); PL_unicode = p ? parse_unicode_opts(&p) : 0; } #endif diff --git a/mg.c b/mg.c index db1175f..dfa6fc3 100644 --- a/mg.c +++ b/mg.c @@ -427,6 +427,7 @@ U32 Perl_magic_regdata_cnt(pTHX_ SV *sv, MAGIC *mg) { register const REGEXP *rx; + (void)sv; if (PL_curpm && (rx = PM_GETRE(PL_curpm))) { if (mg->mg_obj) /* @+ */ @@ -474,10 +475,9 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_regdatum_set(pTHX_ SV *sv, MAGIC *mg) { + (void)sv; (void)mg; Perl_croak(aTHX_ PL_no_modify); /* NOT REACHED */ - (void)sv; (void)mg; - return 0; } U32 @@ -485,7 +485,7 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg) { register I32 paren; register I32 i; - register REGEXP *rx; + register const REGEXP *rx; I32 s1, t1; switch (*mg->mg_ptr) { @@ -1034,6 +1034,7 @@ int Perl_magic_clearenv(pTHX_ SV *sv, MAGIC *mg) { STRLEN n_a; + (void)sv; my_setenv(MgPV(mg,n_a),Nullch); return 0; } @@ -1093,6 +1094,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; return 0; } @@ -1152,8 +1155,8 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) * refactoring might be in order. */ STRLEN n_a; - SV* to_dec; register const char *s = MgPV(mg,n_a); + (void)sv; if (*s == '_') { SV** svp; if (strEQ(s,"__DIE__")) @@ -1163,7 +1166,7 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) else Perl_croak(aTHX_ "No such hook: %s", s); if (*svp) { - to_dec = *svp; + SV *to_dec = *svp; *svp = 0; SvREFCNT_dec(to_dec); } @@ -1200,7 +1203,7 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) PL_psig_name[i]=0; } if(PL_psig_ptr[i]) { - to_dec=PL_psig_ptr[i]; + SV *to_dec=PL_psig_ptr[i]; PL_psig_ptr[i]=0; LEAVE; SvREFCNT_dec(to_dec); @@ -1212,8 +1215,8 @@ Perl_magic_clearsig(pTHX_ SV *sv, MAGIC *mg) return 0; } -void -Perl_raise_signal(pTHX_ int sig) +static void +S_raise_signal(pTHX_ int sig) { /* Set a flag to say this signal is pending */ PL_psig_pend[sig]++; @@ -1246,7 +1249,7 @@ Perl_csighandler(int sig) * with risk we may be in malloc() etc. */ (*PL_sighandlerp)(sig); else - Perl_raise_signal(aTHX_ sig); + S_raise_signal(aTHX_ sig); } #if defined(FAKE_PERSISTENT_SIGNAL_HANDLERS) || defined(FAKE_DEFAULT_SIGNAL_HANDLERS) @@ -1411,6 +1414,8 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg) { + (void)sv; + (void)mg; PL_sub_generation++; return 0; } @@ -1418,6 +1423,8 @@ Perl_magic_setisa(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setamagic(pTHX_ SV *sv, MAGIC *mg) { + (void)sv; + (void)mg; /* HV_badAMAGIC_on(Sv_STASH(sv)); */ PL_amagic_generation++; @@ -1427,8 +1434,9 @@ Perl_magic_setamagic(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_getnkeys(pTHX_ SV *sv, MAGIC *mg) { - HV *hv = (HV*)LvTARG(sv); + HV * const hv = (HV*)LvTARG(sv); I32 i = 0; + (void)mg; if (hv) { (void) hv_iterinit(hv); @@ -1447,6 +1455,7 @@ Perl_magic_getnkeys(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setnkeys(pTHX_ SV *sv, MAGIC *mg) { + (void)mg; if (LvTARG(sv)) { hv_ksplit((HV*)LvTARG(sv), SvIV(sv)); } @@ -1741,6 +1750,7 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_getglob(pTHX_ SV *sv, MAGIC *mg) { + (void)mg; if (SvFAKE(sv)) { /* FAKE globs can get coerced */ SvFAKE_off(sv); gv_efullname3(sv,((GV*)sv), "*"); @@ -1755,6 +1765,7 @@ int Perl_magic_setglob(pTHX_ SV *sv, MAGIC *mg) { GV* gv; + (void)mg; if (!SvOK(sv)) return 0; @@ -1775,6 +1786,7 @@ Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg) const char * const tmps = SvPV(lsv,len); I32 offs = LvTARGOFF(sv); I32 rem = LvTARGLEN(sv); + (void)mg; if (SvUTF8(lsv)) sv_pos_u2b(lsv, &offs, &rem); @@ -1793,9 +1805,10 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg) { STRLEN len; char *tmps = SvPV(sv, len); - SV *lsv = LvTARG(sv); + SV * const lsv = LvTARG(sv); I32 lvoff = LvTARGOFF(sv); I32 lvlen = LvTARGLEN(sv); + (void)mg; if (DO_UTF8(sv)) { sv_utf8_upgrade(lsv); @@ -1831,6 +1844,7 @@ Perl_magic_gettaint(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_settaint(pTHX_ SV *sv, MAGIC *mg) { + (void)sv; if (PL_localizing) { if (PL_localizing == 1) mg->mg_len <<= 1; @@ -1848,6 +1862,7 @@ int Perl_magic_getvec(pTHX_ SV *sv, MAGIC *mg) { SV * const lsv = LvTARG(sv); + (void)mg; if (!lsv) { SvOK_off(sv); @@ -1861,6 +1876,7 @@ Perl_magic_getvec(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setvec(pTHX_ SV *sv, MAGIC *mg) { + (void)mg; do_vecset(sv); /* XXX slurp this routine */ return 0; } @@ -1900,6 +1916,7 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setdefelem(pTHX_ SV *sv, MAGIC *mg) { + (void)mg; if (LvTARGLEN(sv)) vivify_defelem(sv); if (LvTARG(sv)) { @@ -1951,6 +1968,8 @@ Perl_magic_killbackrefs(pTHX_ SV *sv, MAGIC *mg) AV *av = (AV*)mg->mg_obj; SV **svp = AvARRAY(av); I32 i = AvFILLp(av); + (void)sv; + while (i >= 0) { if (svp[i]) { if (!SvWEAKREF(svp[i])) @@ -1978,6 +1997,7 @@ Perl_magic_setmglob(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setbm(pTHX_ SV *sv, MAGIC *mg) { + (void)mg; sv_unmagic(sv, PERL_MAGIC_bm); SvVALID_off(sv); return 0; @@ -1986,6 +2006,7 @@ Perl_magic_setbm(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setfm(pTHX_ SV *sv, MAGIC *mg) { + (void)mg; sv_unmagic(sv, PERL_MAGIC_fm); SvCOMPILED_off(sv); return 0; @@ -2004,6 +2025,7 @@ Perl_magic_setuvar(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setregexp(pTHX_ SV *sv, MAGIC *mg) { + (void)mg; sv_unmagic(sv, PERL_MAGIC_qr); return 0; } @@ -2013,6 +2035,7 @@ Perl_magic_freeregexp(pTHX_ SV *sv, MAGIC *mg) { regexp *re = (regexp *)mg->mg_obj; ReREFCNT_dec(re); + (void)sv; return 0; } @@ -2024,6 +2047,7 @@ Perl_magic_setcollxfrm(pTHX_ SV *sv, MAGIC *mg) * RenE Descartes said "I think not." * and vanished with a faint plop. */ + (void)sv; if (mg->mg_ptr) { Safefree(mg->mg_ptr); mg->mg_ptr = NULL; @@ -2037,6 +2061,7 @@ Perl_magic_setcollxfrm(pTHX_ SV *sv, MAGIC *mg) int Perl_magic_setutf8(pTHX_ SV *sv, MAGIC *mg) { + (void)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. */ diff --git a/miniperlmain.c b/miniperlmain.c index b31d236..032723f 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -48,6 +48,7 @@ int main(int argc, char **argv, char **env) { int exitstatus; + (void)env; #ifndef PERL_USE_SAFE_PUTENV PL_use_safe_putenv = 0; #endif /* PERL_USE_SAFE_PUTENV */ diff --git a/op.c b/op.c index 08dc657..edf300c 100644 --- a/op.c +++ b/op.c @@ -4624,7 +4624,7 @@ Perl_newXS(pTHX_ const char *name, XSUBADDR_t subaddr, const char *filename) } CvGV(cv) = gv; (void)gv_fetchfile(filename); - CvFILE(cv) = filename; /* NOTE: not copied, as it is expected to be + CvFILE(cv) = (char *)filename; /* NOTE: not copied, as it is expected to be an external constant string */ CvXSUB(cv) = subaddr; diff --git a/perl.c b/perl.c index 4a925b0..9d3ecf4 100644 --- a/perl.c +++ b/perl.c @@ -1412,8 +1412,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) while (SvCUR(PL_Sv) > opts+76) { /* find last space after "options: " and before col 76 */ - char *space, *pv = SvPV_nolen(PL_Sv); - char c = pv[opts+76]; + const char *space; + char *pv = SvPV_nolen(PL_Sv); + const char c = pv[opts+76]; pv[opts+76] = '\0'; space = strrchr(pv+opts+26, ' '); pv[opts+76] = c; @@ -1482,11 +1483,11 @@ print \" \\@INC:\\n @INC\\n\";"); } /* catch use of gnu style long options */ if (strEQ(s, "version")) { - s = "v"; + s = (char *)"v"; goto reswitch; } if (strEQ(s, "help")) { - s = "h"; + s = (char *)"h"; goto reswitch; } s--; @@ -1611,7 +1612,7 @@ print \" \\@INC:\\n @INC\\n\";"); if (PL_doextract) { #endif find_beginning(); - if (cddir && PerlDir_chdir(cddir) < 0) + if (cddir && PerlDir_chdir( (char *)cddir ) < 0) Perl_croak(aTHX_ "Can't chdir to %s",cddir); } @@ -1819,7 +1820,7 @@ perl_run(pTHXx) } -STATIC void * +STATIC void S_run_body(pTHX_ I32 oldscope) { DEBUG_r(PerlIO_printf(Perl_debug_log, "%s $` $& $' support.\n", @@ -1863,7 +1864,6 @@ S_run_body(pTHX_ I32 oldscope) my_exit(0); /* NOTREACHED */ - return NULL; } /* @@ -2191,7 +2191,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags) } STATIC void -S_call_body(pTHX_ const OP *myop, int is_eval) +S_call_body(pTHX_ const OP *myop, bool is_eval) { if (PL_op == myop) { if (is_eval) @@ -2531,7 +2531,7 @@ Perl_moreswitches(pTHX_ char *s) } case 'C': s++; - PL_unicode = parse_unicode_opts(&s); + PL_unicode = parse_unicode_opts( (const char **)&s ); return s; case 'F': PL_minus_F = TRUE; @@ -2588,7 +2588,7 @@ Perl_moreswitches(pTHX_ char *s) #ifdef DEBUGGING forbid_setid("-D"); s++; - PL_debug = get_debug_opts(&s, 1) | DEBUG_TOP_FLAG; + PL_debug = get_debug_opts( (const char **)&s, 1) | DEBUG_TOP_FLAG; #else /* !DEBUGGING */ if (ckWARN_d(WARN_DEBUGGING)) Perl_warner(aTHX_ packWARN(WARN_DEBUGGING), @@ -3016,7 +3016,7 @@ S_init_main_stash(pTHX) /* PSz 18 Nov 03 fdscript now global but do not change prototype */ STATIC void -S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv) +S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv) { #ifndef IAMSUID const char *quote; @@ -3033,7 +3033,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv) } else { /* if find_script() returns, it returns a malloc()-ed value */ - PL_origfilename = scriptname = find_script(scriptname, dosearch, NULL, 1); + scriptname = PL_origfilename = find_script(scriptname, dosearch, NULL, 1); if (strnEQ(scriptname, "/dev/fd/", 8) && isDIGIT(scriptname[8]) ) { const char *s = scriptname + 8; @@ -3063,7 +3063,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv) } scriptname = savepv(s + 1); Safefree(PL_origfilename); - PL_origfilename = scriptname; + PL_origfilename = (char *)scriptname; } } } @@ -3071,7 +3071,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv) CopFILE_free(PL_curcop); CopFILE_set(PL_curcop, PL_origfilename); if (*PL_origfilename == '-' && PL_origfilename[1] == '\0') - scriptname = ""; + scriptname = (char *)""; if (PL_fdscript >= 0) { PL_rsfp = PerlIO_fdopen(PL_fdscript,PERL_SCRIPT_MODE); # if defined(HAS_FCNTL) && defined(F_SETFD) @@ -3098,7 +3098,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv) } #else /* IAMSUID */ else if (PL_preprocess) { - char *cpp_cfg = CPPSTDIN; + const char *cpp_cfg = CPPSTDIN; SV *cpp = newSVpvn("",0); SV *cmd = NEWSV(0,0); @@ -3158,7 +3158,7 @@ S_open_script(pTHX_ char *scriptname, bool dosearch, SV *sv) "PL_preprocess: cmd=\"%s\"\n", SvPVX(cmd))); - PL_rsfp = PerlProc_popen(SvPVX(cmd), "r"); + PL_rsfp = PerlProc_popen(SvPVX(cmd), (char *)"r"); SvREFCNT_dec(cmd); SvREFCNT_dec(cpp); } @@ -3712,12 +3712,15 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n"); /* not set-id, must be wrapped */ } #endif /* DOSUID */ + (void)validarg; + (void)scriptname; } STATIC void S_find_beginning(pTHX) { - register char *s, *s2; + register char *s; + register const char *s2; #ifdef MACOS_TRADITIONAL int maclines = 0; #endif @@ -3842,6 +3845,7 @@ Perl_doing_taint(int argc, char *argv[], char *envp[]) && (argv[1][1] == 't' || argv[1][1] == 'T') ) return 1; return 0; + (void)envp; } STATIC void @@ -4298,10 +4302,11 @@ S_incpush_if_exists(pTHX_ SV *dir) } STATIC void -S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep, - int canrelocate) +S_incpush(pTHX_ const char *dir, bool addsubdirs, bool addoldvers, bool usesep, + bool canrelocate) { SV *subdir = Nullsv; + const char *p = dir; if (!p || !*p) return; @@ -4343,6 +4348,9 @@ S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep, sv_catpv(libdir, ":"); #endif + /* Do the if() outside the #ifdef to avoid warnings about an unused + parameter. */ + if (canrelocate) { #ifdef PERL_RELOCATABLE_INC /* * Relocatable include entries are marked with a leading .../ @@ -4360,7 +4368,6 @@ S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep, * The intent is that /usr/local/bin/perl and .../../lib/perl5 * generates /usr/local/lib/perl5 */ - { char *libpath = SvPVX(libdir); STRLEN libpath_len = SvCUR(libdir); if (libpath_len >= 4 && memEQ (libpath, ".../", 4)) { @@ -4437,8 +4444,8 @@ S_incpush(pTHX_ const char *p, int addsubdirs, int addoldvers, int usesep, } SvREFCNT_dec(prefix_sv); } - } #endif + } /* * BEFORE pushing libdir onto @INC we may first push version- and * archname-specific sub-directories. @@ -4596,7 +4603,7 @@ void Perl_call_list(pTHX_ I32 oldscope, AV *paramList) { SV *atsv; - line_t oldline = CopLINE(PL_curcop); + const line_t oldline = CopLINE(PL_curcop); CV *cv; STRLEN len; int ret; @@ -4763,6 +4770,9 @@ static I32 read_e_script(pTHX_ int idx, SV *buf_sv, int maxlen) { char *p, *nl; + (void)idx; + (void)maxlen; + p = SvPVX(PL_e_script); nl = strchr(p, '\n'); nl = (nl) ? nl+1 : SvEND(PL_e_script); diff --git a/pp_sys.c b/pp_sys.c index f96800a..a7fbc00 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -329,7 +329,7 @@ PP(pp_backtick) mode = "rb"; else if (PL_op->op_private & OPpOPEN_IN_CRLF) mode = "rt"; - fp = PerlProc_popen(tmps, mode); + fp = PerlProc_popen(tmps, (char *)mode); if (fp) { const char *type = NULL; if (PL_curcop->cop_io) { @@ -1968,7 +1968,7 @@ PP(pp_eof) if ((IoFLAGS(io) & IOf_START) && av_len(GvAVn(gv)) < 0) { IoLINES(io) = 0; IoFLAGS(io) &= ~IOf_START; - do_open(gv, "-", 1, FALSE, O_RDONLY, 0, Nullfp); + do_open(gv, (char *)"-", 1, FALSE, O_RDONLY, 0, Nullfp); sv_setpvn(GvSV(gv), "-", 1); SvSETMAGIC(GvSV(gv)); } diff --git a/proto.h b/proto.h index 6a7564f..a25b59c 100644 --- a/proto.h +++ b/proto.h @@ -987,7 +987,7 @@ PERL_CALLCONV void Perl_Slab_Free(pTHX_ void *op); #if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT) STATIC void S_find_beginning(pTHX); STATIC void S_forbid_setid(pTHX_ const char * s); -STATIC void S_incpush(pTHX_ const char *, int, int, int, int); +STATIC void S_incpush(pTHX_ const char *dir, bool addsubdirs, bool addoldvers, bool usesep, bool canrelocate); STATIC void S_init_interp(pTHX); STATIC void S_init_ids(pTHX); STATIC void S_init_lexer(pTHX); @@ -997,15 +997,15 @@ STATIC void S_init_postdump_symbols(pTHX_ int, char **, char **); STATIC void S_init_predump_symbols(pTHX); STATIC void S_my_exit_jump(pTHX) __attribute__((noreturn)); STATIC void S_nuke_stacks(pTHX); -STATIC void S_open_script(pTHX_ char *, bool, SV *); -STATIC void S_usage(pTHX_ const char *); +STATIC void S_open_script(pTHX_ const char *scriptname, bool dosearch, SV *sv); +STATIC void S_usage(pTHX_ const char *name); STATIC void S_validate_suid(pTHX_ const char *validarg, const char *scriptname); # if defined(IAMSUID) STATIC int S_fd_on_nosuid_fs(pTHX_ int fd); # endif STATIC void* S_parse_body(pTHX_ char **env, XSINIT_t xsinit); -STATIC void* S_run_body(pTHX_ I32 oldscope); -STATIC void S_call_body(pTHX_ const OP *myop, int is_eval); +STATIC void S_run_body(pTHX_ I32 oldscope) __attribute__((noreturn)); +STATIC void S_call_body(pTHX_ const OP *myop, bool is_eval); STATIC void* S_call_list_body(pTHX_ CV *cv); #endif diff --git a/regcomp.c b/regcomp.c index 4a25d0c..834488a 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2791,7 +2791,7 @@ Perl_reginitcolors(pTHX) PL_colors[i] = ++s; } else - PL_colors[i] = s = ""; + PL_colors[i] = s = (char *)""; } } else { while (i < 6) diff --git a/thrdvar.h b/thrdvar.h index 726dbee..00786f7 100644 --- a/thrdvar.h +++ b/thrdvar.h @@ -108,7 +108,7 @@ PERLVAR(Trs, SV *) /* input record separator $/ */ PERLVAR(Tlast_in_gv, GV *) /* GV used in last */ PERLVAR(Tofs_sv, SV *) /* output field separator $, */ PERLVAR(Tdefoutgv, GV *) /* default FH for output */ -PERLVARI(Tchopset, char *, " \n-") /* $: */ +PERLVARI(Tchopset, const char *, " \n-") /* $: */ PERLVAR(Tformtarget, SV *) PERLVAR(Tbodytarget, SV *) PERLVAR(Ttoptarget, SV *) diff --git a/toke.c b/toke.c index 7bbe2bd..1189b29 100644 --- a/toke.c +++ b/toke.c @@ -2603,14 +2603,14 @@ Perl_yylex(pTHX) /* The count here deliberately includes the NUL that terminates the C string constant. This embeds the opening NUL into the string. */ + const char *splits = PL_splitstr; sv_catpvn(PL_linestr, "our @F=split(q", 15); - s = PL_splitstr; do { /* Need to \ \s */ - if (*s == '\\') - sv_catpvn(PL_linestr, s, 1); - sv_catpvn(PL_linestr, s, 1); - } while (*s++); + if (*splits == '\\') + sv_catpvn(PL_linestr, splits, 1); + sv_catpvn(PL_linestr, splits, 1); + } while (*splits++); /* This loop will embed the trailing NUL of PL_linestr as the last thing it does before terminating. */