From d673215e89e48f1d926b059d6b44b3b8a681d538 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Mon, 8 Aug 2011 22:15:52 -0700 Subject: [PATCH] Make prototype("CORE::CORE") die once more. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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...). --- op.c | 4 ++-- t/op/cproto.t | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/op.c b/op.c index d20009e..a144385 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 ee97433..e1f3125 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 () { chomp; @@ -32,6 +32,7 @@ __LINE__ () __PACKAGE__ () __DATA__ undef __END__ undef +CORE unknown abs (_) accept (**) alarm (_) -- 2.7.4