summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-05-04 19:44:24 -0400
committerSteffen Mueller <smueller@cpan.org>2014-05-28 19:27:22 +0200
commitc67159e16ee2c8d23fc3c3a55448ffbda709b3f6 (patch)
treee490fd9d5327e9f7519b1a0d3578baff4d241600
parenta482c76f48270e80f77784f6a08d244af9b26d7e (diff)
downloadperl-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.pm4
-rw-r--r--dist/Data-Dumper/Dumper.xs1
-rw-r--r--gv.c1
-rw-r--r--op.c6
-rw-r--r--pp_ctl.c2
-rw-r--r--regcomp.c2
-rw-r--r--toke.c2
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;
diff --git a/gv.c b/gv.c
index e402f6bf72..1f36d31ffd 100644
--- a/gv.c
+++ b/gv.c
@@ -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);
diff --git a/op.c b/op.c
index 796cb0346c..2226a947f9 100644
--- a/op.c
+++ b/op.c
@@ -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++;
diff --git a/pp_ctl.c b/pp_ctl.c
index 380a7fe7f2..af9c6dc712 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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));
diff --git a/regcomp.c b/regcomp.c
index d2f95c2c8b..94dfd55ecd 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -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;
diff --git a/toke.c b/toke.c
index ea88183201..a3e9ad5f46 100644
--- a/toke.c
+++ b/toke.c
@@ -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) {