From fc24624fa2e90543afe10ac1eccdbc22cb043667 Mon Sep 17 00:00:00 2001 From: Cary R Date: Fri, 3 Apr 2009 18:55:48 -0700 Subject: [PATCH] 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 46350da5f0f3c623cb9fe05003d7e2b8506d14a7) --- parse.y | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/parse.y b/parse.y index 1f9ac0d11..ec9c9169c 100644 --- a/parse.y +++ b/parse.y @@ -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();