move Perl_ck_warner() before unwind [perl #113794]
authorZefram <zefram@fysh.org>
Tue, 23 Apr 2013 14:30:46 +0000 (10:30 -0400)
committerRicardo Signes <rjbs@cpan.org>
Wed, 24 Apr 2013 14:13:54 +0000 (10:13 -0400)
commitfc941f37b0048ca24b67f61973e6b9f50f9f908f
tree8c29bb37e45f7da55ffce1b57598267c346868a1
parentf321be7e68d63f48424096568e313ccad2b06211
move Perl_ck_warner() before unwind [perl #113794]

Indeed. The Perl_ck_warner() call in die_unwind() used to happen
before unwinding, so would be affected by the lexical warning state
at the die() site. Now it happens after unwinding, so takes the
lexical warning state at the catching site. I don't have a clear
idea of which behaviour is more correct. t/op/die_keeperr.t, which
was introduced as part of my exception handling changes, is actually
testing for the catching-site criterion, but that's not asserting
that the criterion should be that.  The documentation speaks of "no
warnings 'misc'", but doesn't say which lexical scope matters.

Assuming we want to revert this change, the easy fix is to move the
conditional Perl_ck_warner() back to before unwinding. A more
difficult way would be to determine the disposition of the warning
before unwinding and then warn in the required manner after
unwinding.  I see no compelling reason to warn after unwinding
rather than before, so just moving the warning code should be fine.

Note from the committer: This patch was supplied by Zefram in
https://rt.perl.org/rt3/Ticket/Display.html?id=113794#txn-1204749
with a note that some extra work was required for
ext/XS-APItest/t/call.t before the job was done.  Ricardo Signes
applied this patch and followed Zefram's lead in patching
ext/XS-APItest/t/call.t without being 100% certain that this was
what was meant.  This commit was then submitted for review.
ext/XS-APItest/t/call.t
pp_ctl.c
t/op/die_keeperr.t