Fix some cppcheck warnings (format string vs argument mismatches)
This commit is contained in:
parent
6a2956c672
commit
0a6d75f1db
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
%{
|
||||
/*
|
||||
* Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -652,14 +652,14 @@ TU [munpf]
|
|||
|GN_KEYWORDS_1364_2005
|
||||
|GN_KEYWORDS_VAMS_2_3;
|
||||
} else {
|
||||
fprintf(stderr, "%s:%u: Ignoring unknown keywords string: %s\n",
|
||||
fprintf(stderr, "%s:%d: Ignoring unknown keywords string: %s\n",
|
||||
yylloc.text, yylloc.first_line, word);
|
||||
}
|
||||
BEGIN(0);
|
||||
}
|
||||
|
||||
<PPBEGIN_KEYWORDS>.* {
|
||||
fprintf(stderr, "%s:%u: Malformed keywords specification: %s\n",
|
||||
fprintf(stderr, "%s:%d: Malformed keywords specification: %s\n",
|
||||
yylloc.text, yylloc.first_line, yytext);
|
||||
BEGIN(0);
|
||||
}
|
||||
|
|
@ -669,7 +669,7 @@ TU [munpf]
|
|||
lexor_keyword_mask = keyword_mask_stack.front();
|
||||
keyword_mask_stack.pop_front();
|
||||
} else {
|
||||
fprintf(stderr, "%s:%u: Mismatched end_keywords directive\n",
|
||||
fprintf(stderr, "%s:%d: Mismatched end_keywords directive\n",
|
||||
yylloc.text, yylloc.first_line);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998-2013 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1998-2014 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* 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_start(ap, msg);
|
||||
|
||||
fprintf(stderr, "%s:%u: ", loc.text, loc.first_line);
|
||||
fprintf(stderr, "%s:%d: ", loc.text, loc.first_line);
|
||||
vfprintf(stderr, msg, ap);
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ static void edif_show_logic(ivl_net_logic_t net)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "UNSUPPORT LOGIC TYPE: %u\n", ivl_logic_type(net));
|
||||
fprintf(stderr, "UNSUPPORT LOGIC TYPE: %d\n", ivl_logic_type(net));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ static void generic_show_logic(ivl_net_logic_t net)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "fpga.tgt: unknown logic type %u\n",
|
||||
fprintf(stderr, "fpga.tgt: unknown logic type %d\n",
|
||||
ivl_logic_type(net));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ static void lpm_logic(ivl_net_logic_t net)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "UNSUPPORTED LOGIC TYPE: %u\n",
|
||||
fprintf(stderr, "UNSUPPORTED LOGIC TYPE: %d\n",
|
||||
ivl_logic_type(net));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -148,7 +148,7 @@ static void show_gate_lpm(ivl_lpm_t net)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "fpga.tgt: unknown LPM type %u\n",
|
||||
fprintf(stderr, "fpga.tgt: unknown LPM type %d\n",
|
||||
ivl_lpm_type(net));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ void xilinx_logic(ivl_net_logic_t net)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "UNSUPPORTED LOGIC TYPE: %u\n",
|
||||
fprintf(stderr, "UNSUPPORTED LOGIC TYPE: %d\n",
|
||||
ivl_logic_type(net));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,4 +5,4 @@
|
|||
unusedFunction:null.c:50
|
||||
|
||||
// target_query()
|
||||
unusedFunction:null.c:56
|
||||
unusedFunction:null.c:57
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// are not used here.
|
||||
|
||||
// target_design()
|
||||
unusedFunction:stub.c:1731
|
||||
unusedFunction:stub.c:1770
|
||||
|
||||
// target_query()
|
||||
unusedFunction:stub.c:1795
|
||||
unusedFunction:stub.c:1834
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ static void show_lpm_abs(ivl_lpm_t net)
|
|||
}
|
||||
|
||||
if (width_of_nexus(nex) != width) {
|
||||
fprintf(out, " ERROR: D width (%d) is wrong\n",
|
||||
fprintf(out, " ERROR: D width (%u) is wrong\n",
|
||||
width_of_nexus(nex));
|
||||
stub_errors += 1;
|
||||
}
|
||||
|
|
@ -1656,7 +1656,7 @@ static int show_scope(ivl_scope_t net, void*x)
|
|||
fprintf(out, " class %s", ivl_scope_tname(net));
|
||||
break;
|
||||
default:
|
||||
fprintf(out, " type(%u) %s", ivl_scope_type(net),
|
||||
fprintf(out, " type(%d) %s", ivl_scope_type(net),
|
||||
ivl_scope_tname(net));
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1979,7 +1979,7 @@ void dump_nexus_information(ivl_scope_t scope, ivl_nexus_t nex)
|
|||
assert(! nlogic);
|
||||
assert(! sig);
|
||||
fprintf(stderr, "LPM: ");
|
||||
fprintf(stderr, "{%s:%d} ", ivl_lpm_file(lpm),
|
||||
fprintf(stderr, "{%s:%u} ", ivl_lpm_file(lpm),
|
||||
ivl_lpm_lineno(lpm));
|
||||
if (scope != lpm_scope) fprintf(stderr, "(%s) ",
|
||||
ivl_scope_name(lpm_scope));
|
||||
|
|
@ -2038,7 +2038,7 @@ void dump_nexus_information(ivl_scope_t scope, ivl_nexus_t nex)
|
|||
ivl_logic_t logic_type = ivl_logic_type(nlogic);
|
||||
assert(! sig);
|
||||
fprintf(stderr, "Logic: ");
|
||||
fprintf(stderr, "{%s:%d} ", ivl_logic_file(nlogic),
|
||||
fprintf(stderr, "{%s:%u} ", ivl_logic_file(nlogic),
|
||||
ivl_logic_lineno(nlogic));
|
||||
if (scope != logic_scope) {
|
||||
fprintf(stderr, "(%s) ", ivl_scope_name(logic_scope));
|
||||
|
|
@ -2100,7 +2100,7 @@ void dump_nexus_information(ivl_scope_t scope, ivl_nexus_t nex)
|
|||
fprintf(stderr, "\"");
|
||||
// HERE: Do we need to add support for an array word or is that an LPM.
|
||||
if (ivl_signal_local(sig)) fprintf(stderr, " {local}");
|
||||
else fprintf(stderr, " {%s:%d}", ivl_signal_file(sig),
|
||||
else fprintf(stderr, " {%s:%u}", ivl_signal_file(sig),
|
||||
ivl_signal_lineno(sig));
|
||||
switch (ivl_signal_port(sig)) {
|
||||
case IVL_SIP_INPUT: fprintf(stderr, " input"); break;
|
||||
|
|
|
|||
|
|
@ -3626,7 +3626,7 @@ struct vector_info draw_eval_expr_wid(ivl_expr_t expr, unsigned wid,
|
|||
default:
|
||||
case IVL_EX_NONE:
|
||||
fprintf(stderr, "%s:%u: vvp.tgt error: unhandled expr. type: "
|
||||
"%u at %s:%d\n", ivl_expr_file(expr), ivl_expr_lineno(expr),
|
||||
"%d at %s:%d\n", ivl_expr_file(expr), ivl_expr_lineno(expr),
|
||||
ivl_expr_type(expr), __FILE__, __LINE__);
|
||||
exit(1);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ int draw_eval_object(ivl_expr_t ex)
|
|||
return eval_object_ufunc(ex);
|
||||
|
||||
default:
|
||||
fprintf(vvp_out, "; ERROR: draw_eval_object: Invalid expression type %u\n", ivl_expr_type(ex));
|
||||
fprintf(vvp_out, "; ERROR: draw_eval_object: Invalid expression type %d\n", ivl_expr_type(ex));
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ static void assign_to_array_r_word(ivl_signal_t lsig, ivl_expr_t word_ix,
|
|||
/* This code is common to all the different types of array delays. */
|
||||
if (number_is_immediate(word_ix, IMM_WID, 0) &&
|
||||
!number_is_unknown(word_ix)) {
|
||||
fprintf(vvp_out, " %%ix/load %d, %lu, 0; address\n",
|
||||
fprintf(vvp_out, " %%ix/load %d, %ld, 0; address\n",
|
||||
word_ix_reg, get_number_immediate(word_ix));
|
||||
} else {
|
||||
/* Calculate array word index into index register 3 */
|
||||
|
|
@ -139,7 +139,7 @@ static void assign_to_array_word(ivl_signal_t lsig, ivl_expr_t word_ix,
|
|||
/* This code is common to all the different types of array delays. */
|
||||
if (number_is_immediate(word_ix, IMM_WID, 0) &&
|
||||
!number_is_unknown(word_ix)) {
|
||||
fprintf(vvp_out, " %%ix/load %d, %lu, 0; address\n", word_ix_reg,
|
||||
fprintf(vvp_out, " %%ix/load %d, %ld, 0; address\n", word_ix_reg,
|
||||
get_number_immediate(word_ix));
|
||||
} else {
|
||||
/* Calculate array word index into word index register */
|
||||
|
|
@ -379,7 +379,7 @@ void show_stmt_file_line(ivl_statement_t net, const char* desc)
|
|||
* should be reported/fixed. */
|
||||
unsigned lineno = ivl_stmt_lineno(net);
|
||||
assert(lineno);
|
||||
fprintf(vvp_out, " %%file_line %d %u \"%s\";\n",
|
||||
fprintf(vvp_out, " %%file_line %u %u \"%s\";\n",
|
||||
ivl_file_table_index(ivl_stmt_file(net)), lineno, desc);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -786,14 +786,14 @@ static void draw_udp_def(ivl_udp_t udp)
|
|||
|
||||
if (ivl_udp_sequ(udp))
|
||||
fprintf(vvp_out,
|
||||
"UDP_%s .udp/sequ \"%s\", %d, %u",
|
||||
"UDP_%s .udp/sequ \"%s\", %u, %u",
|
||||
vvp_mangle_id(ivl_udp_name(udp)),
|
||||
vvp_mangle_name(ivl_udp_name(udp)),
|
||||
ivl_udp_nin(udp),
|
||||
init );
|
||||
else
|
||||
fprintf(vvp_out,
|
||||
"UDP_%s .udp/comb \"%s\", %d",
|
||||
"UDP_%s .udp/comb \"%s\", %u",
|
||||
vvp_mangle_id(ivl_udp_name(udp)),
|
||||
vvp_mangle_name(ivl_udp_name(udp)),
|
||||
ivl_udp_nin(udp));
|
||||
|
|
@ -1040,7 +1040,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "vvp.tgt: error: Unhandled logic type: %u\n",
|
||||
fprintf(stderr, "vvp.tgt: error: Unhandled logic type: %d\n",
|
||||
ivl_logic_type(lptr));
|
||||
ltype = "?";
|
||||
break;
|
||||
|
|
@ -1793,7 +1793,7 @@ static void draw_type_string_of_nex(ivl_nexus_t nex)
|
|||
break;
|
||||
case IVL_VT_LOGIC:
|
||||
case IVL_VT_BOOL:
|
||||
fprintf(vvp_out, "v%d", width_of_nexus(nex));
|
||||
fprintf(vvp_out, "v%u", width_of_nexus(nex));
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
|
@ -2181,7 +2181,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
default: type = "?"; assert(0);
|
||||
}
|
||||
|
||||
fprintf(vvp_out, "S_%p .scope %s%s, \"%s\" \"%s\" %d %d",
|
||||
fprintf(vvp_out, "S_%p .scope %s%s, \"%s\" \"%s\" %u %u",
|
||||
net, prefix, type,
|
||||
vvp_mangle_name(ivl_scope_basename(net)),
|
||||
vvp_mangle_name(ivl_scope_tname(net)),
|
||||
|
|
@ -2189,7 +2189,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
ivl_scope_lineno(net));
|
||||
|
||||
if (parent) {
|
||||
fprintf(vvp_out, ", %d %d %u, S_%p;\n",
|
||||
fprintf(vvp_out, ", %u %u %u, S_%p;\n",
|
||||
ivl_file_table_index(ivl_scope_def_file(net)),
|
||||
ivl_scope_def_lineno(net), ivl_scope_is_cell(net), parent);
|
||||
} else {
|
||||
|
|
@ -2220,7 +2220,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
ivl_expr_t pex = ivl_parameter_expr(par);
|
||||
switch (ivl_expr_type(pex)) {
|
||||
case IVL_EX_STRING:
|
||||
fprintf(vvp_out, "P_%p .param/str \"%s\" %d %d %d, \"%s\";\n",
|
||||
fprintf(vvp_out, "P_%p .param/str \"%s\" %d %u %u, \"%s\";\n",
|
||||
par, vvp_mangle_name(ivl_parameter_basename(par)),
|
||||
ivl_parameter_local(par),
|
||||
ivl_file_table_index(ivl_parameter_file(par)),
|
||||
|
|
@ -2228,7 +2228,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
ivl_expr_string(pex));
|
||||
break;
|
||||
case IVL_EX_NUMBER:
|
||||
fprintf(vvp_out, "P_%p .param/l \"%s\" %d %d %d, %sC4<",
|
||||
fprintf(vvp_out, "P_%p .param/l \"%s\" %d %u %u, %sC4<",
|
||||
par, vvp_mangle_name(ivl_parameter_basename(par)),
|
||||
ivl_parameter_local(par),
|
||||
ivl_file_table_index(ivl_parameter_file(par)),
|
||||
|
|
@ -2244,7 +2244,7 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
break;
|
||||
case IVL_EX_REALNUM:
|
||||
{ char *res = draw_Cr_to_string(ivl_expr_dvalue(pex));
|
||||
fprintf(vvp_out, "P_%p .param/real \"%s\" %d %d %d, %s; "
|
||||
fprintf(vvp_out, "P_%p .param/real \"%s\" %d %u %u, %s; "
|
||||
"value=%#g\n", par,
|
||||
vvp_mangle_name(ivl_parameter_basename(par)),
|
||||
ivl_parameter_local(par),
|
||||
|
|
|
|||
|
|
@ -232,53 +232,57 @@ unusedFunction:fastlz.c:150
|
|||
// lz4.c from GTKWave
|
||||
// These functions are not used by Icarus
|
||||
// LZ4_compress_continue()
|
||||
unusedFunction:lz4.c:806
|
||||
unusedFunction:lz4.c:817
|
||||
// LZ4_compress_forceExtDict()
|
||||
unusedFunction:lz4.c:818
|
||||
unusedFunction:lz4.c:829
|
||||
// LZ4_compress_limitedOutput()
|
||||
unusedFunction:lz4.c:662
|
||||
unusedFunction:lz4.c:664
|
||||
// LZ4_compress_limitedOutput_continue()
|
||||
unusedFunction:lz4.c:811
|
||||
unusedFunction:lz4.c:822
|
||||
// LZ4_compress_limitedOutput_withState()
|
||||
unusedFunction:lz4.c:1223
|
||||
unusedFunction:lz4.c:1228
|
||||
// LZ4_compress_withState()
|
||||
unusedFunction:lz4.c:1212
|
||||
unusedFunction:lz4.c:1217
|
||||
// LZ4_create()
|
||||
unusedFunction:lz4.c:1192
|
||||
unusedFunction:lz4.c:1197
|
||||
// LZ4_createStream()
|
||||
unusedFunction:lz4.c:687
|
||||
unusedFunction:lz4.c:699
|
||||
// LZ4_createStreamDecode()
|
||||
unusedFunction:lz4.c:1074
|
||||
unusedFunction:lz4.c:1073
|
||||
// LZ4_decompress_fast_continue()
|
||||
unusedFunction:lz4.c:1123
|
||||
unusedFunction:lz4.c:1128
|
||||
// LZ4_decompress_fast_usingDict()
|
||||
unusedFunction:lz4.c:1156
|
||||
unusedFunction:lz4.c:1161
|
||||
// LZ4_decompress_fast_withPrefix64k()
|
||||
unusedFunction:lz4.c:1241
|
||||
unusedFunction:lz4.c:1246
|
||||
// LZ4_decompress_safe_continue()
|
||||
unusedFunction:lz4.c:1103
|
||||
unusedFunction:lz4.c:1108
|
||||
// LZ4_decompress_safe_usingDict()
|
||||
unusedFunction:lz4.c:1151
|
||||
unusedFunction:lz4.c:1156
|
||||
// LZ4_decompress_safe_withPrefix64k()
|
||||
unusedFunction:lz4.c:1236
|
||||
// LZ4_free()
|
||||
unusedFunction:lz4.c:694
|
||||
unusedFunction:lz4.c:1241
|
||||
// LZ4_freeStream()
|
||||
unusedFunction:lz4.c:706
|
||||
// LZ4_freeStreamDecode()
|
||||
unusedFunction:lz4.c:1080
|
||||
// LZ4_loadDict()
|
||||
unusedFunction:lz4.c:701
|
||||
unusedFunction:lz4.c:713
|
||||
// LZ4_resetStreamState()
|
||||
unusedFunction:lz4.c:1185
|
||||
// LZ4_setDictDecode()
|
||||
unusedFunction:lz4.c:1088
|
||||
unusedFunction:lz4.c:1190
|
||||
// LZ4_setStreamDecode()
|
||||
unusedFunction:lz4.c:1093
|
||||
// LZ4_sizeofState()
|
||||
unusedFunction:lz4.c:1210
|
||||
unusedFunction:lz4.c:1215
|
||||
// LZ4_sizeofStreamState()
|
||||
unusedFunction:lz4.c:1177
|
||||
unusedFunction:lz4.c:1182
|
||||
// LZ4_slideInputBuffer()
|
||||
unusedFunction:lz4.c:1199
|
||||
unusedFunction:lz4.c:1204
|
||||
// LZ4_uncompress()
|
||||
unusedFunction:lz4.c:1171
|
||||
unusedFunction:lz4.c:1176
|
||||
// LZ4_uncompress_unknownOutputSize()
|
||||
unusedFunction:lz4.c:1172
|
||||
unusedFunction:lz4.c:1177
|
||||
// LZ4_versionNumber()
|
||||
unusedFunction:lz4.c:370
|
||||
|
||||
// The routines in sys_random.c are exact copies from IEEE1364-2005 and
|
||||
// they have scope warnings that we need to ignore.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -515,16 +515,16 @@ bool vpi_handle_resolv_list_s::resolve(bool mes)
|
|||
if (!val.ptr) {
|
||||
// check for thread vector T<base,wid>
|
||||
unsigned base, wid;
|
||||
unsigned n = 0;
|
||||
int n = 0;
|
||||
char ss[32];
|
||||
if (2 <= sscanf(label(), "T<%u,%u>%n", &base, &wid, &n)
|
||||
&& n == strlen(label())) {
|
||||
&& n == (int)strlen(label())) {
|
||||
val.ptr = vpip_make_vthr_vector(base, wid, false);
|
||||
sym_set_value(sym_vpi, label(), val);
|
||||
|
||||
} else if (3 <= sscanf(label(), "T<%u,%u,%[su]>%n", &base,
|
||||
&wid, ss, &n)
|
||||
&& n == strlen(label())) {
|
||||
&& n == (int)strlen(label())) {
|
||||
|
||||
bool signed_flag = false;
|
||||
for (char*fp = ss ; *fp ; fp += 1) switch (*fp) {
|
||||
|
|
@ -542,13 +542,13 @@ bool vpi_handle_resolv_list_s::resolve(bool mes)
|
|||
sym_set_value(sym_vpi, label(), val);
|
||||
|
||||
} else if (2 == sscanf(label(), "W<%u,%[r]>%n", &base, ss, &n)
|
||||
&& n == strlen(label())) {
|
||||
&& n == (int)strlen(label())) {
|
||||
|
||||
val.ptr = vpip_make_vthr_word(base, ss);
|
||||
sym_set_value(sym_vpi, label(), val);
|
||||
|
||||
} else if (1 == sscanf(label(), "S<%u,str>%n", &base, &n)
|
||||
&& n == strlen(label())) {
|
||||
&& n == (int)strlen(label())) {
|
||||
|
||||
val.ptr = vpip_make_vthr_str_stack(base);
|
||||
sym_set_value(sym_vpi, label(), val);
|
||||
|
|
|
|||
Loading…
Reference in New Issue