From: Rafael Garcia-Suarez Date: Thu, 3 Jan 2002 22:04:00 +0000 (+0100) Subject: warn if not CORE::dump X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ac206dc8afc56c3af5eccaed5ba83dda4e594b6e;p=p5sagit%2Fp5-mst-13.2.git warn if not CORE::dump Message-Id: <20020103220400.A13958@rafael> p4raw-id: //depot/perl@14053 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 68bd0c2..2c10474 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1289,6 +1289,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() + +(W misc) You used the obsolescent C built-in function, without fully +qualifying it as C. Maybe it's a typo. See L. + =item Duplicate free() ignored (S malloc) An internal routine called free() on something that had diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 93383d3..4bd69a3 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1204,7 +1204,9 @@ resulting confusion on the part of Perl. 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, if you don't want to be warned against a possible +typo. If you're looking to use L to speed up your program, consider generating bytecode or native C code as described in L. If diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index 14b745d..70ff3db 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -101,6 +101,8 @@ toke.c AOK $a = 0037777777776 ; $a = 0037777777777 ; $a = 0047777777777 ; + + dump() better written as CORE::dump() Mandatory Warnings ------------------ @@ -702,6 +704,23 @@ Integer overflow in hexadecimal number at - line 8. 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'; diff --git a/toke.c b/toke.c index de71cee..6f06daa 100644 --- a/toke.c +++ b/toke.c @@ -3813,6 +3813,10 @@ Perl_yylex(pTHX) } 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