This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Silence some data truncation compiler warnings
authorJan Dubois <jand@activestate.com>
Thu, 16 Dec 2010 06:41:47 +0000 (22:41 -0800)
committerJan Dubois <jand@activestate.com>
Thu, 16 Dec 2010 19:24:24 +0000 (11:24 -0800)
gv.c
pp_sys.c
regcomp.c
regexec.c
scope.c
toke.c

diff --git a/gv.c b/gv.c
index 5d7837c..4e79171 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1914,7 +1914,7 @@ Perl_gv_handler(pTHX_ HV *stash, I32 id)
       do_update:
        /* If we're looking up a destructor to invoke, we must avoid
         * that Gv_AMupdate croaks, because we might be dying already */
-       if (Gv_AMupdate(stash, id == DESTROY_amg) == -1) {
+       if (Gv_AMupdate(stash, cBOOL(id == DESTROY_amg)) == -1) {
            /* and if it didn't found a destructor, we fall back
             * to a simpler method that will only look for the
             * destructor instead of the whole magic */
index d27bde6..89e131c 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3059,7 +3059,7 @@ PP(pp_ftrread)
        conditional compiling below much clearer.  */
     I32 use_access = 0;
 #endif
-    int stat_mode = S_IRUSR;
+    Mode_t stat_mode = S_IRUSR;
 
     bool effective = FALSE;
     char opchar = '?';
index ba3d0dc..fb9c606 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -8179,14 +8179,14 @@ S_checkposixcc(pTHX_ RExC_state_t *pRExC_state)
 ANYOF_##NAME:                                           \
        for (value = 0; value < 256; value++)           \
            if (TEST)                                   \
-               stored += S_set_regclass_bit(aTHX_ pRExC_state, ret, value); \
+               stored += S_set_regclass_bit(aTHX_ pRExC_state, ret, (U8) value); \
     yesno = '+';                                        \
     what = WORD;                                        \
     break;                                              \
 case ANYOF_N##NAME:                                     \
        for (value = 0; value < 256; value++)           \
            if (!TEST)                                  \
-               stored += S_set_regclass_bit(aTHX_ pRExC_state, ret, value); \
+               stored += S_set_regclass_bit(aTHX_ pRExC_state, ret, (U8) value); \
     yesno = '!';                                        \
     what = WORD;                                        \
     break
@@ -8950,7 +8950,7 @@ parseit:
                                 && (! _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(value))
                                 /* If the latest code point has a fold whose
                                  * bit is set, it must be the only other one */
-                                && ((prevvalue = PL_fold_latin1[value]) != value)
+                               && ((prevvalue = PL_fold_latin1[value]) != (IV)value)
                                 && ANYOF_BITMAP_TEST(ret, prevvalue)))))
     {
         /* Note that the information needed to decide to do this optimization
index b818aa1..591018a 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -5893,7 +5893,7 @@ S_regrepeat(pTHX_ const regexp *prog, const regnode *p, I32 max, int depth)
            char *tmpeol = loceol;
            while (hardcount < max
                    && foldEQ_utf8(scan, &tmpeol, 0, utf8_target,
-                                   STRING(p), NULL, 1, UTF_PATTERN))
+                                  STRING(p), NULL, 1, cBOOL(UTF_PATTERN)))
            {
                scan = tmpeol;
                tmpeol = loceol;
diff --git a/scope.c b/scope.c
index 80846b6..fb93db0 100644 (file)
--- a/scope.c
+++ b/scope.c
@@ -187,7 +187,7 @@ S_save_scalar_at(pTHX_ SV **sptr, const U32 flags)
               (SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
        }
        if (!(flags & SAVEf_KEEPOLDELEM))
-           mg_localize(osv, sv, (flags & SAVEf_SETMAGIC) != 0);
+           mg_localize(osv, sv, cBOOL(flags & SAVEf_SETMAGIC));
     }
 
     return sv;
diff --git a/toke.c b/toke.c
index 05ede22..792a46f 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -14256,7 +14256,7 @@ S_parse_recdescent(pTHX_ int gramtype, I32 fakeeof)
     SAVEI32(PL_lex_allbrackets);
     PL_lex_allbrackets = 0;
     SAVEI8(PL_lex_fakeeof);
-    PL_lex_fakeeof = fakeeof;
+    PL_lex_fakeeof = (U8)fakeeof;
     if(yyparse(gramtype) && !PL_parser->error_count)
        qerror(Perl_mess(aTHX_ "Parse error"));
 }