[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-changes
Subject:    [perl.git]  branch blead, updated. v5.13.8-75-g361ed54
From:       "Nicholas Clark" <nick () ccl4 ! org>
Date:       2010-12-31 16:44:05
Message-ID: E1PYi5F-000507-Rt () camel ! ams6 ! corp ! booking ! com
[Download RAW message or body]

In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/361ed549eb6ef15e68e6bb16e020f11b7a29ebb2?hp=4861580b3001ab81922a8c1f978ed071012baca4>


- Log -----------------------------------------------------------------
commit 361ed549eb6ef15e68e6bb16e020f11b7a29ebb2
Author: Nicholas Clark <nick@ccl4.org>
Date:   Fri Dec 31 16:20:11 2010 +0000

    Avoid using OP_NAME() in unimplemented_op(), as it won't give useful strings.
    
    Using OP_NAME() isn't going to be helpful here. Firstly, it doesn't cope
    with out of range op numbers - it only "special" cases op_custom.  Secondly,
    as the three ops we "panic" on are padmy, mapstart and custom, if we get
    here for a custom op then that means that the custom op didn't have an
    implementation. Given that OP_NAME() looks up the custom op by its pp_addr,
    likely it will return NULL, unless someone (unhelpfully) registers
    &PL_unimplemented_op as the address of their custom op.  NULL doesn't
    generate a useful error message. "custom" does. */
-----------------------------------------------------------------------

Summary of changes:
 pp.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/pp.c b/pp.c
index 1f4ef25..85614c2 100644
--- a/pp.c
+++ b/pp.c
@@ -6300,8 +6300,18 @@ PP(pp_lock)
 PP(unimplemented_op)
 {
     dVAR;
-    DIE(aTHX_ "panic: unimplemented op %s (#%d) called", OP_NAME(PL_op),
-	PL_op->op_type);
+    const Optype op_type = PL_op->op_type;
+    /* Using OP_NAME() isn't going to be helpful here. Firstly, it doesn't cope
+       with out of range op numbers - it only "special" cases op_custom.
+       Secondly, as the three ops we "panic" on are padmy, mapstart and custom,
+       if we get here for a custom op then that means that the custom op didn't
+       have an implementation. Given that OP_NAME() looks up the custom op
+       by its pp_addr, likely it will return NULL, unless someone (unhelpfully)
+       registers &PL_unimplemented_op as the address of their custom op.
+       NULL doesn't generate a useful error message. "custom" does. */
+    const char *const name = op_type >= OP_max
+	? "[out of range]" : PL_op_name[PL_op->op_type];
+    DIE(aTHX_ "panic: unimplemented op %s (#%d) called", name,	op_type);
 }
 
 PP(pp_boolkeys)

--
Perl5 Master Repository


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic