mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Make break/next/continue outside loops an error (6.1 deprecation)
This commit is contained in:
parent
9a79b98a1e
commit
0110c15ee2
11 changed files with 15 additions and 17 deletions
|
@ -22,13 +22,11 @@ public:
|
||||||
stmt_depths[stmt->Tag()] += 1;
|
stmt_depths[stmt->Tag()] += 1;
|
||||||
|
|
||||||
if ( stmt->Tag() == STMT_BREAK && ! BreakStmtIsValid() )
|
if ( stmt->Tag() == STMT_BREAK && ! BreakStmtIsValid() )
|
||||||
Report(stmt, "break statement used outside of for, while or "
|
Error(stmt, "break statement used outside of for, while or "
|
||||||
"switch statement and not within a hook. "
|
"switch statement and not within a hook.");
|
||||||
"With v6.1 this will become an error.");
|
|
||||||
|
|
||||||
if ( stmt->Tag() == STMT_NEXT && ! NextStmtIsValid() )
|
if ( stmt->Tag() == STMT_NEXT && ! NextStmtIsValid() )
|
||||||
Report(stmt, "next statement used outside of for or while statement. "
|
Error(stmt, "next statement used outside of for or while statement.");
|
||||||
"With v6.1 this will become an error.");
|
|
||||||
|
|
||||||
return TC_CONTINUE;
|
return TC_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 3: break statement used outside of for, while or switch statement and not within a hook. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 3: break statement used outside of for, while or switch statement and not within a hook. (break )
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 3: next statement used outside of for or while statement. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 3: next statement used outside of for or while statement. (next )
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 3: break statement used outside of for, while or switch statement and not within a hook. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 3: break statement used outside of for, while or switch statement and not within a hook. (break )
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 4: break statement used outside of for, while or switch statement and not within a hook. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 4: break statement used outside of for, while or switch statement and not within a hook. (break )
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 7: next statement used outside of for or while statement. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 7: next statement used outside of for or while statement. (next )
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 5: next statement used outside of for or while statement. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 5: next statement used outside of for or while statement. (next )
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 6: next statement used outside of for or while statement. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 6: next statement used outside of for or while statement. (next )
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 6: next statement used outside of for or while statement. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 6: next statement used outside of for or while statement. (next )
|
||||||
warning in <...>/next-break-context-errors.zeek, line 11: break statement used outside of for, while or switch statement and not within a hook. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 11: break statement used outside of for, while or switch statement and not within a hook. (break )
|
||||||
warning in <...>/next-break-context-errors.zeek, line 16: next statement used outside of for or while statement. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 16: next statement used outside of for or while statement. (next )
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||||
warning in <...>/next-break-context-errors.zeek, line 7: next statement used outside of for or while statement. With v6.1 this will become an error.
|
error in <...>/next-break-context-errors.zeek, line 7: next statement used outside of for or while statement. (next )
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# @TEST-DOC: Check break and next usage within for, while, switch and hooks.
|
# @TEST-DOC: Check break and next usage within for, while, switch and hooks.
|
||||||
|
|
||||||
# @TEST-EXEC: zeek -b %INPUT
|
# @TEST-EXEC-FAIL: zeek -b %INPUT
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||||
function f()
|
function f()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue