Change 14053 by ams@lustre on 2002/01/04 03:27:44
Subject: [PATCH] warn if not CORE::dump
From: Rafael Garcia-Suarez <[EMAIL PROTECTED]>
Date: Thu, 3 Jan 2002 22:04:00 +0100
Message-Id: <20020103220400.A13958@rafael>
Affected files ...
.... //depot/perl/pod/perldiag.pod#258 edit
.... //depot/perl/pod/perlfunc.pod#291 edit
.... //depot/perl/t/lib/warnings/toke#5 edit
.... //depot/perl/toke.c#405 edit
Differences ...
==== //depot/perl/pod/perldiag.pod#258 (text) ====
Index: perl/pod/perldiag.pod
--- perl/pod/perldiag.pod.~1~ Thu Jan 3 20:45:05 2002
+++ perl/pod/perldiag.pod Thu Jan 3 20:45:05 2002
@@ -1289,6 +1289,11 @@
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()
+
+(W misc) You used the obsolescent C<dump()> built-in function, without fully
+qualifying it as C<CORE::dump()>. Maybe it's a typo. See L<perlfunc/dump>.
+
=item Duplicate free() ignored
(S malloc) An internal routine called free() on something that had
==== //depot/perl/pod/perlfunc.pod#291 (text) ====
Index: perl/pod/perlfunc.pod
--- perl/pod/perlfunc.pod.~1~ Thu Jan 3 20:45:05 2002
+++ perl/pod/perlfunc.pod Thu Jan 3 20:45:05 2002
@@ -1204,7 +1204,9 @@
This function is now largely obsolete, partly because it's very
hard to convert a core file into an executable, and because the
real compiler backends for generating portable bytecode and compilable
-C code have superseded it.
+C code have superseded it. That's why you should now invoke it as
+C<CORE::dump()>, if you don't want to be warned against a possible
+typo.
If you're looking to use L<dump> to speed up your program, consider
generating bytecode or native C code as described in L<perlcc>. If
==== //depot/perl/t/lib/warnings/toke#5 (text) ====
Index: perl/t/lib/warnings/toke
--- perl/t/lib/warnings/toke.~1~ Thu Jan 3 20:45:05 2002
+++ perl/t/lib/warnings/toke Thu Jan 3 20:45:05 2002
@@ -101,6 +101,8 @@
$a = 0037777777776 ;
$a = 0037777777777 ;
$a = 0047777777777 ;
+
+ dump() better written as CORE::dump()
Mandatory Warnings
------------------
@@ -702,6 +704,23 @@
Integer overflow in octal number at - line 11.
########
# toke.c
+BEGIN { $^C = 1; }
+use warnings 'misc';
+dump;
+CORE::dump;
+EXPECT
+dump() better written as CORE::dump() at - line 4.
+- syntax OK
+########
+# toke.c
+use warnings 'misc';
+use subs qw/dump/;
+sub dump { print "no warning for overriden dump\n"; }
+dump;
+EXPECT
+no warning for overriden dump
+########
+# toke.c
use warnings 'ambiguous';
"@mjd_previously_unused_array";
no warnings 'ambiguous';
==== //depot/perl/toke.c#405 (text) ====
Index: perl/toke.c
--- perl/toke.c.~1~ Thu Jan 3 20:45:05 2002
+++ perl/toke.c Thu Jan 3 20:45:05 2002
@@ -3813,6 +3813,10 @@
}
else { /* no override */
tmp = -tmp;
+ if (tmp == KEY_dump && ckWARN(WARN_MISC)) {
+ Perl_warner(aTHX_ WARN_MISC,
+ "dump() better written as CORE::dump()");
+ }
gv = Nullgv;
gvp = 0;
if (ckWARN(WARN_AMBIGUOUS) && hgv
End of Patch.