summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-08-15 14:55:16 -0600
committerKarl Williamson <public@khwilliamson.com>2013-09-24 11:36:17 -0600
commit56fcde2d6ae422de10850c03aa10c4d036bbf0cf (patch)
treef67a4ec18769f3b500de4392e8749403ac7e51f1 /regcomp.c
parentc8a279645383868d6f9ab609e7eb2f091a5e296f (diff)
downloadperl-56fcde2d6ae422de10850c03aa10c4d036bbf0cf.tar.gz
regcomp.c: Better DEBUGGING builds error detection
The code had a default: catch-all in the switch statement, but the comments indicated that it was uncertain what all was being caught. This changes this to panic only in DEBUGGING builds so that we can find out if there are indeed other possibilities that we haven't handled, and which could use better handling than the default, match everything. The two known possibilities are given separate case: statements in preparation for handling them differently.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index 2fbc1b4107..dfd1cffe3e 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -4159,7 +4159,14 @@ PerlIO_printf(Perl_debug_log, "LHS=%"UVdf" RHS=%"UVdf"\n",
NEXT_OFF(oscan) += NEXT_OFF(next);
}
continue;
- default: /* REF, and CLUMP only? */
+
+ default:
+#ifdef DEBUGGING
+ Perl_croak(aTHX_ "panic: unexpected varying REx opcode %d",
+ OP(scan));
+#endif
+ case REF:
+ case CLUMP:
if (flags & SCF_DO_SUBSTR) {
SCAN_COMMIT(pRExC_state,data,minlenp); /* Cannot expect anything... */
data->longest = &(data->longest_float);