silence some compiler warnings
Dave Mitchell [Tue, 3 Jan 2006 12:29:38 +0000 (12:29 +0000)]
p4raw-id: //depot/perl@26598

cop.h
toke.c

diff --git a/cop.h b/cop.h
index 2444a75..ed57184 100644 (file)
--- a/cop.h
+++ b/cop.h
@@ -167,6 +167,8 @@ struct cop {
                                 ? GvSV(gv_fetchfile(CopFILE(c))) : Nullsv)
 #  define CopFILEAV(c)         (CopFILE(c) \
                                 ? GvAV(gv_fetchfile(CopFILE(c))) : NULL)
+#  define CopFILEAVx(c)                (assert(CopFILE(c)), \
+                                  GvAV(gv_fetchfile(CopFILE(c))))
 #  define CopSTASHPV(c)                ((c)->cop_stashpv)
 
 #  ifdef NETWARE
@@ -192,6 +194,7 @@ struct cop {
 #  define CopFILE_set(c,pv)    CopFILEGV_set((c), gv_fetchfile(pv))
 #  define CopFILESV(c)         (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : Nullsv)
 #  define CopFILEAV(c)         (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : NULL)
+#  define CopFILEAVx(c)                (assert(CopFILEGV(c)), GvAV(CopFILEGV(c)))
 #  define CopFILE(c)           (CopFILESV(c) ? SvPVX(CopFILESV(c)) : Nullch)
 #  define CopSTASH(c)          ((c)->cop_stash)
 #  define CopSTASH_set(c,hv)   ((c)->cop_stash = (hv))
diff --git a/toke.c b/toke.c
index 6e22b33..6a454ca 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -841,7 +841,7 @@ S_skipspace(pTHX_ register char *s)
            sv_setpvn(sv,PL_bufptr,PL_bufend-PL_bufptr);
             (void)SvIOK_on(sv);
             SvIV_set(sv, 0);
-           av_store(CopFILEAV(PL_curcop),(I32)CopLINE(PL_curcop),sv);
+           av_store(CopFILEAVx(PL_curcop),(I32)CopLINE(PL_curcop),sv);
        }
     }
 }
@@ -2730,7 +2730,7 @@ Perl_yylex(pTHX)
                sv_setsv(sv,PL_linestr);
                 (void)SvIOK_on(sv);
                 SvIV_set(sv, 0);
-               av_store(CopFILEAV(PL_curcop),(I32)CopLINE(PL_curcop),sv);
+               av_store(CopFILEAVx(PL_curcop),(I32)CopLINE(PL_curcop),sv);
            }
            goto retry;
        }
@@ -2817,7 +2817,7 @@ Perl_yylex(pTHX)
            sv_setsv(sv,PL_linestr);
             (void)SvIOK_on(sv);
             SvIV_set(sv, 0);
-           av_store(CopFILEAV(PL_curcop),(I32)CopLINE(PL_curcop),sv);
+           av_store(CopFILEAVx(PL_curcop),(I32)CopLINE(PL_curcop),sv);
        }
        PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
        PL_last_lop = PL_last_uni = Nullch;
@@ -3805,7 +3805,7 @@ Perl_yylex(pTHX)
                                t++;
                            Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
                                        "Multidimensional syntax %.*s not supported",
-                                       (t - PL_bufptr) + 1, PL_bufptr);
+                                   (int)((t - PL_bufptr) + 1), PL_bufptr);
                        }
                    }
                }
@@ -3910,7 +3910,8 @@ Perl_yylex(pTHX)
                        PL_bufptr = skipspace(PL_bufptr);
                        Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
                            "Scalar value %.*s better written as $%.*s",
-                           t-PL_bufptr, PL_bufptr, t-PL_bufptr-1, PL_bufptr+1);
+                           (int)(t-PL_bufptr), PL_bufptr,
+                           (int)(t-PL_bufptr-1), PL_bufptr+1);
                    }
                }
            }
@@ -9871,7 +9872,7 @@ S_scan_heredoc(pTHX_ register char *s)
            sv_setsv(sv,PL_linestr);
             (void)SvIOK_on(sv);
             SvIV_set(sv, 0);
-           av_store(CopFILEAV(PL_curcop), (I32)CopLINE(PL_curcop),sv);
+           av_store(CopFILEAVx(PL_curcop), (I32)CopLINE(PL_curcop),sv);
        }
        if (*s == term && memEQ(s,PL_tokenbuf,len)) {
            STRLEN off = PL_bufend - 1 - SvPVX_const(PL_linestr);
@@ -10344,7 +10345,7 @@ S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims)
            sv_setsv(sv,PL_linestr);
             (void)SvIOK_on(sv);
             SvIV_set(sv, 0);
-           av_store(CopFILEAV(PL_curcop), (I32)CopLINE(PL_curcop), sv);
+           av_store(CopFILEAVx(PL_curcop), (I32)CopLINE(PL_curcop), sv);
        }
 
        /* having changed the buffer, we must update PL_bufend */