summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-08 22:15:52 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-08 22:15:52 -0700
commitd673215e89e48f1d926b059d6b44b3b8a681d538 (patch)
tree74caec402dfc9849baa99c00f8f7db4381f74b56
parentea31ed6697f4ec8ba9adbd2e965d8912bb223307 (diff)
downloadperl-d673215e89e48f1d926b059d6b44b3b8a681d538.tar.gz
Make prototype("CORE::CORE") die once more.
Commit b8c38f0a2a65 accidentally made prototype("CORE::CORE") return undef instead of dying. This is the only case that reached the line with the ‘Should not happen...’ comment. This commit changes it to be handled earlier and also adds an asser- tion to make sure that unreachable code really is unreachable (which it should be now, I think, I hope...).
-rw-r--r--op.c4
-rw-r--r--t/op/cproto.t3
2 files changed, 4 insertions, 3 deletions
diff --git a/op.c b/op.c
index d20009e265..a1443850f3 100644
--- a/op.c
+++ b/op.c
@@ -10245,7 +10245,7 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
PERL_ARGS_ASSERT_CORE_PROTOTYPE;
- if (!code) {
+ if (!code || code == -KEY_CORE) {
if (croak)
return (SV *)Perl_die(aTHX_
"Can't find an opnumber for \"%s\"", name
@@ -10290,7 +10290,7 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
}
i++;
}
- return NULL; /* Should not happen... */
+ assert(0); return NULL; /* Should not happen... */
found:
defgv = PL_opargs[i] & OA_DEFGV;
oa = PL_opargs[i] >> OASHIFT;
diff --git a/t/op/cproto.t b/t/op/cproto.t
index ee9743375b..e1f3125dfc 100644
--- a/t/op/cproto.t
+++ b/t/op/cproto.t
@@ -7,7 +7,7 @@ BEGIN {
}
BEGIN { require './test.pl'; }
-plan tests => 243;
+plan tests => 244;
while (<DATA>) {
chomp;
@@ -32,6 +32,7 @@ __LINE__ ()
__PACKAGE__ ()
__DATA__ undef
__END__ undef
+CORE unknown
abs (_)
accept (**)
alarm (_)