From: Jarkko Hietaniemi Date: Thu, 21 Sep 2006 09:08:47 +0000 (+0300) Subject: deal with some gcc warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b57a0404d6b6347be89474e64fcdac6ac6ea98db;p=p5sagit%2Fp5-mst-13.2.git deal with some gcc warnings Message-ID: <45122C6F.9080904@iki.fi> p4raw-id: //depot/perl@28877 --- diff --git a/doio.c b/doio.c index e6909cb..ef16b07 100644 --- a/doio.c +++ b/doio.c @@ -1333,6 +1333,8 @@ Perl_my_stat(pTHX) Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat"); return PL_laststatval; } + /* Should we warn/croak here? Or do something smart/useful? */ + return (PL_laststatval = -1); } diff --git a/reentr.c b/reentr.c index 9be6f7f..bd46652 100644 --- a/reentr.c +++ b/reentr.c @@ -44,7 +44,7 @@ Perl_reentrant_size(pTHX) { #ifdef HAS_GETGRNAM_R # if defined(HAS_SYSCONF) && defined(_SC_GETGR_R_SIZE_MAX) && !defined(__GLIBC__) PL_reentrant_buffer->_grent_size = sysconf(_SC_GETGR_R_SIZE_MAX); - if (PL_reentrant_buffer->_grent_size == -1) + if ((IV)PL_reentrant_buffer->_grent_size == (IV)-1) PL_reentrant_buffer->_grent_size = REENTRANTUSUALSIZE; # else # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ) @@ -79,7 +79,7 @@ Perl_reentrant_size(pTHX) { #ifdef HAS_GETPWNAM_R # if defined(HAS_SYSCONF) && defined(_SC_GETPW_R_SIZE_MAX) && !defined(__GLIBC__) PL_reentrant_buffer->_pwent_size = sysconf(_SC_GETPW_R_SIZE_MAX); - if (PL_reentrant_buffer->_pwent_size == -1) + if ((IV)PL_reentrant_buffer->_pwent_size == (IV)-1) PL_reentrant_buffer->_pwent_size = REENTRANTUSUALSIZE; # else # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ) @@ -101,7 +101,7 @@ Perl_reentrant_size(pTHX) { #ifdef HAS_GETSPNAM_R # if defined(HAS_SYSCONF) && defined(_SC_GETPW_R_SIZE_MAX) && !defined(__GLIBC__) PL_reentrant_buffer->_spent_size = sysconf(_SC_GETPW_R_SIZE_MAX); - if (PL_reentrant_buffer->_spent_size == -1) + if ((IV)PL_reentrant_buffer->_spent_size == (IV)-1) PL_reentrant_buffer->_spent_size = REENTRANTUSUALSIZE; # else # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ) diff --git a/reentr.pl b/reentr.pl index 13cf4d1..094a83c 100644 --- a/reentr.pl +++ b/reentr.pl @@ -547,7 +547,7 @@ EOF push @size, <$sz = sysconf($sc); - if (PL_reentrant_buffer->$sz == -1) + if ((IV)PL_reentrant_buffer->$sz == (IV)-1) PL_reentrant_buffer->$sz = REENTRANTUSUALSIZE; # else # if defined(__osf__) && defined(__alpha) && defined(SIABUFSIZ) diff --git a/regcomp.c b/regcomp.c index 871043e..4684646 100644 --- a/regcomp.c +++ b/regcomp.c @@ -1756,8 +1756,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *firs #ifdef DEBUGGING - U32 mjd_offset; - U32 mjd_nodelen; + U32 mjd_offset = 0; + U32 mjd_nodelen = 0; #endif /* This means we convert either the first branch or the first Exact, diff --git a/regexec.c b/regexec.c index 679e31f..6aa059a 100644 --- a/regexec.c +++ b/regexec.c @@ -474,7 +474,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, #ifdef DEBUGGING /* 7/99: reports of failure (with the older version) */ if (end_shift < 0) Perl_croak(aTHX_ "panic: end_shift: %"IVdf" pattern:\n%s\n ", - end_shift,prog->precomp); + (IV)end_shift, prog->precomp); #endif restart: @@ -868,7 +868,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, endpos= strend; DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "start_shift: %"IVdf" check_at: %d s: %d endpos: %d\n", - start_shift,check_at-strbeg,s-strbeg,endpos-strbeg)); + (IV)start_shift, check_at - strbeg, s - strbeg, endpos - strbeg)); t = s; s = find_byclass(prog, prog->regstclass, s, endpos, NULL); diff --git a/sv.c b/sv.c index 6e395ef..1112f21 100644 --- a/sv.c +++ b/sv.c @@ -1851,6 +1851,7 @@ STATIC int S_sv_2iuv_non_preserve(pTHX_ register SV *sv, I32 numtype) { dVAR; + PERL_UNUSED_ARG(numtype); /* Used only under DEBUGGING? */ DEBUG_c(PerlIO_printf(Perl_debug_log,"sv_2iuv_non '%s', IV=0x%"UVxf" NV=%"NVgf" inttype=%"UVXf"\n", SvPVX_const(sv), SvIVX(sv), SvNVX(sv), (UV)numtype)); if (SvNVX(sv) < (NV)IV_MIN) { (void)SvIOKp_on(sv); diff --git a/toke.c b/toke.c index f5aa5d1..1cce947 100644 --- a/toke.c +++ b/toke.c @@ -2193,8 +2193,8 @@ S_scan_const(pTHX_ char *start) s += 3; len = e - s; uv = grok_hex(s, &len, &flags, NULL); - if ( len != e - s ) { - uv=0xFFFD; + if ( e > s && len != (STRLEN)(e - s) ) { + uv = 0xFFFD; } s = e + 1; goto NUM_ESCAPE_INSERT; diff --git a/util.c b/util.c index 7e26322..d9fde3e 100644 --- a/util.c +++ b/util.c @@ -5475,7 +5475,7 @@ Perl_my_clearenv(pTHX) char *buf = (char*)safesysmalloc(bufsiz); while (*environ != NULL) { char *e = strchr(*environ, '='); - int l = e ? e - *environ : strlen(*environ); + int l = e ? e - *environ : (int)strlen(*environ); if (bsiz < l + 1) { (void)safesysfree(buf); bsiz = l + 1; /* + 1 for the \0. */