Merge remote-tracking branch 'origin/topic/awelzel/next-break-no-error-but-warning'

* origin/topic/awelzel/next-break-no-error-but-warning:
  ScriptValidation: Make break/next a warning until Zeek 6.1
This commit is contained in:
Arne Welzel 2023-03-10 09:05:03 +01:00
commit 16bdcd27bd
13 changed files with 25 additions and 16 deletions

View file

@ -1,3 +1,10 @@
6.0.0-dev.169 | 2023-03-10 09:05:03 +0100
* ScriptValidation: Make break/next a warning until Zeek 6.1 (Arne Welzel, Corelight)
The ja3 package uses next instead of return and triggers the new
errors with Zeek 5.2. That seems somewhat bad.
6.0.0-dev.167 | 2023-03-08 13:21:36 +0100
* Bump Spicy to latest main (Arne Welzel, Corelight)

View file

@ -1 +1 @@
6.0.0-dev.167
6.0.0-dev.169

View file

@ -22,15 +22,17 @@ public:
if ( stmt->Tag() == STMT_BREAK && ! BreakStmtIsValid() )
{
zeek::reporter->PushLocation(stmt->GetLocationInfo());
zeek::reporter->Error("break statement used outside of for, while or "
"switch statement and not within a hook");
zeek::reporter->Warning("break statement used outside of for, while or "
"switch statement and not within a hook. "
"With v6.1 this will become an error.");
zeek::reporter->PopLocation();
}
if ( stmt->Tag() == STMT_NEXT && ! NextStmtIsValid() )
{
zeek::reporter->PushLocation(stmt->GetLocationInfo());
zeek::reporter->Error("next statement used outside of for or while statement");
zeek::reporter->Warning("next statement used outside of for or while statement. "
"With v6.1 this will become an error.");
zeek::reporter->PopLocation();
}

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 3: break statement used outside of for, while or switch statement and not within a hook
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.

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 3: next statement used outside of for or while statement
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.

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 3: break statement used outside of for, while or switch statement and not within a hook
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.

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 4: break statement used outside of for, while or switch statement and not within a hook
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.

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 7: next statement used outside of for or while statement
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.

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 5: next statement used outside of for or while statement
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.

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 6: next statement used outside of for or while statement
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.

View file

@ -1,4 +1,4 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 6: next statement used outside of for or while statement
error in <...>/next-break-context-errors.zeek, line 11: break statement used outside of for, while or switch statement and not within a hook
error in <...>/next-break-context-errors.zeek, line 16: next statement used outside of for or while statement
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.
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.
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.

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in <...>/next-break-context-errors.zeek, line 7: next statement used outside of for or while statement
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.

View file

@ -1,6 +1,6 @@
# @TEST-DOC: Check break and next usage within for, while, switch and hooks.
# @TEST-EXEC-FAIL: zeek -b %INPUT
# @TEST-EXEC: zeek -b %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
function f()
{