From: Jarkko Hietaniemi Date: Wed, 30 May 2001 23:12:30 +0000 (+0000) Subject: More -Wall silencing from Michael Schwern and Jarkko Hietaniemi. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7953727b0415d171133ea7caa7aca5672129f99;p=p5sagit%2Fp5-mst-13.2.git More -Wall silencing from Michael Schwern and Jarkko Hietaniemi. p4raw-id: //depot/perl@10335 --- diff --git a/doop.c b/doop.c index 9dff1b7..8c61398 100644 --- a/doop.c +++ b/doop.c @@ -141,7 +141,7 @@ S_do_trans_complex(pTHX_ SV *sv)/* SPC - NOT OK */ I32 grows = PL_op->op_private & OPpTRANS_GROWS; I32 complement = PL_op->op_private & OPpTRANS_COMPLEMENT; I32 del = PL_op->op_private & OPpTRANS_DELETE; - STRLEN len, rlen; + STRLEN len, rlen = 0; short *tbl; I32 ch; @@ -308,7 +308,7 @@ S_do_trans_simple_utf8(pTHX_ SV *sv)/* SPC - OK */ SV** svp = hv_fetch(hv, "NONE", 4, FALSE); UV none = svp ? SvUV(*svp) : 0x7fffffff; UV extra = none + 1; - UV final; + UV final = 0; UV uv; I32 isutf8; U8 hibit = 0; @@ -397,7 +397,7 @@ STATIC I32 S_do_trans_count_utf8(pTHX_ SV *sv)/* SPC - OK */ { U8 *s; - U8 *start, *send; + U8 *start = 0, *send; I32 matches = 0; STRLEN len; @@ -448,7 +448,7 @@ S_do_trans_complex_utf8(pTHX_ SV *sv) /* SPC - NOT OK */ SV** svp = hv_fetch(hv, "NONE", 4, FALSE); UV none = svp ? SvUV(*svp) : 0x7fffffff; UV extra = none + 1; - UV final; + UV final = 0; bool havefinal = FALSE; UV uv; STRLEN len; @@ -1084,7 +1084,7 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right) char *rsave; bool left_utf = DO_UTF8(left); bool right_utf = DO_UTF8(right); - I32 needlen; + I32 needlen = 0; if (left_utf && !right_utf) sv_utf8_upgrade(right); diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h index c6acd28..9ad3237 100644 --- a/ext/ByteLoader/bytecode.h +++ b/ext/ByteLoader/bytecode.h @@ -74,7 +74,6 @@ typedef IV IV64; #define BGET_op_tr_array(arg) do { \ unsigned short *ary; \ - int i; \ New(666, ary, 256, unsigned short); \ BGET_FREAD(ary, sizeof(unsigned short), 256); \ arg = (char *) ary; \ diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs index 74cbd1b..f84f550 100644 --- a/ext/DB_File/DB_File.xs +++ b/ext/DB_File/DB_File.xs @@ -1768,7 +1768,6 @@ unshift(db, ...) DBT value ; int i ; int One ; - DB * Db = db->dbp ; STRLEN n_a; DBT_clear(key) ; @@ -1791,7 +1790,7 @@ unshift(db, ...) #ifdef DB_VERSION_MAJOR RETVAL = (db->cursor->c_put)(db->cursor, &key, &value, DB_BEFORE) ; #else - RETVAL = (Db->put)(Db, &key, &value, R_IBEFORE) ; + RETVAL = (db->dbp->put)(db->dbp, &key, &value, R_IBEFORE) ; #endif if (RETVAL != 0) break; diff --git a/mg.c b/mg.c index 59233f7..4b6d25d 100644 --- a/mg.c +++ b/mg.c @@ -20,6 +20,9 @@ # ifndef NGROUPS # define NGROUPS 32 # endif +# ifdef I_GRP +# include +# endif #endif static void restore_magic(pTHXo_ void *p); @@ -627,7 +630,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) getrx: if (i >= 0) { - bool was_tainted; + bool was_tainted = FALSE; if (PL_tainting) { was_tainted = PL_tainted; PL_tainted = FALSE; @@ -1038,7 +1041,7 @@ Perl_magic_setsig(pTHX_ SV *sv, MAGIC *mg) { register char *s; I32 i; - SV** svp; + SV** svp = 0; STRLEN len; s = MgPV(mg,len); @@ -2195,7 +2198,7 @@ Perl_sighandler(int sig) dSP; GV *gv = Nullgv; HV *st; - SV *sv, *tSv = PL_Sv; + SV *sv = Nullsv, *tSv = PL_Sv; CV *cv = Nullcv; OP *myop = PL_op; U32 flags = 0; diff --git a/perl.c b/perl.c index 63c2744..d3c8a95 100644 --- a/perl.c +++ b/perl.c @@ -1681,7 +1681,7 @@ Perl_call_sv(pTHX_ SV *sv, I32 flags) LOGOP myop; /* fake syntax tree node */ UNOP method_op; I32 oldmark; - I32 retval; + I32 retval = 0; I32 oldscope; bool oldcatch = CATCH_GET; int ret; @@ -1869,7 +1869,7 @@ Perl_eval_sv(pTHX_ SV *sv, I32 flags) dSP; UNOP myop; /* fake syntax tree node */ I32 oldmark = SP - PL_stack_base; - I32 retval; + I32 retval = 0; I32 oldscope; int ret; OP* oldop = PL_op; diff --git a/perlio.c b/perlio.c index b64524a..0b3f1a1 100644 --- a/perlio.c +++ b/perlio.c @@ -408,7 +408,6 @@ perlio_mg_set(pTHX_ SV *sv, MAGIC *mg) IO *io = GvIOn((GV *)SvRV(sv)); PerlIO *ifp = IoIFP(io); PerlIO *ofp = IoOFP(io); - AV *av = (AV *) mg->mg_obj; Perl_warn(aTHX_ "set %"SVf" %p %p %p",sv,io,ifp,ofp); } return 0; @@ -422,7 +421,6 @@ perlio_mg_get(pTHX_ SV *sv, MAGIC *mg) IO *io = GvIOn((GV *)SvRV(sv)); PerlIO *ifp = IoIFP(io); PerlIO *ofp = IoOFP(io); - AV *av = (AV *) mg->mg_obj; Perl_warn(aTHX_ "get %"SVf" %p %p %p",sv,io,ifp,ofp); } return 0; @@ -739,7 +737,6 @@ PerlIORaw_pushed(PerlIO *f, const char *mode, SV *arg) /* Pop back to bottom layer */ if (f && *f) { - int code = 0; PerlIO_flush(f); while (!(PerlIOBase(f)->tab->kind & PERLIO_K_RAW)) { @@ -814,7 +811,7 @@ PerlIO_binmode(pTHX_ PerlIO *f, int iotype, int mode, const char *names) { PerlIO *top = f; PerlIOl *l; - while (l = *top) + while ((l = *top)) { if (PerlIOBase(top)->tab == &PerlIO_crlf) { @@ -1016,7 +1013,7 @@ PerlIO_openn(pTHX_ const char *layers, const char *mode, int fd, int imode, int { AV *layera; IV n; - PerlIO_funcs *tab; + PerlIO_funcs *tab = NULL; if (f && *f) { /* This is "reopen" - it is not tested as perl does not use it yet */ @@ -1563,8 +1560,10 @@ IV PerlIOBase_pushed(PerlIO *f, const char *mode, SV *arg) { PerlIOl *l = PerlIOBase(f); +#if 0 const char *omode = mode; char temp[8]; +#endif PerlIO_funcs *tab = PerlIOBase(f)->tab; l->flags &= ~(PERLIO_F_CANREAD|PERLIO_F_CANWRITE| PERLIO_F_TRUNCATE|PERLIO_F_APPEND); @@ -1933,7 +1932,6 @@ Off_t PerlIOUnix_tell(PerlIO *f) { dTHX; - Off_t posn = PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,0,SEEK_CUR); return PerlLIO_lseek(PerlIOSelf(f,PerlIOUnix)->fd,0,SEEK_CUR); } @@ -2491,7 +2489,7 @@ PerlIOBuf_open(pTHX_ PerlIO_funcs *self, AV *layers, IV n, const char *mode, int f = (*tab->Open)(aTHX_ tab, layers, n-2, mode,fd,imode,perm,NULL,narg,args); if (f) { - PerlIOBuf *b = PerlIOSelf(PerlIO_push(aTHX_ f,self,mode,PerlIOArg),PerlIOBuf); + PerlIO_push(aTHX_ f,self,mode,PerlIOArg); fd = PerlIO_fileno(f); #if O_BINARY != O_TEXT /* do something about failing setmode()? --jhi */ @@ -3312,7 +3310,6 @@ PerlIOMmap_map(PerlIO *f) { dTHX; PerlIOMmap *m = PerlIOSelf(f,PerlIOMmap); - PerlIOBuf *b = &m->base; IV flags = PerlIOBase(f)->flags; IV code = 0; if (m->len) diff --git a/regexec.c b/regexec.c index 699ba4c..b8659f2 100644 --- a/regexec.c +++ b/regexec.c @@ -360,17 +360,16 @@ char * Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, char *strend, U32 flags, re_scream_pos_data *data) { - register I32 start_shift; + register I32 start_shift = 0; /* Should be nonnegative! */ - register I32 end_shift; + register I32 end_shift = 0; register char *s; register SV *check; char *strbeg; char *t; I32 ml_anch; - char *tmp; register char *other_last = Nullch; /* other substr checked before this */ - char *check_at; /* check substr found at this pos */ + char *check_at = Nullch; /* check substr found at this pos */ #ifdef DEBUGGING char *i_strpos = strpos; #endif @@ -778,7 +777,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, s = find_byclass(prog, prog->regstclass, s, endpos, startpos, 1); if (!s) { #ifdef DEBUGGING - char *what; + char *what = 0; #endif if (endpos == strend) { DEBUG_r( PerlIO_printf(Perl_debug_log, @@ -839,13 +838,17 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, DEBUG_r( what = "floating" ); goto hop_and_restart; } - DEBUG_r( if (t != s) - PerlIO_printf(Perl_debug_log, + if (t != s) { + DEBUG_r(PerlIO_printf(Perl_debug_log, "By STCLASS: moving %ld --> %ld\n", - (long)(t - i_strpos), (long)(s - i_strpos)); - else - PerlIO_printf(Perl_debug_log, - "Does not contradict STCLASS...\n") ); + (long)(t - i_strpos), (long)(s - i_strpos)) + ); + } + else { + DEBUG_r(PerlIO_printf(Perl_debug_log, + "Does not contradict STCLASS...\n"); + ); + } } giveup: DEBUG_r(PerlIO_printf(Perl_debug_log, "%s%s:%s match at offset %ld\n", @@ -1596,9 +1599,10 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * s++; } } - DEBUG_r(did_match || + DEBUG_r(if (!did_match) PerlIO_printf(Perl_debug_log, - "Did not find anchored character...\n")); + "Did not find anchored character...\n") + ); } /*SUPPRESS 560*/ else if (do_utf8 == (UTF!=0) && @@ -1662,14 +1666,16 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * } } } - DEBUG_r(did_match || - PerlIO_printf(Perl_debug_log, "Did not find %s substr `%s%.*s%s'%s...\n", + DEBUG_r(if (!did_match) + PerlIO_printf(Perl_debug_log, + "Did not find %s substr `%s%.*s%s'%s...\n", ((must == prog->anchored_substr) ? "anchored" : "floating"), PL_colors[0], (int)(SvCUR(must) - (SvTAIL(must)!=0)), SvPVX(must), - PL_colors[1], (SvTAIL(must) ? "$" : ""))); + PL_colors[1], (SvTAIL(must) ? "$" : "")) + ); goto phooey; } else if ((c = prog->regstclass)) { @@ -1960,13 +1966,15 @@ S_regmatch(pTHX_ regnode *prog) register I32 nextchr; /* renamed nextchr - nextchar colides with function of same name */ register I32 n; /* no or next */ - register I32 ln; /* len or last */ - register char *s; /* operand or save */ + register I32 ln = 0; /* len or last */ + register char *s = Nullch; /* operand or save */ register char *locinput = PL_reginput; - register I32 c1, c2, paren; /* case fold search, parenth */ + register I32 c1 = 0, c2 = 0, paren; /* case fold search, parenth */ int minmod = 0, sw = 0, logical = 0; I32 unwind = 0; +#if 0 I32 firstcp = PL_savestack_ix; +#endif register bool do_utf8 = DO_UTF8(PL_reg_sv); #ifdef DEBUGGING @@ -2935,7 +2943,6 @@ S_regmatch(pTHX_ regnode *prog) inner = NEXTOPER(scan); do_branch: { - CHECKPOINT lastcp; c1 = OP(scan); if (OP(next) != c1) /* No choice. */ next = inner; /* Avoid recursion. */ @@ -3774,7 +3781,7 @@ S_regrepeat(pTHX_ regnode *p, I32 max) STATIC I32 S_regrepeat_hard(pTHX_ regnode *p, I32 max, I32 *lp) { - register char *scan; + register char *scan = Nullch; register char *start; register char *loceol = PL_regeol; I32 l = 0; diff --git a/universal.c b/universal.c index 3e14a68..ca69243 100644 --- a/universal.c +++ b/universal.c @@ -405,6 +405,10 @@ XS(XS_utf8_native_to_unicode) { dXSARGS; UV uv = SvUV(ST(0)); + + if (items > 1) + Perl_croak(aTHX_ "Usage: utf8::native_to_unicode(sv)"); + ST(0) = sv_2mortal(newSViv(NATIVE_TO_UNI(uv))); XSRETURN(1); } @@ -413,6 +417,10 @@ XS(XS_utf8_unicode_to_native) { dXSARGS; UV uv = SvUV(ST(0)); + + if (items > 1) + Perl_croak(aTHX_ "Usage: utf8::unicode_to_native(sv)"); + ST(0) = sv_2mortal(newSViv(UNI_TO_NATIVE(uv))); XSRETURN(1); } diff --git a/util.c b/util.c index d33af51..de0c052 100644 --- a/util.c +++ b/util.c @@ -2345,8 +2345,6 @@ Perl_my_popen_list(pTHX_ char *mode, int n, SV **args) } if (pid == 0) { /* Child */ - GV* tmpgv; - int fd; #undef THIS #undef THAT #define THIS that @@ -2368,10 +2366,10 @@ Perl_my_popen_list(pTHX_ char *mode, int n, SV **args) } #if !defined(HAS_FCNTL) || !defined(F_SETFD) /* No automatic close - do it by hand */ -#ifndef NOFILE -#define NOFILE 20 -#endif - for (fd = PL_maxsysfd + 1; fd < NOFILE; fd++) { +# ifndef NOFILE +# define NOFILE 20 +# endif + for (int fd = PL_maxsysfd + 1; fd < NOFILE; fd++) { if (fd != pp[1]) PerlLIO_close(fd); } @@ -2750,7 +2748,7 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) Pid_t pid; Pid_t pid2; bool close_failed; - int saved_errno; + int saved_errno = 0; #ifdef VMS int saved_vaxc_errno; #endif @@ -2806,13 +2804,14 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) I32 Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags) { + if (!pid) + return -1; +#if !defined(HAS_WAITPID) && !defined(HAS_WAIT4) || defined(HAS_WAITPID_RUNTIME) + { SV *sv; SV** svp; char spid[TYPE_CHARS(int)]; - if (!pid) - return -1; -#if !defined(HAS_WAITPID) && !defined(HAS_WAIT4) || defined(HAS_WAITPID_RUNTIME) if (pid > 0) { sprintf(spid, "%"IVdf, (IV)pid); svp = hv_fetch(PL_pidstatus,spid,strlen(spid),FALSE); @@ -2834,6 +2833,7 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags) (void)hv_delete(PL_pidstatus,spid,strlen(spid),G_DISCARD); return pid; } + } } #endif #ifdef HAS_WAITPID diff --git a/x2p/a2py.c b/x2p/a2py.c index 3976c86..5642b36 100644 --- a/x2p/a2py.c +++ b/x2p/a2py.c @@ -61,7 +61,6 @@ main(register int argc, register char **argv, register char **env) for (argc--,argv++; argc; argc--,argv++) { if (argv[0][0] != '-' || !argv[0][1]) break; - reswitch: switch (argv[0][1]) { #ifdef DEBUGGING case 'D': @@ -212,11 +211,12 @@ yylex(void) retry: #if YYDEBUG - if (yydebug) + if (yydebug) { if (strchr(s,'\n')) fprintf(stderr,"Tokener at %s",s); else fprintf(stderr,"Tokener at %s\n",s); + } #endif switch (*s) { default: @@ -1226,7 +1226,7 @@ fixfargs(int name, int arg, int prevargs) { int type; STR *str; - int numargs; + int numargs = 0; if (!arg) return prevargs; diff --git a/x2p/str.c b/x2p/str.c index 310bcd6..0587205 100644 --- a/x2p/str.c +++ b/x2p/str.c @@ -221,7 +221,7 @@ str_replace(register STR *str, register STR *nstr) str->str_len = nstr->str_len; str->str_cur = nstr->str_cur; str->str_pok = nstr->str_pok; - if (str->str_nok = nstr->str_nok) + if ((str->str_nok = nstr->str_nok)) str->str_nval = nstr->str_nval; safefree((char*)nstr); } diff --git a/x2p/walk.c b/x2p/walk.c index 59ac8a9..10546db 100644 --- a/x2p/walk.c +++ b/x2p/walk.c @@ -52,7 +52,7 @@ walk(int useval, int level, register int node, int *numericptr, int minprec) STR *tmp2str; STR *tmp3str; char *t; - char *d, *s; + char *d, *s = 0; int numarg; int numeric = FALSE; STR *fstr; @@ -750,7 +750,7 @@ sub Pick {\n\ subretnum |= numarg; s = Nullch; t = tmp2str->str_ptr; - while (t = instr(t,"return ")) + while ((t = instr(t,"return "))) s = t++; if (s) { i = 0; @@ -1463,7 +1463,7 @@ sub Pick {\n\ if (!s) fatal("Illegal for loop: %s",d); *s++ = '\0'; - for (t = s; i = *t; t++) { + for (t = s; (i = *t); t++) { i &= 127; if (i == '}' || i == ']') break; diff --git a/xsutils.c b/xsutils.c index 3493565..d15de65 100644 --- a/xsutils.c +++ b/xsutils.c @@ -127,6 +127,9 @@ XS(XS_attributes_bootstrap) dXSARGS; char *file = __FILE__; + if( items > 0 ) + Perl_croak(aTHX_ "Usage: bootstrap"); + newXSproto("attributes::_warn_reserved", XS_attributes__warn_reserved, file, ""); newXS("attributes::_modify_attrs", XS_attributes__modify_attrs, file); newXSproto("attributes::_guess_stash", XS_attributes__guess_stash, file, "$");