diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-03 22:56:37 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-04 23:54:33 -0800 |
commit | 7c2b3c783b7cfdd1c2c7d51e431850e6b2be74ae (patch) | |
tree | 74ced0bebb52d150d36cb23cd047206599ec0a1a /op.c | |
parent | 5ea6993dc3abe359587df7b497c38e981f4695cd (diff) | |
download | perl-7c2b3c783b7cfdd1c2c7d51e431850e6b2be74ae.tar.gz |
Restrict $[ comp warning to constants
$#a > $[ is a legitimate use of $[ with >. So warning in that case
is not nice. Most version comparisons are done with constants, like
5.006, so warn only for constants.
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -7320,8 +7320,12 @@ Perl_ck_cmp(pTHX_ OP *o) if (ckWARN(WARN_SYNTAX)) { const OP *kid = cUNOPo->op_first; if (kid && ( - is_dollar_bracket(aTHX_ kid) - || ((kid = kid->op_sibling) && is_dollar_bracket(aTHX_ kid)) + ( + is_dollar_bracket(aTHX_ kid) + && kid->op_sibling && kid->op_sibling->op_type == OP_CONST + ) + || ( kid->op_type == OP_CONST + && (kid = kid->op_sibling) && is_dollar_bracket(aTHX_ kid)) )) Perl_warner(aTHX_ packWARN(WARN_SYNTAX), "$[ used in %s (did you mean $] ?)", OP_DESC(o)); |