summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-13 16:04:18 +0100
committerJesse Vincent <jesse@bestpractical.com>2009-10-16 12:30:17 -0400
commitd1d15184c41c6ad4f16829561163cd118e5ae917 (patch)
tree65d9365479cc68a7c33c3388058bc9654e4a500b
parent43b3daf05d64926950dcc26b6a3e77b7c8f513da (diff)
downloadperl-d1d15184c41c6ad4f16829561163cd118e5ae917.tar.gz
Enable deprecation warnings by default.
-rw-r--r--gv.c6
-rw-r--r--handy.h2
-rw-r--r--op.c20
-rw-r--r--pod/perldiag.pod6
-rw-r--r--pod/perlvar.pod3
-rw-r--r--pp_sys.c10
-rw-r--r--regcomp.c2
-rw-r--r--t/lib/warnings/op28
-rw-r--r--t/lib/warnings/toke20
9 files changed, 45 insertions, 52 deletions
diff --git a/gv.c b/gv.c
index e967f907a7..22af274c2f 100644
--- a/gv.c
+++ b/gv.c
@@ -729,9 +729,9 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method)
*/
if (!method && (GvCVGEN(gv) || GvSTASH(gv) != stash)
)
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
- "Use of inherited AUTOLOAD for non-method %s::%.*s() is deprecated",
- packname, (int)len, name);
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
+ "Use of inherited AUTOLOAD for non-method %s::%.*s() is deprecated",
+ packname, (int)len, name);
if (CvISXSUB(cv)) {
/* rather than lookup/init $AUTOLOAD here
diff --git a/handy.h b/handy.h
index 6c049cb994..d291eb6814 100644
--- a/handy.h
+++ b/handy.h
@@ -906,7 +906,7 @@ void Perl_mem_log_del_sv(const SV *sv, const char *filename, const int linenumbe
shortcut macro defined without -DPERL_CORE. Neither codesearch.google.com nor
CPAN::Unpack show any users outside the core. */
#ifdef PERL_CORE
-# define deprecate(s) Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED), "Use of " s " is deprecated")
+# define deprecate(s) Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), "Use of " s " is deprecated")
#endif
/*
diff --git a/op.c b/op.c
index 796bec3784..d5632821b9 100644
--- a/op.c
+++ b/op.c
@@ -4571,8 +4571,8 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
&& o2->op_private & OPpLVAL_INTRO
&& !(o2->op_private & OPpPAD_STATE))
{
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
- "Deprecated use of my() in false conditional");
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
+ "Deprecated use of my() in false conditional");
}
*otherp = NULL;
@@ -6265,7 +6265,7 @@ Perl_newAVREF(pTHX_ OP *o)
return o;
}
else if ((o->op_type == OP_RV2AV || o->op_type == OP_PADAV)) {
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"Using an array as a reference is deprecated");
}
return newUNOP(OP_RV2AV, 0, scalar(o));
@@ -6292,7 +6292,7 @@ Perl_newHVREF(pTHX_ OP *o)
return o;
}
else if ((o->op_type == OP_RV2HV || o->op_type == OP_PADHV)) {
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"Using a hash as a reference is deprecated");
}
return newUNOP(OP_RV2HV, 0, scalar(o));
@@ -6845,7 +6845,7 @@ Perl_ck_fun(pTHX_ OP *o)
{
OP * const newop = newAVREF(newGVOP(OP_GV, 0,
gv_fetchsv(((SVOP*)kid)->op_sv, GV_ADD, SVt_PVAV) ));
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"Array @%"SVf" missing the @ in argument %"IVdf" of %s()",
SVfARG(((SVOP*)kid)->op_sv), (IV)numargs, PL_op_desc[type]);
#ifdef PERL_MAD
@@ -6867,7 +6867,7 @@ Perl_ck_fun(pTHX_ OP *o)
{
OP * const newop = newHVREF(newGVOP(OP_GV, 0,
gv_fetchsv(((SVOP*)kid)->op_sv, GV_ADD, SVt_PVHV) ));
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"Hash %%%"SVf" missing the %% in argument %"IVdf" of %s()",
SVfARG(((SVOP*)kid)->op_sv), (IV)numargs, PL_op_desc[type]);
#ifdef PERL_MAD
@@ -7215,9 +7215,9 @@ Perl_ck_defined(pTHX_ OP *o) /* 19990527 MJD */
break; /* Globals via GV can be undef */
case OP_PADAV:
case OP_AASSIGN: /* Is this a good idea? */
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"defined(@array) is deprecated");
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"\t(Maybe you should just omit the defined()?)\n");
break;
case OP_RV2HV:
@@ -7227,9 +7227,9 @@ Perl_ck_defined(pTHX_ OP *o) /* 19990527 MJD */
*/
break; /* Globals via GV can be undef */
case OP_PADHV:
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"defined(%%hash) is deprecated");
- Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED),
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
"\t(Maybe you should just omit the defined()?)\n");
break;
default:
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index ab9a947c6b..255eb533ce 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -8,7 +8,7 @@ These messages are classified as follows (listed in increasing order of
desperation):
(W) A warning (optional).
- (D) A deprecation (optional).
+ (D) A deprecation (enabled by default).
(S) A severe warning (enabled by default).
(F) A fatal error (trappable).
(P) An internal error you should never see (trappable).
@@ -2191,7 +2191,7 @@ neither as a system call or an ioctl call (SIOCATMARK).
=item $* is no longer supported
-(S deprecated, syntax) The special variable C<$*>, deprecated in older perls, has
+(D deprecated, syntax) The special variable C<$*>, deprecated in older perls, has
been removed as of 5.9.0 and is no longer supported. In previous versions of perl the use of
C<$*> enabled or disabled multi-line matching within a string.
@@ -2201,7 +2201,7 @@ expressions behaved as if they were written using C</m>.)
=item $# is no longer supported
-(S deprecated, syntax) The special variable C<$#>, deprecated in older perls, has
+(D deprecated, syntax) The special variable C<$#>, deprecated in older perls, has
been removed as of 5.9.3 and is no longer supported. You should use the
printf/sprintf functions instead.
diff --git a/pod/perlvar.pod b/pod/perlvar.pod
index f2e29e1e2e..834a880cc6 100644
--- a/pod/perlvar.pod
+++ b/pod/perlvar.pod
@@ -1038,8 +1038,7 @@ subscripting and when evaluating the index() and substr() functions.
As of release 5 of Perl, assignment to C<$[> is treated as a compiler
directive, and cannot influence the behavior of any other file.
(That's why you can only assign compile-time constants to it.) Its
-use is deprecated, and will trigger a warning (if the deprecation
-L<warnings> category is enabled. You did C<use warnings>, right?)
+use is deprecated, and by default will trigger a warning.
Note that, unlike other compile-time directives (such as L<strict>),
assignment to C<$[> can be seen from outer lexical scopes in the same file.
diff --git a/pp_sys.c b/pp_sys.c
index 4c006512e7..d3430d1c0f 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -522,8 +522,9 @@ PP(pp_open)
IoFLAGS(GvIOp(gv)) &= ~IOf_UNTAINT;
if (IoDIRP(io))
- Perl_ck_warner(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
- "Opening dirhandle %s also as a file", GvENAME(gv));
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
+ "Opening dirhandle %s also as a file",
+ GvENAME(gv));
mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar);
if (mg) {
@@ -3829,8 +3830,9 @@ PP(pp_open_dir)
goto nope;
if ((IoIFP(io) || IoOFP(io)))
- Perl_ck_warner(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
- "Opening filehandle %s also as a directory", GvENAME(gv));
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
+ "Opening filehandle %s also as a directory",
+ GvENAME(gv));
if (IoDIRP(io))
PerlDir_close(IoDIRP(io));
if (!(IoDIRP(io) = PerlDir_open(dirname)))
diff --git a/regcomp.c b/regcomp.c
index 0f5f81df0d..5a6ca55b24 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -483,7 +483,7 @@ static const scan_data_t zero_scan_data =
#define ckWARNregdep(loc,m) STMT_START { \
const IV offset = loc - RExC_precomp; \
- Perl_ck_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_REGEXP), \
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_REGEXP), \
m REPORT_LOCATION, \
(int)offset, RExC_precomp, RExC_precomp + offset); \
} STMT_END
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index 0891bd8bbb..73f1527fcf 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -106,7 +106,6 @@ EXPECT
Found = in conditional, should be == at - line 3.
########
# op.c
-use warnings 'deprecated';
my (@foo, %foo);
%main::foo->{"bar"};
%foo->{"bar"};
@@ -126,14 +125,14 @@ $foo = {}; %$foo->{"bar"};
$main::foo = []; @$main::foo->[34];
$foo = []; @$foo->[34];
EXPECT
+Using a hash as a reference is deprecated at - line 3.
Using a hash as a reference is deprecated at - line 4.
-Using a hash as a reference is deprecated at - line 5.
+Using an array as a reference is deprecated at - line 5.
Using an array as a reference is deprecated at - line 6.
-Using an array as a reference is deprecated at - line 7.
+Using a hash as a reference is deprecated at - line 7.
Using a hash as a reference is deprecated at - line 8.
-Using a hash as a reference is deprecated at - line 9.
+Using an array as a reference is deprecated at - line 9.
Using an array as a reference is deprecated at - line 10.
-Using an array as a reference is deprecated at - line 11.
########
# op.c
use warnings 'void' ; close STDIN ;
@@ -727,20 +726,18 @@ EXPECT
Format FRED redefined at - line 5.
########
# op.c
-use warnings 'deprecated' ;
push FRED;
no warnings 'deprecated' ;
push FRED;
EXPECT
-Array @FRED missing the @ in argument 1 of push() at - line 3.
+Array @FRED missing the @ in argument 1 of push() at - line 2.
########
# op.c
-use warnings 'deprecated' ;
@a = keys FRED ;
no warnings 'deprecated' ;
@a = keys FRED ;
EXPECT
-Hash %FRED missing the % in argument 1 of keys() at - line 3.
+Hash %FRED missing the % in argument 1 of keys() at - line 2.
########
# op.c
use warnings 'syntax' ;
@@ -751,24 +748,21 @@ Statement unlikely to be reached at - line 4.
(Maybe you meant system() when you said exec()?)
########
# op.c
-use warnings 'deprecated' ;
my @a; defined(@a);
EXPECT
-defined(@array) is deprecated at - line 3.
+defined(@array) is deprecated at - line 2.
(Maybe you should just omit the defined()?)
########
# op.c
-use warnings 'deprecated' ;
defined(@a = (1,2,3));
EXPECT
-defined(@array) is deprecated at - line 3.
+defined(@array) is deprecated at - line 2.
(Maybe you should just omit the defined()?)
########
# op.c
-use warnings 'deprecated' ;
my %h; defined(%h);
EXPECT
-defined(%hash) is deprecated at - line 3.
+defined(%hash) is deprecated at - line 2.
(Maybe you should just omit the defined()?)
########
# op.c
@@ -1031,7 +1025,6 @@ Useless localization of match position at - line 49.
Useless localization of vec at - line 50.
########
# op.c
-use warnings 'deprecated';
my $x1 if 0;
my @x2 if 0;
my %x3 if 0;
@@ -1047,13 +1040,13 @@ if (my $w2) { $a=1 }
if ($a && (my $w3 = 1)) {$a = 2}
EXPECT
+Deprecated use of my() in false conditional at - line 2.
Deprecated use of my() in false conditional at - line 3.
Deprecated use of my() in false conditional at - line 4.
Deprecated use of my() in false conditional at - line 5.
Deprecated use of my() in false conditional at - line 6.
Deprecated use of my() in false conditional at - line 7.
Deprecated use of my() in false conditional at - line 8.
-Deprecated use of my() in false conditional at - line 9.
########
# op.c
$[ = 1;
@@ -1062,4 +1055,5 @@ $[ = 2;
no warnings 'deprecated';
$[ = 3;
EXPECT
+Use of assignment to $[ is deprecated at - line 2.
Use of assignment to $[ is deprecated at - line 4.
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index e5ca40002e..a7ef0f8973 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -125,7 +125,6 @@ toke.c AOK
__END__
# toke.c
-use warnings 'deprecated' ;
format STDOUT =
@<<< @||| @>>> @>>>
$a $b "abc" 'def'
@@ -136,19 +135,18 @@ format STDOUT =
$a $b "abc" 'def'
.
EXPECT
-Use of comma-less variable list is deprecated at - line 5.
-Use of comma-less variable list is deprecated at - line 5.
-Use of comma-less variable list is deprecated at - line 5.
+Use of comma-less variable list is deprecated at - line 4.
+Use of comma-less variable list is deprecated at - line 4.
+Use of comma-less variable list is deprecated at - line 4.
########
# toke.c
-use warnings 'deprecated' ;
$a = <<;
no warnings 'deprecated' ;
$a = <<;
EXPECT
-Use of bare << to mean <<"" is deprecated at - line 3.
+Use of bare << to mean <<"" is deprecated at - line 2.
########
# toke.c
use warnings 'syntax' ;
@@ -853,7 +851,7 @@ sub glipp :locked {
}
sub whack_eth ($) : locked {
}
-use warnings 'deprecated';
+no warnings 'deprecated';
our $bar :unique;
sub zapeth :locked;
sub ker_plop :locked {
@@ -861,10 +859,10 @@ sub ker_plop :locked {
sub swa_a_p ($) : locked {
}
EXPECT
-Use of :unique is deprecated at - line 9.
-Use of :locked is deprecated at - line 10.
-Use of :locked is deprecated at - line 11.
-Use of :locked is deprecated at - line 13.
+Use of :unique is deprecated at - line 2.
+Use of :locked is deprecated at - line 3.
+Use of :locked is deprecated at - line 4.
+Use of :locked is deprecated at - line 6.
########
# toke.c
use warnings "syntax";