deal with some gcc warnings
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 21 Sep 2006 09:08:47 +0000 (12:08 +0300)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 21 Sep 2006 07:54:10 +0000 (07:54 +0000)
Message-ID: <45122C6F.9080904@iki.fi>

p4raw-id: //depot/perl@28877

doio.c
reentr.c
reentr.pl
regcomp.c
regexec.c
sv.c
toke.c
util.c

diff --git a/doio.c b/doio.c
index e6909cb..ef16b07 100644 (file)
--- 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);
 }
 
 
index 9be6f7f..bd46652 100644 (file)
--- 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)
index 13cf4d1..094a83c 100644 (file)
--- a/reentr.pl
+++ b/reentr.pl
@@ -547,7 +547,7 @@ EOF
            push @size, <<EOF;
 #   if defined(HAS_SYSCONF) && defined($sc) && !defined(__GLIBC__)
        PL_reentrant_buffer->$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)
index 871043e..4684646 100644 (file)
--- 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,
index 679e31f..6aa059a 100644 (file)
--- 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 (file)
--- 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 (file)
--- 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 (file)
--- 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. */