diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2014-05-04 19:44:24 -0400 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2014-05-28 19:27:22 +0200 |
commit | c67159e16ee2c8d23fc3c3a55448ffbda709b3f6 (patch) | |
tree | e490fd9d5327e9f7519b1a0d3578baff4d241600 | |
parent | a482c76f48270e80f77784f6a08d244af9b26d7e (diff) | |
download | perl-c67159e16ee2c8d23fc3c3a55448ffbda709b3f6.tar.gz |
Annotate intentional case fallthrough, or add breaks.
Fix suspicious (*) switch cases found by Coverity by
annotating with either "/* FALLTHROUGH */" or adding a break;
The FALLTHROUGH was much more common, but the break turned
out to be the right choice in three spots. All changes tested
to work.
(*) suspicious = case1 + code + case2, and neither flow control
(like break) nor fallthrough annotation between code and case2.
Fix for Coverity perl5 CIDs 28977..28989, 45353.
-rw-r--r-- | dist/Data-Dumper/Dumper.pm | 4 | ||||
-rw-r--r-- | dist/Data-Dumper/Dumper.xs | 1 | ||||
-rw-r--r-- | gv.c | 1 | ||||
-rw-r--r-- | op.c | 6 | ||||
-rw-r--r-- | pp_ctl.c | 2 | ||||
-rw-r--r-- | regcomp.c | 2 | ||||
-rw-r--r-- | toke.c | 2 |
7 files changed, 16 insertions, 2 deletions
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm index 7c8a72c669..6f7a0d8226 100644 --- a/dist/Data-Dumper/Dumper.pm +++ b/dist/Data-Dumper/Dumper.pm @@ -10,7 +10,7 @@ package Data::Dumper; BEGIN { - $VERSION = '2.151'; # Don't forget to set version and release + $VERSION = '2.152'; # Don't forget to set version and release } # date in POD below! #$| = 1; @@ -1398,7 +1398,7 @@ modify it under the same terms as Perl itself. =head1 VERSION -Version 2.151 (March 7 2014) +Version 2.152 (March 7 2014) =head1 SEE ALSO diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index 12c4ebd9f6..5bc3428c94 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -207,6 +207,7 @@ esc_q(char *d, const char *s, STRLEN slen) case '\\': *d = '\\'; ++d; ++ret; + /* FALLTHROUGH */ default: *d = *s; ++d; ++s; --slen; @@ -353,6 +353,7 @@ Perl_gv_init_pvn(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, U32 flag case SVt_PVIO: Perl_croak(aTHX_ "Cannot convert a reference to %s to typeglob", sv_reftype(has_constant, 0)); + break; default: NOOP; } SvRV_set(gv, NULL); @@ -793,6 +793,7 @@ Perl_op_clear(pTHX_ OP *o) o->op_targ = 0; goto retry; } + /* FALLTHROUGH */ case OP_ENTERTRY: case OP_ENTEREVAL: /* Was holding hints. */ o->op_targ = 0; @@ -1678,6 +1679,7 @@ Perl_scalarvoid(pTHX_ OP *o) } op_null(kid); } + /* FALLTHROUGH */ case OP_DOR: case OP_COND_EXPR: @@ -1974,6 +1976,7 @@ S_finalize_op(pTHX_ OP* o) case OP_HSLICE: S_scalar_slice_warning(aTHX_ o); + /* FALLTHROUGH */ case OP_KVHSLICE: kid = cLISTOPo->op_first->op_sibling; @@ -2278,6 +2281,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) /* FALL THROUGH */ case OP_GV: PL_hints |= HINT_BLOCK_SCOPE; + /* FALL THROUGH */ case OP_SASSIGN: case OP_ANDASSIGN: case OP_ORASSIGN: @@ -2346,6 +2350,7 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) case OP_LEAVE: case OP_LEAVELOOP: o->op_private |= OPpLVALUE; + /* FALL THROUGH */ case OP_SCOPE: case OP_ENTER: case OP_LINESEQ: @@ -10488,6 +10493,7 @@ Perl_ck_entersub_args_proto(pTHX_ OP *entersubop, GV *namegv, SV *protosv) /* _ must be at the end */ if (proto[1] && !strchr(";@%", proto[1])) goto oops; + /* FALLTHROUGH */ case '$': proto++; arg++; @@ -696,6 +696,7 @@ PP(pp_formline) case FF_LINESNGL: /* process ^* */ chopspace = 0; + /* FALLTHROUGH */ case FF_LINEGLOB: /* process @* */ { @@ -1400,6 +1401,7 @@ S_dopoptosub_at(pTHX_ const PERL_CONTEXT *cxstk, I32 startingblock) * code block. Hide this faked entry from the world. */ if (cx->cx_type & CXp_SUB_RE_FAKE) continue; + /* FALLTHROUGH */ case CXt_EVAL: case CXt_FORMAT: DEBUG_l( Perl_deb(aTHX_ "(dopoptosub_at(): found sub at cx=%ld)\n", (long)i)); @@ -9661,6 +9661,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp,U32 depth) RExC_seen |= REG_LOOKBEHIND_SEEN; RExC_in_lookbehind++; RExC_parse++; + /* FALLTHROUGH */ case '=': /* (?=...) */ RExC_seen_zerolen++; break; @@ -11896,6 +11897,7 @@ tryagain: --p; goto loopdone; } + /* FALLTHROUGH */ case '0': { I32 flags = PERL_SCAN_SILENT_ILLDIGIT; @@ -6747,6 +6747,7 @@ Perl_yylex(pTHX) s += 2; AOPERATOR(DORDOR); } + /* FALLTHROUGH */ case '?': /* may either be conditional or pattern */ if (PL_expect == XOPERATOR) { char tmp = *s++; @@ -11722,6 +11723,7 @@ S_swallow_bom(pTHX_ U8 *s) #endif } } + break; default: if (slen > 3 && s[1] == 0 && s[2] != 0 && s[3] == 0) { |