Remove some cppcheck warnings about variable scope.

There were a couple variable that could have reduced scope.
This commit is contained in:
Cary R 2011-01-17 17:42:45 -08:00 committed by Stephen Williams
parent 203a8cc997
commit 5cec7e3870
3 changed files with 6 additions and 5 deletions

View File

@ -247,9 +247,10 @@ static void emit_expr_select(ivl_scope_t scope, ivl_expr_t expr, unsigned wid)
*/
static void emit_expr_func(ivl_scope_t scope, ivl_expr_t expr, const char* name)
{
unsigned idx, count = ivl_expr_parms(expr);
unsigned count = ivl_expr_parms(expr);
fprintf(vlog_out, "%s", name);
if (count != 0) {
unsigned idx;
fprintf(vlog_out, "(");
count -= 1;
for (idx = 0; idx < count; idx += 1) {

View File

@ -89,11 +89,10 @@ void emit_scaled_delayx(ivl_scope_t scope, ivl_expr_t expr)
emit_scaled_delay(scope, value);
} else {
int exp = ivl_scope_time_units(scope) - sim_precision;
uint64_t scale = 1;
assert(exp >= 0);
if (exp == 0) emit_expr(scope, expr, 0);
else {
uint64_t scale_val;
uint64_t scale_val, scale = 1;
int rtype;
/* This is as easy as removing the multiple that was
* added to scale the value to the simulation time,

View File

@ -111,10 +111,10 @@ static void emit_stmt_lval_piece(ivl_scope_t scope, ivl_lval_t lval)
static unsigned emit_stmt_lval(ivl_scope_t scope, ivl_statement_t stmt)
{
unsigned idx;
unsigned count = ivl_stmt_lvals(stmt);
unsigned wid = 0;
if (count > 1) {
unsigned idx;
ivl_lval_t lval = ivl_stmt_lval(stmt, 0);
wid += ivl_lval_width(lval);
fprintf(vlog_out, "{");
@ -399,9 +399,10 @@ static void emit_stmt_repeat(ivl_scope_t scope, ivl_statement_t stmt)
static void emit_stmt_stask(ivl_scope_t scope, ivl_statement_t stmt)
{
unsigned idx, count = ivl_stmt_parm_count(stmt);
unsigned count = ivl_stmt_parm_count(stmt);
fprintf(vlog_out, "%*c%s", get_indent(), ' ', ivl_stmt_name(stmt));
if (count != 0) {
unsigned idx;
fprintf(vlog_out, "(");
count -= 1;
for (idx = 0; idx < count; idx += 1) {