From f2c1e21ad3d6f8b31278541f907213a0ba208a08 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 5 Feb 2022 15:04:29 +0100 Subject: [PATCH] Allow unnamed parallel block with only variable declarations While it is not a particular useful construct it is legal to have a parallel block with just variable declarations and no statements. E.g. ``` fork int x; join ``` At the moment there is a special rule for completely empty parallel blocks. Remove that rule and change the statement_or_null_list in the fork/join parser section to a statement_or_null_list_opt. This way it covers both completely empty parallel blocks as well as parallel blocks with only variable declarations. Note that this already works as expected for named parallel blocks. Signed-off-by: Lars-Peter Clausen --- parse.y | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/parse.y b/parse.y index ca4aa26cb..977cfa3de 100644 --- a/parse.y +++ b/parse.y @@ -6652,11 +6652,6 @@ statement_item /* This is roughly statement_item in the LRM */ need to do is remember that this is a parallel block so that the code generator can do the right thing. */ - | K_fork join_keyword - { PBlock*tmp = new PBlock($2); - FILE_NAME(tmp, @1); - $$ = tmp; - } /* In SystemVerilog an unnamed block can contain variable declarations. */ | K_fork { PBlock*tmp = pform_push_block_scope(@1, 0, PBlock::BL_PAR); @@ -6677,7 +6672,7 @@ statement_item /* This is roughly statement_item in the LRM */ delete tmp; } } - statement_or_null_list join_keyword + statement_or_null_list_opt join_keyword { PBlock*tmp; if ($3) { pform_pop_scope();