Check for a possible corrupt function definition and return.

If a function definition has no ports and no return type it is
assumed to be a bad definition so we don't check it further.
This commit is contained in:
Cary R 2008-08-08 16:34:24 -07:00 committed by Stephen Williams
parent 5aecd044c5
commit f835c7569e
1 changed files with 11 additions and 3 deletions

View File

@ -589,9 +589,17 @@ void PFunction::elaborate_sig(Design*des, NetScope*scope) const
break;
default:
cerr << get_fileline() << ": internal error: I don't know how "
<< "to deal with return type of function "
<< scope->basename() << "." << endl;
if (ports_) {
cerr << get_fileline() << ": internal error: I don't know "
<< "how to deal with return type of function "
<< scope->basename() << "." << endl;
} else {
/* If we do not have any ports or a return type this
* is probably a bad function definition. */
cerr << get_fileline() << ": error: Bad definition for "
<< "function " << scope->basename() << "?" << endl;
return;
}
}
svector<NetNet*>ports (ports_? ports_->count() : 0);