From: Gurusamy Sarathy Date: Sat, 19 Feb 2000 05:44:20 +0000 (+0000) Subject: rename "Probable precendence problem" diagnostic to "Bareword found X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=34d09196f6a006314d7ea49a091a30ce5ee08bff;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/op.c b/op.c index 430b11c..a9872c2 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 46dd656..3a2c296 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 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 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 3911203..d87d085 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 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 9a278ef..9fd418e 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