Skip to content

Commit

Permalink
Make key/push $scalar experimental
Browse files Browse the repository at this point in the history
We need a better name for the experimental category, but I have not
thought of one, even after sleeping on it.
  • Loading branch information
Father Chrysostomos authored and rjbs committed Jan 14, 2014
1 parent ef40a5d commit 0953b66
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 32 deletions.
1 change: 1 addition & 0 deletions Porting/corelist.pl
Expand Up @@ -10,6 +10,7 @@
use autodie;
use strict;
use warnings;
no warnings 'experimental::aggref';
use File::Find;
use ExtUtils::MM_Unix;
use version;
Expand Down
1 change: 1 addition & 0 deletions lib/B/Deparse.t
Expand Up @@ -10,6 +10,7 @@ BEGIN {
}

use warnings;
no warnings 'experimental::aggref';
use strict;
use Test::More;

Expand Down
31 changes: 17 additions & 14 deletions lib/warnings.pm
Expand Up @@ -236,12 +236,13 @@ our %Offsets = (

# Warnings Categories added in Perl 5.019

'experimental::postderef'=> 112,
'syscalls' => 114,
'experimental::aggref'=> 112,
'experimental::postderef'=> 114,
'syscalls' => 116,
);

our %Bits = (
'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x05", # [0..57]
'all' => "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15", # [0..58]
'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00", # [29]
'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00", # [30]
'closed' => "\x00\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
Expand All @@ -251,18 +252,19 @@ our %Bits = (
'digit' => "\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00", # [31]
'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x01", # [51..56]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x55\x05", # [51..57]
'experimental::aggref'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [56]
'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00", # [52]
'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00", # [53]
'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [56]
'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [57]
'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00", # [54]
'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00", # [55]
'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00", # [47]
'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00", # [46]
'inplace' => "\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23]
'internal' => "\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00", # [24]
'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [5..11,57]
'io' => "\x00\x54\x55\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [5..11,58]
'layer' => "\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8]
'malloc' => "\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00", # [25]
'misc' => "\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12]
Expand Down Expand Up @@ -290,7 +292,7 @@ our %Bits = (
'substr' => "\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", # [27]
'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [50]
'syntax' => "\x00\x00\x00\x00\x00\x00\x00\x55\x55\x15\x00\x40\x00\x00\x00", # [28..38,47]
'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04", # [57]
'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10", # [58]
'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00\x00\x00\x00", # [39]
'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", # [40]
'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00", # [41]
Expand All @@ -302,7 +304,7 @@ our %Bits = (
);

our %DeadBits = (
'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x0a", # [0..57]
'all' => "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\x2a", # [0..58]
'ambiguous' => "\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00", # [29]
'bareword' => "\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00\x00\x00\x00", # [30]
'closed' => "\x00\x20\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [6]
Expand All @@ -312,18 +314,19 @@ our %DeadBits = (
'digit' => "\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00", # [31]
'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\x02", # [51..56]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\xaa\x0a", # [51..57]
'experimental::aggref'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [56]
'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00", # [52]
'experimental::lexical_topic'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00", # [53]
'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [56]
'experimental::postderef'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [57]
'experimental::regex_sets'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00", # [54]
'experimental::smartmatch'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00", # [55]
'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00", # [47]
'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00", # [46]
'inplace' => "\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [23]
'internal' => "\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00", # [24]
'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [5..11,57]
'io' => "\x00\xa8\xaa\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [5..11,58]
'layer' => "\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [8]
'malloc' => "\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00", # [25]
'misc' => "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [12]
Expand Down Expand Up @@ -351,7 +354,7 @@ our %DeadBits = (
'substr' => "\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00", # [27]
'surrogate' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [50]
'syntax' => "\x00\x00\x00\x00\x00\x00\x00\xaa\xaa\x2a\x00\x80\x00\x00\x00", # [28..38,47]
'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08", # [57]
'syscalls' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20", # [58]
'taint' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00", # [39]
'threads' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00", # [40]
'uninitialized' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00\x00", # [41]
Expand All @@ -363,8 +366,8 @@ our %DeadBits = (
);

$NONE = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
$DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x01", # [2,52,53,56,54,55,4,22,23,25]
$LAST_BIT = 116 ;
$DEFAULT = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x00\x55\x05", # [2,56,52,53,57,54,55,4,22,23,25]
$LAST_BIT = 118 ;
$BYTES = 15 ;

$All = "" ; vec($All, $Offsets{'all'}, 2) = 3 ;
Expand Down
17 changes: 15 additions & 2 deletions op.c
Expand Up @@ -9105,7 +9105,14 @@ Perl_ck_fun(pTHX_ OP *o)
/* Defer checks to run-time if we have a scalar arg */
if (kid->op_type == OP_RV2AV || kid->op_type == OP_PADAV)
op_lvalue(kid, type);
else scalar(kid);
else {
scalar(kid);
/* diag_listed_as: push on reference is experimental */
Perl_ck_warner_d(aTHX_
packWARN(WARN_EXPERIMENTAL__AGGREF),
"%s on reference is experimental",
PL_op_desc[type]);
}
break;
case OA_HVREF:
if (kid->op_type == OP_CONST &&
Expand Down Expand Up @@ -10944,7 +10951,13 @@ Perl_ck_each(pTHX_ OP *o)
}
}
/* if treating as a reference, defer additional checks to runtime */
return o->op_type == ref_type ? o : ck_fun(o);
if (o->op_type == ref_type) {
/* diag_listed_as: keys on reference is experimental */
Perl_ck_warner_d(aTHX_ packWARN(WARN_EXPERIMENTAL__AGGREF),
"%s is experimental", PL_op_desc[ref_type]);
return o;
}
return ck_fun(o);
}

OP *
Expand Down
68 changes: 66 additions & 2 deletions pod/perldiag.pod
Expand Up @@ -1761,6 +1761,14 @@ already been freed.
(W unpack) You have applied the same modifier more than once after a
type in a pack template. See L<perlfunc/pack>.

=item each on reference is experimental

(S experimental::aggref) C<each> with a scalar argument is experimental and
may change or be removed in a future Perl version. If you want to take
the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item elseif should be elsif

(S syntax) There is no keyword "elseif" in Perl because Larry thinks
Expand Down Expand Up @@ -2693,6 +2701,14 @@ line. See L<perlrun> for more details.

(P) The regular expression parser is confused.

=item keys on reference is experimental

(S experimental::aggref) C<keys> with a scalar argument is experimental and
may change or be removed in a future Perl version. If you want to take
the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item Label not found for "last %s"

(F) You named a loop to break out of, but you're not currently in a loop
Expand Down Expand Up @@ -4180,7 +4196,15 @@ fine from VMS' perspective, it's probably not what you intended.

(F) The unpack format P must have an explicit size, not "*".

=item POSIX class [:%s:] unknown in regex; marked by S<<-- HERE> in m/%s/
=item pop on reference is experimental

(S experimental::aggref) C<pop> with a scalar argument is experimental and
may change or be removed in a future Perl version. If you want to take
the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item POSIX class [:%s:] unknown in regex; marked by S<< <-- HERE in m/%s/ >>

(F) The class in the character class [: :] syntax is unknown. The S<<-- HERE>
shows whereabouts in the regular expression the problem was discovered.
Expand Down Expand Up @@ -4438,7 +4462,15 @@ is true for "LATIN SMALL LETTER Y WITH DIAERESIS", but since the upper
case of that character is not in Latin1, in that locale it doesn't
change when upper cased.

=item Quantifier follows nothing in regex; marked by S<<-- HERE> in m/%s/
=item push on reference is experimental

(S experimental::aggref) C<push> with a scalar argument is experimental and
may change or be removed in a future Perl version. If you want to take
the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item Quantifier follows nothing in regex; marked by S<< <-- HERE in m/%s/ >>

(F) You started a regular expression with a quantifier. Backslash it if
you meant it literally. The S<<-- HERE> shows whereabouts in the regular
Expand Down Expand Up @@ -4894,6 +4926,14 @@ didn't think so.
forget to check the return value of your socket() call? See
L<perlfunc/setsockopt>.

=item shift on reference is experimental

(S experimental::aggref) C<shift> with a scalar argument is experimental
and may change or be removed in a future Perl version. If you want to
take the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item shm%s not implemented

(F) You don't have System V shared memory IPC on your system.
Expand Down Expand Up @@ -4978,6 +5018,14 @@ end of the array, rather than past it. If this isn't what you want,
try explicitly pre-extending the array by assigning $#array = $offset.
See L<perlfunc/splice>.

=item splice on reference is experimental

(S experimental::aggref) C<splice> with a scalar argument is experimental
and may change or be removed in a future Perl version. If you want to
take the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item Split loop

(P) The split was looping infinitely. (Obviously, a split shouldn't
Expand Down Expand Up @@ -5795,6 +5843,14 @@ on your system.
think you didn't do that, check the #! line to see if it's supplying the
bad switch on your behalf.)

=item unshift on reference is experimental

(S experimental::aggref) C<unshift> with a scalar argument is experimental
and may change or be removed in a future Perl version. If you want to
take the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item Unsuccessful %s on filename containing newline

(W newline) A file operation was attempted on a filename, and that
Expand Down Expand Up @@ -6340,6 +6396,14 @@ C<defined> operator.
longer than 1024 characters. The return value has been truncated to
1024 characters.

=item values on reference is experimental

(S experimental::aggref) C<values> with a scalar argument is experimental
and may change or be removed in a future Perl version. If you want to
take the risk of using this feature, simply disable this warning:

no warnings "experimental::aggref";

=item Variable "%s" is not available

(W closure) During compilation, an inner named subroutine or eval is
Expand Down
2 changes: 2 additions & 0 deletions pod/perllexwarn.pod
Expand Up @@ -229,6 +229,8 @@ will be lost.
|
+- experimental --+
| |
| +- experimental::aggref
| |
| +- experimental::lexical_subs
| |
| +- experimental::lexical_topic
Expand Down
1 change: 1 addition & 0 deletions regen/regcharclass.pl
Expand Up @@ -4,6 +4,7 @@ package CharClass::Matcher;
use 5.008;
use warnings;
use warnings FATAL => 'all';
no warnings 'experimental::aggref';
use Text::Wrap qw(wrap);
use Data::Dumper;
$Data::Dumper::Useqq= 1;
Expand Down
2 changes: 2 additions & 0 deletions regen/warnings.pl
Expand Up @@ -99,6 +99,8 @@ BEGIN
[ 5.017, DEFAULT_ON ],
'experimental::postderef' =>
[ 5.019, DEFAULT_ON ],
'experimental::aggref' =>
[ 5.019, DEFAULT_ON ],
}],

#'default' => [ 5.008, DEFAULT_ON ],
Expand Down

0 comments on commit 0953b66

Please sign in to comment.