summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-19 05:44:20 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-19 05:44:20 +0000
commit34d09196f6a006314d7ea49a091a30ce5ee08bff (patch)
treeb65cd7762db1fdf88369274697efeec8fd03d22c
parente28598cb7aa92733a853cea0cf64bb1d19ec6745 (diff)
downloadperl-34d09196f6a006314d7ea49a091a30ce5ee08bff.tar.gz
rename "Probable precendence problem" diagnostic to "Bareword found
in conditional" to better reflect the class of error (as suggested by Larry) p4raw-id: //depot/perl@5131
-rw-r--r--op.c3
-rw-r--r--pod/perldelta.pod24
-rw-r--r--pod/perldiag.pod24
-rw-r--r--t/pragma/warn/op4
4 files changed, 43 insertions, 12 deletions
diff --git a/op.c b/op.c
index 430b11c171..a9872c2c5b 100644
--- a/op.c
+++ b/op.c
@@ -3515,8 +3515,7 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
}
if (first->op_type == OP_CONST) {
if (ckWARN(WARN_PRECEDENCE) && (first->op_private & OPpCONST_BARE))
- Perl_warner(aTHX_ WARN_PRECEDENCE, "Probable precedence problem on %s",
- PL_op_desc[type]);
+ Perl_warner(aTHX_ WARN_PRECEDENCE, "Bareword found in conditional");
if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) {
op_free(first);
*firstp = Nullop;
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 46dd6564e4..3a2c296c91 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -1903,6 +1903,22 @@ most likely an unexpected right brace '}'.
malloc()ed in the first place. Mandatory, but can be disabled by
setting environment variable C<PERL_BADFREE> to 1.
+=item Bareword found in conditional
+
+(W) The compiler found a bareword where it expected a conditional,
+which often indicates that an || or && was parsed as part of the
+last argument of the previous construct, for example:
+
+ open FOO || die;
+
+It may also indicate a misspelled constant that has been interpreted
+as a bareword:
+
+ use constant TYPO => 1;
+ if (TYOP) { print "foo" }
+
+The C<strict> pragma is useful in avoiding such errors.
+
=item Binary number > 0b11111111111111111111111111111111 non-portable
(W) The binary number you specified is larger than 2**32-1
@@ -2362,6 +2378,14 @@ appear in %ENV. This may be a benign occurrence, as some software packages
might directly modify logical name tables and introduce nonstandard names,
or it may indicate that a logical name table has been corrupted.
+=item Probable precedence problem on %s
+
+(W) The compiler found a bareword where it expected a conditional,
+which often indicates that an || or && was parsed as part of the
+last argument of the previous construct, for example:
+
+ open FOO || die;
+
=item regexp too big
(F) The current implementation of regular expressions uses shorts as
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 39112035fb..d87d08512c 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -509,6 +509,22 @@ Perhaps you need to predeclare a subroutine?
the compiler saw no other uses of that namespace before that point.
Perhaps you need to predeclare a package?
+=item Bareword found in conditional
+
+(W) The compiler found a bareword where it expected a conditional,
+which often indicates that an || or && was parsed as part of the
+last argument of the previous construct, for example:
+
+ open FOO || die;
+
+It may also indicate a misspelled constant that has been interpreted
+as a bareword:
+
+ use constant TYPO => 1;
+ if (TYOP) { print "foo" }
+
+The C<strict> pragma is useful in avoiding such errors.
+
=item BEGIN failed--compilation aborted
(F) An untrapped exception was raised while executing a BEGIN subroutine.
@@ -2522,14 +2538,6 @@ Check your logic flow.
(W) The filehandle you're writing to got itself closed sometime before now.
Check your logic flow.
-=item Probable precedence problem on %s
-
-(W) The compiler found a bareword where it expected a conditional,
-which often indicates that an || or && was parsed as part of the
-last argument of the previous construct, for example:
-
- open FOO || die;
-
=item Prototype mismatch: %s vs %s
(S) The subroutine being declared or defined had previously been declared
diff --git a/t/pragma/warn/op b/t/pragma/warn/op
index 9a278effe9..9fd418e5bc 100644
--- a/t/pragma/warn/op
+++ b/t/pragma/warn/op
@@ -58,7 +58,7 @@
Parentheses missing around "local" list at -e line 1.
local $a, $b = (1,2);
- Probable precedence problem on logical or at -e line 1.
+ Bareword found in conditional at -e line 1.
use warnings 'syntax'; my $x = print(ABC || 1);
Value of %s may be \"0\"; use \"defined\"
@@ -627,7 +627,7 @@ print (ABC || 1) ;
no warnings 'syntax' ;
print (ABC || 1) ;
EXPECT
-Probable precedence problem on logical or (||) at - line 3.
+Bareword found in conditional at - line 3.
########
--FILE-- abc