Fix print token/argument mismatches and other cppcheck fixes

This commit is contained in:
Cary R 2013-09-09 13:32:55 -07:00
parent 7d6d93e4e2
commit 07cc18284c
14 changed files with 30 additions and 30 deletions

View File

@ -1,3 +1,3 @@
// These are correct and are used to find the base (zero) pin. // These are correct and are used to find the base (zero) pin.
thisSubtraction:netlist.h:4545 thisSubtraction:netlist.h:4589
thisSubtraction:netlist.h:4554 thisSubtraction:netlist.h:4598

View File

@ -900,7 +900,7 @@ NetAssign_* PEIdent::elaborate_lval_net_class_member_(Design*des, NetScope*scope
const netdarray_t*mtype = dynamic_cast<const netdarray_t*> (ptype); const netdarray_t*mtype = dynamic_cast<const netdarray_t*> (ptype);
if (mtype) { if (mtype) {
const name_component_t&name_tail = path_.back(); const name_component_t&name_tail = path_.back();
if (name_tail.index.size() > 0) { if (! name_tail.index.empty()) {
cerr << get_fileline() << ": sorry: " cerr << get_fileline() << ": sorry: "
<< "Array index of array properties not supported." << "Array index of array properties not supported."
<< endl; << endl;

View File

@ -635,14 +635,14 @@ TU [munpf]
|GN_KEYWORDS_1364_2005 |GN_KEYWORDS_1364_2005
|GN_KEYWORDS_VAMS_2_3; |GN_KEYWORDS_VAMS_2_3;
} else { } else {
fprintf(stderr, "%s:%d: Ignoring unknown keywords string: %s\n", fprintf(stderr, "%s:%u: Ignoring unknown keywords string: %s\n",
yylloc.text, yylloc.first_line, word); yylloc.text, yylloc.first_line, word);
} }
BEGIN(0); BEGIN(0);
} }
<PPBEGIN_KEYWORDS>.* { <PPBEGIN_KEYWORDS>.* {
fprintf(stderr, "%s:%d: Malformed keywords specification: %s\n", fprintf(stderr, "%s:%u: Malformed keywords specification: %s\n",
yylloc.text, yylloc.first_line, yytext); yylloc.text, yylloc.first_line, yytext);
BEGIN(0); BEGIN(0);
} }
@ -652,7 +652,7 @@ TU [munpf]
lexor_keyword_mask = keyword_mask_stack.front(); lexor_keyword_mask = keyword_mask_stack.front();
keyword_mask_stack.pop_front(); keyword_mask_stack.pop_front();
} else { } else {
fprintf(stderr, "%s:%d: Mismatched end_keywords directive\n", fprintf(stderr, "%s:%u: Mismatched end_keywords directive\n",
yylloc.text, yylloc.first_line); yylloc.text, yylloc.first_line);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-1999 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -51,7 +51,7 @@ void VLerror(const YYLTYPE&loc, const char*msg, ...)
va_list ap; va_list ap;
va_start(ap, msg); va_start(ap, msg);
fprintf(stderr, "%s:%d: ", loc.text, loc.first_line); fprintf(stderr, "%s:%u: ", loc.text, loc.first_line);
vfprintf(stderr, msg, ap); vfprintf(stderr, msg, ap);
fprintf(stderr, "\n"); fprintf(stderr, "\n");

View File

@ -1278,7 +1278,7 @@ void pform_endgenerate()
// must be changed to match. // must be changed to match.
if (pform_cur_generate->scope_name == 0) { if (pform_cur_generate->scope_name == 0) {
char tmp[16]; char tmp[16];
snprintf(tmp, sizeof tmp, "$gen%d", pform_cur_generate->id_number); snprintf(tmp, sizeof tmp, "$gen%u", pform_cur_generate->id_number);
pform_cur_generate->scope_name = lex_strings.make(tmp); pform_cur_generate->scope_name = lex_strings.make(tmp);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2013 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -50,7 +50,7 @@ void pform_class_property(const struct vlltype&loc,
decl_assignment_t*curp = *cur; decl_assignment_t*curp = *cur;
data_type_t*use_type = data_type; data_type_t*use_type = data_type;
if (curp->index.size() > 0) { if (! curp->index.empty()) {
list<pform_range_t>*pd = new list<pform_range_t> (curp->index); list<pform_range_t>*pd = new list<pform_range_t> (curp->index);
use_type = new uarray_type_t(use_type, pd); use_type = new uarray_type_t(use_type, pd);
} }

View File

@ -491,7 +491,7 @@ ivl_parameter_t dll_target::scope_find_param(ivl_scope_t scope,
*/ */
void dll_target::make_scope_parameters(ivl_scope_t scop, const NetScope*net) void dll_target::make_scope_parameters(ivl_scope_t scop, const NetScope*net)
{ {
if (net->parameters.size() == 0) { if (net->parameters.empty()) {
scop->param.clear(); scop->param.clear();
return; return;
} }

View File

@ -164,7 +164,7 @@ void errormsg(const YYLTYPE&loc, const char*fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
fprintf(stderr, "%s:%d: error: ", parse_file_path.c_str(), loc.first_line); fprintf(stderr, "%s:%u: error: ", parse_file_path.c_str(), loc.first_line);
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
parse_fp_errors += 1; parse_fp_errors += 1;
@ -175,7 +175,7 @@ void sorrymsg(const YYLTYPE&loc, const char*fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
fprintf(stderr, "%s:%d: sorry: ", parse_file_path.c_str(), loc.first_line); fprintf(stderr, "%s:%u: sorry: ", parse_file_path.c_str(), loc.first_line);
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
parse_fp_sorrys += 1; parse_fp_sorrys += 1;

View File

@ -2409,7 +2409,7 @@ static void draw_signal_dest(ivl_expr_t expr, struct vector_info res,
const char*sign_flag = (add_index>0)? "/s" : ""; const char*sign_flag = (add_index>0)? "/s" : "";
/* Add an immediate value to an array value. */ /* Add an immediate value to an array value. */
fprintf(vvp_out, " %%ix/load 0, %lu, 0;\n", immediate); fprintf(vvp_out, " %%ix/load 0, %ld, 0;\n", immediate);
fprintf(vvp_out, " %%load/avp0%s %u, v%p, %u;\n", fprintf(vvp_out, " %%load/avp0%s %u, v%p, %u;\n",
sign_flag, res.base, sig, res.wid); sign_flag, res.base, sig, res.wid);
} }
@ -2428,7 +2428,7 @@ static void draw_signal_dest(ivl_expr_t expr, struct vector_info res,
/* If this is a REG (a variable) then I can do a vector read. */ /* If this is a REG (a variable) then I can do a vector read. */
if (immediate >= 0) { if (immediate >= 0) {
fprintf(vvp_out, " %%ix/load 0, %lu, 0;\n", immediate); fprintf(vvp_out, " %%ix/load 0, %ld, 0;\n", immediate);
} else { } else {
fprintf(vvp_out, " %%ix/load 0, 0, 0; immediate=%ld\n", immediate); fprintf(vvp_out, " %%ix/load 0, 0, 0; immediate=%ld\n", immediate);
fprintf(vvp_out, " %%ix/sub 0, %ld, 0;\n", -immediate); fprintf(vvp_out, " %%ix/sub 0, %ld, 0;\n", -immediate);
@ -3508,16 +3508,16 @@ static struct vector_info draw_unary_expr(ivl_expr_t expr, unsigned wid)
result a 1. */ result a 1. */
if (res.base == 1) { if (res.base == 1) {
res.base = allocate_vector(wid); res.base = allocate_vector(wid);
fprintf(vvp_out, " %%movi %d, 1, %u;\n", fprintf(vvp_out, " %%movi %u, 1, %u;\n",
res.base, res.wid); res.base, res.wid);
break; break;
} }
fprintf(vvp_out, " %%cmpi/s %d, 0, %u;\n", res.base, res.wid); fprintf(vvp_out, " %%cmpi/s %u, 0, %u;\n", res.base, res.wid);
fprintf(vvp_out, " %%jmp/0xz T_%u.%u, 5;\n", thread_count, fprintf(vvp_out, " %%jmp/0xz T_%u.%u, 5;\n", thread_count,
local_count); local_count);
fprintf(vvp_out, " %%inv %d, %u;\n", res.base, res.wid); fprintf(vvp_out, " %%inv %u, %u;\n", res.base, res.wid);
fprintf(vvp_out, " %%addi %d, 1, %u;\n", res.base, res.wid); fprintf(vvp_out, " %%addi %u, 1, %u;\n", res.base, res.wid);
fprintf(vvp_out, "T_%u.%u ;\n", thread_count, local_count); fprintf(vvp_out, "T_%u.%u ;\n", thread_count, local_count);
local_count += 1; local_count += 1;
break; break;
@ -3539,14 +3539,14 @@ static struct vector_info draw_unary_expr(ivl_expr_t expr, unsigned wid)
break; break;
} }
fprintf(vvp_out, " %%cast2 %d, %d, %u;\n", res.base, res.base, res.wid); fprintf(vvp_out, " %%cast2 %u, %u, %u;\n", res.base, res.base, res.wid);
break; break;
case IVL_VT_REAL: case IVL_VT_REAL:
draw_eval_real(sub); draw_eval_real(sub);
res.base = allocate_vector(wid); res.base = allocate_vector(wid);
res.wid = wid; res.wid = wid;
fprintf(vvp_out, " %%cvt/vr %d, %u;\n", res.base, wid); fprintf(vvp_out, " %%cvt/vr %u, %u;\n", res.base, wid);
break; break;
default: default:

View File

@ -720,7 +720,7 @@ static int show_stmt_assign_sig_real(ivl_statement_t net)
!number_is_unknown(word_ex)) { !number_is_unknown(word_ex)) {
unsigned long use_word = get_number_immediate(word_ex); unsigned long use_word = get_number_immediate(word_ex);
assert(use_word < ivl_signal_array_count(var)); assert(use_word < ivl_signal_array_count(var));
fprintf(vvp_out, " %%ix/load %u, %lu, 0;\n", fprintf(vvp_out, " %%ix/load %d, %lu, 0;\n",
word_ix, use_word); word_ix, use_word);
fprintf(vvp_out, " %%store/reala v%p, %d;\n", fprintf(vvp_out, " %%store/reala v%p, %d;\n",
var, word_ix); var, word_ix);

View File

@ -1035,10 +1035,10 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s signal to a ", fprintf(stderr, "%s:%u: tgt-vvp sorry: cannot %s signal to a ",
ivl_stmt_file(net), ivl_stmt_lineno(net), command_name); ivl_stmt_file(net), ivl_stmt_lineno(net), command_name);
if (use_wid > 1) { if (use_wid > 1) {
fprintf(stderr, "part select (%s[%lu:%lu]).\n", fprintf(stderr, "part select (%s[%ld:%ld]).\n",
ivl_signal_basename(lsig), use_msb, use_lsb); ivl_signal_basename(lsig), use_msb, use_lsb);
} else { } else {
fprintf(stderr, "bit select (%s[%lu]).\n", fprintf(stderr, "bit select (%s[%ld]).\n",
ivl_signal_basename(lsig), use_lsb); ivl_signal_basename(lsig), use_lsb);
} }
vvp_errors += 1; vvp_errors += 1;

View File

@ -2458,7 +2458,7 @@ void errormsg(const YYLTYPE&loc, const char*fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
fprintf(stderr, "%s:%d: error: ", loc.text, loc.first_line); fprintf(stderr, "%s:%u: error: ", loc.text, loc.first_line);
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
parse_errors += 1; parse_errors += 1;
@ -2469,7 +2469,7 @@ void sorrymsg(const YYLTYPE&loc, const char*fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
fprintf(stderr, "%s:%d: sorry: ", loc.text, loc.first_line); fprintf(stderr, "%s:%u: sorry: ", loc.text, loc.first_line);
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
va_end(ap); va_end(ap);
parse_sorrys += 1; parse_sorrys += 1;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2011 Cary R. (cygcary@yahoo.com) * Copyright (C) 2011-2013 Cary R. (cygcary@yahoo.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -549,7 +549,7 @@ static void dump_diag_info(vpiHandle callh, p_table_mod table)
dump_extrap(table->control.info.extrap_low[idx]); dump_extrap(table->control.info.extrap_low[idx]);
dump_extrap(table->control.info.extrap_high[idx]); dump_extrap(table->control.info.extrap_high[idx]);
} }
fprintf(stderr, ";%d\n", table->depend); fprintf(stderr, ";%u\n", table->depend);
fprintf(stderr, "%*s The data file must have at least %u columns.\n", fprintf(stderr, "%*s The data file must have at least %u columns.\n",
(int) strlen(msg), " ", table->fields+table->depend); (int) strlen(msg), " ", table->fields+table->depend);
} }

View File

@ -852,7 +852,7 @@ void vvp_arith_real_::dispatch_operand_(vvp_net_ptr_t ptr, double bit)
op_b_ = bit; op_b_ = bit;
break; break;
default: default:
fprintf(stderr, "Unsupported port type %d.\n", ptr.port()); fprintf(stderr, "Unsupported port type %u.\n", ptr.port());
assert(0); assert(0);
} }
} }