summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E Keenan <jkeenan@cpan.org>2018-10-12 22:29:46 -0400
committerJames E Keenan <jkeenan@cpan.org>2018-10-17 07:59:14 -0400
commitd8ff3e95e0f2357b6f26f5a94c52c46231fb1a74 (patch)
treebc2a4c5d472a1c47cdb4237b012ffb30445ac9bd
parentdcb414ac3e404a94d6b3ba0a9a06e72ae0ab368d (diff)
downloadperl-d8ff3e95e0f2357b6f26f5a94c52c46231fb1a74.tar.gz
Implement fatalization of dump()
Must now be written fully qualified: CORE::dump(). Adapt tests that previously warned, plus adapt one test that incidentally used dump(). For: RT # 133584
-rw-r--r--pod/perldiag.pod10
-rw-r--r--pod/perlfunc.pod5
-rw-r--r--pod/perlpodspec.pod2
-rw-r--r--pod/perlrun.pod4
-rw-r--r--t/lib/croak/pp_ctl2
-rw-r--r--t/lib/croak/toke7
-rw-r--r--t/lib/warnings/toke36
-rw-r--r--t/op/dump.t11
-rw-r--r--toke.c5
9 files changed, 23 insertions, 59 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index afac8798f8..82d3e4e768 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -2128,13 +2128,11 @@ something that isn't defined yet, you don't actually have to define the
subroutine or package before the current location. You can use an empty
"sub foo;" or "package FOO;" to enter a "forward" declaration.
-=item dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30
+=item dump() must be written as CORE::dump() as of Perl 5.30
-(D deprecated, misc) You used the obsolescent C<dump()> built-in function,
-without fully qualifying it as C<CORE::dump()>. Maybe it's a typo.
-
-Use of a unqualified C<dump()> was deprecated in Perl 5.8.0, and this
-will not be available in Perl 5.30.
+(F) You used the obsolete C<dump()> built-in function. That was deprecated in
+Perl 5.8.0. As of Perl 5.30 it must be written in fully qualified format:
+C<CORE::dump()>.
See L<perlfunc/dump>.
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 316daff1cf..9394e22343 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -1921,9 +1921,8 @@ be open any more when the program is reincarnated, with possible
resulting confusion by Perl.
This function is now largely obsolete, mostly because it's very hard to
-convert a core file into an executable. That's why you should now invoke
-it as C<CORE::dump()> if you don't want to be warned against a possible
-typo.
+convert a core file into an executable. As of Perl 5.30, it must be invoked
+as C<CORE::dump()>.
Unlike most named operators, this has the same precedence as assignment.
It is also exempt from the looks-like-a-function rule, so
diff --git a/pod/perlpodspec.pod b/pod/perlpodspec.pod
index 4fea607ba5..3ae2cc56f4 100644
--- a/pod/perlpodspec.pod
+++ b/pod/perlpodspec.pod
@@ -396,7 +396,7 @@ matching ">". Examples:
That's what I<you> think!
- What's C<dump()> for?
+ What's C<CORE::dump()> for?
X<C<chmod> and C<unlink()> Under Different Operating Systems>
diff --git a/pod/perlrun.pod b/pod/perlrun.pod
index 93a2746b6a..9c52a0d5ce 100644
--- a/pod/perlrun.pod
+++ b/pod/perlrun.pod
@@ -852,8 +852,8 @@ into an executable file by using the I<undump> program (not supplied).
This speeds startup at the expense of some disk space (which you
can minimize by stripping the executable). (Still, a "hello world"
executable comes out to about 200K on my machine.) If you want to
-execute a portion of your program before dumping, use the dump()
-operator instead. Note: availability of I<undump> is platform
+execute a portion of your program before dumping, use the C<CORE::dump()>
+function instead. Note: availability of I<undump> is platform
specific and may not be available for a specific port of Perl.
=item B<-U>
diff --git a/t/lib/croak/pp_ctl b/t/lib/croak/pp_ctl
index f705b65357..b1e754c356 100644
--- a/t/lib/croak/pp_ctl
+++ b/t/lib/croak/pp_ctl
@@ -36,7 +36,7 @@ Can't "goto" into a binary or list expression at - line 5.
# NAME dump with computed label
no warnings 'deprecated';
my $label = "foo";
-dump $label;
+CORE::dump $label;
EXPECT
Can't find label foo at - line 3.
########
diff --git a/t/lib/croak/toke b/t/lib/croak/toke
index 1d45a3fdf5..4a01c7adab 100644
--- a/t/lib/croak/toke
+++ b/t/lib/croak/toke
@@ -480,3 +480,10 @@ Bareword found where operator expected at - line 2, near "2p0"
(Missing operator before p0?)
syntax error at - line 2, near "2p0"
Execution of - aborted due to compilation errors.
+########
+# NAME dump() must be written as CORE::dump() as of Perl 5.30
+BEGIN { $^C = 1; }
+dump;
+CORE::dump;
+EXPECT
+dump() must be written as CORE::dump() as of Perl 5.30 at - line 2.
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index 45cdba528f..1c85d7bc44 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -109,8 +109,6 @@ toke.c AOK
$a = 0037777777777 ;
$a = 0047777777777 ;
- dump() better written as CORE::dump()
-
Use of /c modifier is meaningless without /g
Use of /c modifier is meaningless in s///
@@ -1182,40 +1180,6 @@ Integer overflow in hexadecimal number at - line 8.
Integer overflow in octal number at - line 11.
########
# toke.c
-BEGIN { $^C = 1; }
-dump;
-CORE::dump;
-EXPECT
-dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30 at - line 3.
-- syntax OK
-########
-# toke.c
-BEGIN { $^C = 1; }
-no warnings 'deprecated';
-dump;
-CORE::dump;
-EXPECT
-- syntax OK
-########
-# toke.c
-BEGIN { $^C = 1; }
-no warnings 'deprecated';
-use warnings 'misc';
-dump;
-CORE::dump;
-EXPECT
-dump() better written as CORE::dump(). dump() will no longer be available in Perl 5.30 at - line 5.
-- syntax OK
-########
-# toke.c
-use warnings 'misc';
-use subs qw/dump/;
-sub dump { print "no warning for overridden dump\n"; }
-dump;
-EXPECT
-no warning for overridden dump
-########
-# toke.c
use warnings 'ambiguous';
"@mjd_previously_unused_array";
no warnings 'ambiguous';
diff --git a/t/op/dump.t b/t/op/dump.t
index 2edba2035c..397c5b55ee 100644
--- a/t/op/dump.t
+++ b/t/op/dump.t
@@ -45,14 +45,14 @@ plan(2);
# Depending on how perl is built, there may be extraneous stuff on stderr
# such as "Aborted", which isn't caught by the '2>&1' that
-# fresh_perl_like() does. So execute each dump() in a sub-process.
+# fresh_perl_like() does. So execute each CORE::dump() in a sub-process.
#
# In detail:
# fresh_perl_like() ends up doing a `` which invokes a shell with 2 args:
#
# "sh", "-c", "perl /tmp/foo 2>&1"
#
-# When the perl process coredumps after calling dump(), the parent
+# When the perl process coredumps after calling CORE::dump(), the parent
# sh sees that the exit of the child flags a coredump and so prints
# something like the following to stderr:
#
@@ -80,13 +80,12 @@ if ($pid) {
else {
# child
print qq(A);
- dump;
+ CORE::dump;
print qq(B);
}
PROG
-fresh_perl_like(<<'PROG', qr/A(?!B\z)/, {}, "dump with label quits");
-BEGIN {$SIG {__WARN__} = sub {1;}}
+fresh_perl_like(<<'PROG', qr/A(?!B\z)/, {}, "CORE::dump with label quits"); BEGIN {$SIG {__WARN__} = sub {1;}}
++$|;
my $pid = fork;
die "fork: $!\n" unless defined $pid;
@@ -96,7 +95,7 @@ if ($pid) {
}
else {
print qq(A);
- dump foo;
+ CORE::dump foo;
foo:
print qq(B);
}
diff --git a/toke.c b/toke.c
index 24e614fd50..0527bd810a 100644
--- a/toke.c
+++ b/toke.c
@@ -7248,10 +7248,7 @@ Perl_yylex(pTHX)
else { /* no override */
tmp = -tmp;
if (tmp == KEY_dump) {
- Perl_ck_warner_d(aTHX_ packWARN2(WARN_MISC,WARN_DEPRECATED),
- "dump() better written as CORE::dump(). "
- "dump() will no longer be available "
- "in Perl 5.30");
+ Perl_croak(aTHX_ "dump() must be written as CORE::dump() as of Perl 5.30");
}
gv = NULL;
gvp = 0;