v0_8: warn about unused variable in for loop.

This patch back ports from the development branch a warning when
an undefined variable is used in a for loop.
This commit is contained in:
Cary R 2007-10-26 16:46:04 -07:00 committed by Stephen Williams
parent 2946f30ffc
commit 043b7ae684
1 changed files with 7 additions and 0 deletions

View File

@ -2356,6 +2356,13 @@ NetProc* PForStatement::elaborate(Design*des, NetScope*scope) const
the for loop. This is also a very specific assignment
statement. Put this into the "body" block. */
sig = des->find_signal(scope, id2->path());
if (sig == 0) {
cerr << get_line() << ": error: Unable to find variable "
<< id2->path() << " in for-loop increment expression." << endl;
des->errors += 1;
return body;
}
assert(sig);
lv = new NetAssign_(sig);