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 <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-02-05 15:04:29 +01:00
parent 922a2e0e13
commit f2c1e21ad3
1 changed files with 1 additions and 6 deletions

View File

@ -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();