diff options
author | David Mitchell <davem@iabyn.com> | 2022-04-13 12:38:40 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2022-04-16 13:03:56 +0100 |
commit | e25d08b5518093e0dbaf56e9a80f9a7629eee359 (patch) | |
tree | 484c8a86e3db7cf5cc6b9a11c1a5ff0504bf87c6 /lib/B/Deparse.t | |
parent | a0911be9ee3a73417e7f1dbb6b168db70f3d737e (diff) | |
download | perl-e25d08b5518093e0dbaf56e9a80f9a7629eee359.tar.gz |
Deparse: honour custom warnings categories
Perl's warning system is based around a bitmask string, with 2 bits per
warning category. There are a large number of predefined categories
(such as "syntax" etc) which map to known, fixed indexes within that
string.
However it is possible for modules to register custom warning categories
(indeed, the "constant" and "overload" warning categories are custom,
registered during "use constant" or "use overload").
Deparse, as originally written, masked out any custom categories when
deciding whether the warnings state had changed (and thus a 'no/use
warnings "foo"' needed emitting). This made the code easier as it didn't
have to cope with variable-length bitmasks.
However, after v5.27.5-387-g006c1a1dbd (which tried to handle the
problem of unused bits in the last byte of the bitmask), then depending
on how many pre-defined warning categories there were, as a side effect
caused Deparse to start handling anywhere between 0 and 3 custom warning
categories, depending on how many built-in categories there were in the
current release.
It just so happens that in the forthcoming release (5.36), the number of
built-in categories is a multiple of 4, causing Deparse to handle 0
custom categories. Which is causing some 't/TEST -deparse' tests to
fail.
To fix this, this commit goes the full way and makes Deparse honour
*all* custom warnings categories, both by removing the masking, and
by normalising bitmask lengths before comparing them.
Diffstat (limited to 'lib/B/Deparse.t')
-rw-r--r-- | lib/B/Deparse.t | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index f7420ae338..4446f755ec 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -2101,7 +2101,7 @@ no warnings "experimental::lexical_subs"; my sub f {} print f(); >>>> -BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55\x55\x55"} +BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55\x55\x55\x55"} my sub f { } @@ -2114,7 +2114,7 @@ no warnings 'experimental::lexical_subs'; state sub f {} print f(); >>>> -BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55\x55\x55"} +BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x55\x55\x55\x55"} state sub f { } |