develooper Front page | perl.perl5.porters | Postings from February 2015

[perl #123558] deparse warning bits confusion

From:
Tony Cook via RT
Date:
February 23, 2015 06:14
Subject:
[perl #123558] deparse warning bits confusion
Message ID:
rt-4.0.18-5407-1424672080-1164.123558-15-0@perl.org
On Tue Jan 06 16:17:06 2015, zefram@fysh.org wrote:
> Recent blead has acquired some bizarre behaviour around the
> ambient_pragmas feature of the deparser:
> 
> $ perl -le 'use B::Deparse (); use warnings; $d = B::Deparse->new; $d-
> >ambient_pragmas(warnings=>"all"); print $d->coderef2text(sub { foo()
> })'
> {
>     foo();
> }
> $ perl -le 'use warnings; use B::Deparse (); $d = B::Deparse->new; $d-
> >ambient_pragmas(warnings=>"all"); print $d->coderef2text(sub { foo()
> })'
> {
>     BEGIN {${^WARNING_BITS} =
> "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x05"}
>     foo();
> }
> $ perl -le 'use warnings; use B::Deparse (); use warnings; $d =
> B::Deparse->new; $d->ambient_pragmas(warnings=>"all"); print $d-
> >coderef2text(sub { foo() })'
> {
>     foo();
> }
> 
> These situations should all be equivalent: the code in question is
> compiled with warnings "all" in effect, and the same pragmatic state
> is declared as ambient for deparsing, so the deparser output should
> not include anything setting the warning state.  Yet in the second
> case, where the warning state is set up before and not after loading
> the deparser, the output does include a setting of the warning bits.
> Previous versions of Perl did not misbehave in this manner.

This was fixed by 3c3f8cd64edb32a0dac554f7a524cc222184c3ec:

commit 3c3f8cd64edb32a0dac554f7a524cc222184c3ec
Author: Ævar Arnfjörð Bjarmason <avar@cpan.org>
Date:   Sun Jan 25 14:10:13 2015 +0000

    Revert the support for new warning categories outside of "all"
    
    This reverts & amends my v5.21.7-151-gea5519d and Karl Williamson's
    v5.21.7-183-g2f3cbe1, the latter was only need because of the
    former.
    
    I've also taken the opportunity to fix the long-standing trivial bug
    with misaligned code in warnings.{pm,h}. That was easier to commit along
    with this than to split it up from the other generated changes.
    
    Why revert this? See the "use warnings 'absolutely-all-almost';" thread
    on perl5-porters for the latest summary:
    
        http://www.nntp.perl.org/group/perl.perl5.porters/2015/01/msg225066.html
    
    Basically as I explained in v5.21.7-151-gea5519d the current design of
    the API makes it too contentious to freely add new warnings, but there's
    no consensus on how to solve that. I.e. whether we should just add them
    to "all", or do this change, or several other possible things outlined
    in that thread and elsewhere.
    
    Since the deadline for contentious changes for v5.22 is already past us
    I'm backing this out for now.

So closing.

Tony

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org/Ticket/Display.html?id=123558



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About