develooper Front page | perl.perl5.porters | Postings from February 2007

[PATCH #30145] - fix up some warnings (was Re: Future Perldevelopment)

From:
Jonathan Stowe
Date:
February 7, 2007 07:19
Subject:
[PATCH #30145] - fix up some warnings (was Re: Future Perldevelopment)
Message ID:
1170861540.13207.22.camel@coriolanus.gellyfish.com
On Wed, 2007-02-07 at 10:11 +0000, hv@crypt.org wrote:
> Nicholas Clark <nick@ccl4.org> wrote:
> :would you all be so kind as to download this snapshot [...]
> 
> All tests successful.
> u=4.72  s=1.25  cu=259.65  cs=26.95  scripts=959  tests=122092
> make[2]: Leaving directory `/src/package/lang/perl/perl-30145'
> make[1]: Leaving directory `/src/package/lang/perl/perl-30145'
> 
> I haven't built maint for a while, and I notice a number of compile-time
> warnings I don't recognise. (This may also be due to upgrading to gcc 4.1.x.)

This fixes some of the ones I'm seeing. There are still some which I'm
finding tricky to fix, this gcc doesn't appear to like the

  if (PL_numeric_radix_sv && IN_LOCALE) {

in numeric.c but all the fixes I've tried break locale tests.

diff -ru perl-30145/doio.c perl-30145.new/doio.c
--- perl-30145/doio.c   2007-01-29 15:55:42.000000000 +0000
+++ perl-30145.new/doio.c       2007-02-07 13:13:02.000000000 +0000
@@ -2251,7 +2251,7 @@
        STRLEN len;
  
        const char *mbuf = SvPV_const(mstr, len);
-       const I32 n = (len > msize) ? msize : len;
+       const I32 n = ((I32)len > msize) ? msize : (I32)len;
        Copy(mbuf, shm + mpos, n, char);
        if (n < msize)
            memzero(shm + mpos + n, msize - n);
diff -ru perl-30145/mg.c perl-30145.new/mg.c
--- perl-30145/mg.c     2007-02-05 22:26:27.000000000 +0000
+++ perl-30145.new/mg.c 2007-02-07 13:59:33.000000000 +0000
@@ -503,8 +503,8 @@
                I32 paren = rx->lastparen;
  
                /* return the last filled */
-               while ( paren >= 0 &&
-                   rx->startp[paren] == -1 || rx->endp[paren] == -1)
+               while ( (paren >= 0 &&
+                   rx->startp[paren] == -1) || rx->endp[paren] == -1)
                paren--;
                return (U32)paren;
            }
@@ -1127,7 +1127,7 @@
                const char path_sep = ':';
 #endif
                s = delimcpy(tmpbuf, tmpbuf + sizeof tmpbuf,
-                            (char *) s, (char *) strend, ':', &i);
+                            (char *) s, (char *) strend, path_sep, &i);
                s++;
                if (i >= (I32)sizeof tmpbuf   /* too long -- assume the worst */                      || *tmpbuf != '/'
diff -ru perl-30145/pad.c perl-30145.new/pad.c
--- perl-30145/pad.c    2007-02-03 15:23:56.000000000 +0000
+++ perl-30145.new/pad.c        2007-02-07 12:55:09.000000000 +0000
@@ -358,7 +358,7 @@
     }
     if (ourstash) {
        SvPAD_OUR_on(namesv);
-       (HV*)SvREFCNT_inc_simple_NN((SV*) ourstash);
+       SvREFCNT_inc_simple_void_NN((SV*) ourstash);
        SvOURSTASH_set(namesv, ourstash);
     }
  
diff -ru perl-30145/regexec.c perl-30145.new/regexec.c
--- perl-30145/regexec.c        2007-02-03 18:24:31.000000000 +0000
+++ perl-30145.new/regexec.c    2007-02-07 13:14:57.000000000 +0000
@@ -261,7 +261,7 @@
      * building DynaLoader will fail:
      * "Error: '*' not in typemap in DynaLoader.xs, line 164"
      * --jhi */
-    for (i = *PL_reglastparen + 1; (U32)i <= PL_regnpar; i++) {
+    for (i = *PL_reglastparen + 1; (U32)i <= (U32)PL_regnpar; i++) {
        if (i > PL_regsize)
            PL_regstartp[i] = -1;
        PL_regendp[i] = -1;
diff -ru perl-30145/sv.c perl-30145.new/sv.c
--- perl-30145/sv.c     2007-02-04 21:51:25.000000000 +0000
+++ perl-30145.new/sv.c 2007-02-07 13:07:49.000000000 +0000
@@ -3748,7 +3748,7 @@
            SvGROW(sv, len + 1);
            Move(pvx,SvPVX(sv),len,char);
            *SvEND(sv) = '\0';
-           unsharepvn(pvx, SvUTF8(sv) ? -(I32)len : len, hash);
+           unsharepvn(pvx, SvUTF8(sv) ? -(I32)len : (I32)len, hash);
        }
        else if (IN_PERL_RUNTIME)
            Perl_croak(aTHX_ PL_no_modify);
@@ -4665,7 +4665,7 @@
            Safefree(SvPVX_mutable(sv));
        else if (SvPVX_const(sv) && SvREADONLY(sv) && SvFAKE(sv)) {
            unsharepvn(SvPVX_const(sv),
-                      SvUTF8(sv) ? -(I32)SvCUR(sv) : SvCUR(sv),
+                      SvUTF8(sv) ? -(I32)SvCUR(sv) : (I32)SvCUR(sv),
                       SvUVX(sv));
            SvFAKE_off(sv);
        }




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About