-
Notifications
You must be signed in to change notification settings - Fork 574
Fatalize unqualified use of dump() in perl-5.30 #16719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From @jkeenanIn the following commit we we implemented a warning, present in ##### Deprecation of an unqualified dump() to mean CORE::dump(). This will no longer be allowed in 5.30. In preparation for perl-5.30, we need to fatalize the unqualified use of Thank you very much. |
From @jkeenanOn Sat, 13 Oct 2018 03:13:34 GMT, jkeenan@pobox.com wrote:
A draft of an implementation of the fatalization of unqualified dump() can be found in the smoke-me/jkeenan/133584-dump-becomes-core-dump branch or in the attached diff (which squashes all the patches in that branch). Please review the patch, particularly with respect to the following: 1. toke.c: Correct usage of Perl_croak; suitability of error message. 2. Tests: 3. Documentation: Please review carefully. If satisfactory, I would like to merge to blead by Thursday, October 17, so that we can get it into the monthly release scheduled for October 20 and then see how much CPAN breakage occurs. Thank you very much. |
From @jkeenanblead.133584.diffdiff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 4a50e5d9d8..4148fc06ad 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 c770e9cb2c..22fea24a02 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///
@@ -1181,40 +1179,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;
|
The RT System itself - Status changed from 'new' to 'open' |
@jkeenan - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been Perl 5.30.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#133584 (status was 'resolved')
Searchable as RT133584$
The text was updated successfully, but these errors were encountered: