mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/no-switch-fallthrough'
* origin/topic/jsiwek/no-switch-fallthrough: Add "fallthrough" keyword, require a flow statement to end case blocks. Disable automatic case fallthrough in switch stmts. Addresses #754. I've added a test for the error case where no break/fallthrough/return is given. Closes #754.
This commit is contained in:
commit
dcd675280e
10 changed files with 154 additions and 27 deletions
|
@ -16,6 +16,7 @@ typedef enum {
|
|||
STMT_ADD, STMT_DELETE,
|
||||
STMT_LIST, STMT_EVENT_BODY_LIST,
|
||||
STMT_INIT,
|
||||
STMT_FALLTHROUGH,
|
||||
STMT_NULL
|
||||
#define NUM_STMTS (int(STMT_NULL) + 1)
|
||||
} BroStmtTag;
|
||||
|
@ -24,7 +25,8 @@ typedef enum {
|
|||
FLOW_NEXT, // continue on to next statement
|
||||
FLOW_LOOP, // go to top of loop
|
||||
FLOW_BREAK, // break out of loop
|
||||
FLOW_RETURN // return from function
|
||||
FLOW_RETURN, // return from function
|
||||
FLOW_FALLTHROUGH // fall through to next switch case
|
||||
} stmt_flow_type;
|
||||
|
||||
extern const char* stmt_name(BroStmtTag t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue