Add support for empty task port lists with a warning.

The standard does not allow this, but it appears that other
simulators do. This patch adds the functionality, but prints
a warning message for the invalid task definition.
(cherry picked from commit 46350da5f0)
This commit is contained in:
Cary R 2009-04-03 18:55:48 -07:00 committed by Stephen Williams
parent cca3d5907c
commit fc24624fa2
1 changed files with 20 additions and 2 deletions

22
parse.y
View File

@ -2137,12 +2137,12 @@ module_item
delete[]$3;
}
| K_task automatic_opt IDENTIFIER
| K_task automatic_opt IDENTIFIER '('
{ assert(current_task == 0);
current_task = pform_push_task_scope($3, $2);
FILE_NAME(current_task, @1);
}
'(' task_port_decl_list ')' ';'
task_port_decl_list ')' ';'
block_item_decls_opt
statement_or_null
K_endtask
@ -2152,6 +2152,24 @@ module_item
current_task = 0;
delete[]$3;
}
| K_task automatic_opt IDENTIFIER '(' ')' ';'
{ assert(current_task == 0);
current_task = pform_push_task_scope($3, $2);
FILE_NAME(current_task, @1);
}
block_item_decls_opt
statement_or_null
K_endtask
{ current_task->set_ports(0);
current_task->set_statement($9);
pform_pop_scope();
current_task = 0;
cerr << @3 << ": warning: task definition for \"" << $3
<< "\" has an empty port declaration list!" << endl;
delete[]$3;
}
| K_task automatic_opt IDENTIFIER error K_endtask
{
pform_pop_scope();