Cleanup a few more issues found with cppcheck.

Minor fixes and code reorganization to remove a few more issues
that cppcheck is complaining about. It has a few false warnings
and some issues that need more investigation.
This commit is contained in:
Cary R 2009-10-30 09:39:39 -07:00 committed by Stephen Williams
parent 5fb89262df
commit ae49197a14
3 changed files with 23 additions and 14 deletions

View File

@ -931,11 +931,6 @@ NetNet* NetEUReduce::synthesize(Design*des, NetScope*scope, NetExpr*root)
return 0; return 0;
} }
NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, 1);
osig->data_type(expr_type());
osig->local_flag(true);
NetUReduce::TYPE rtype = NetUReduce::NONE; NetUReduce::TYPE rtype = NetUReduce::NONE;
switch (op()) { switch (op()) {
@ -966,8 +961,13 @@ NetNet* NetEUReduce::synthesize(Design*des, NetScope*scope, NetExpr*root)
NetUReduce*gate = new NetUReduce(scope, scope->local_symbol(), NetUReduce*gate = new NetUReduce(scope, scope->local_symbol(),
rtype, isig->vector_width()); rtype, isig->vector_width());
des->add_node(gate); des->add_node(gate);
NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, 1);
osig->data_type(expr_type());
osig->local_flag(true);
connect(gate->pin(0), osig->pin(0)); connect(gate->pin(0), osig->pin(0));
for (unsigned idx = 0 ; idx < isig->pin_count() ; idx += 1) for (unsigned idx = 0 ; idx < isig->pin_count() ; idx += 1)
connect(gate->pin(1+idx), isig->pin(idx)); connect(gate->pin(1+idx), isig->pin(idx));

View File

@ -371,6 +371,7 @@ int main(int argc, char*argv[])
if (precomp_out_path) { if (precomp_out_path) {
precomp_out = fopen(precomp_out_path, "wb"); precomp_out = fopen(precomp_out_path, "wb");
if (precomp_out == 0) { if (precomp_out == 0) {
if (out_path) fclose(out);
perror(precomp_out_path); perror(precomp_out_path);
exit(1); exit(1);
} }
@ -379,6 +380,8 @@ int main(int argc, char*argv[])
if (dep_path) { if (dep_path) {
depend_file = fopen(dep_path, "a"); depend_file = fopen(dep_path, "a");
if (depend_file == 0) { if (depend_file == 0) {
if (out_path) fclose(out);
if (precomp_out) fclose(precomp_out);
perror(dep_path); perror(dep_path);
exit(1); exit(1);
} }
@ -386,27 +389,31 @@ int main(int argc, char*argv[])
if (source_cnt == 0) { if (source_cnt == 0) {
fprintf(stderr, "%s: No input files given.\n", argv[0]); fprintf(stderr, "%s: No input files given.\n", argv[0]);
if (out_path) fclose(out);
if (depend_file) fclose(depend_file);
if (precomp_out) fclose(precomp_out);
return 1; return 1;
} }
/* Pass to the lexical analyzer the list of input file, and /* Pass to the lexical analyzer the list of input file, and
start scanning. */ start scanning. */
reset_lexor(out, source_list); reset_lexor(out, source_list);
if (yylex()) return -1; if (yylex()) {
if (out_path) fclose(out);
if (depend_file) fclose(depend_file);
if (precomp_out) fclose(precomp_out);
return -1;
}
destroy_lexor(); destroy_lexor();
if (depend_file) { if (depend_file) fclose(depend_file);
fclose(depend_file);
}
if (precomp_out) { if (precomp_out) {
dump_precompiled_defines(precomp_out); dump_precompiled_defines(precomp_out);
fclose(precomp_out); fclose(precomp_out);
} }
if (out_path) { if (out_path) fclose(out);
fclose(out);
}
/* Free the source and include directory lists. */ /* Free the source and include directory lists. */
for (lp = 0; lp < source_cnt; lp += 1) { for (lp = 0; lp < source_cnt; lp += 1) {

View File

@ -536,8 +536,10 @@ static vhdl_expr *translate_ufunc(ivl_expr_t e)
int func_scope_sig = 0; int func_scope_sig = 0;
for (int i = 0; i < nparams; i++) { for (int i = 0; i < nparams; i++) {
vhdl_expr *param = translate_expr(ivl_expr_parm(e, i)); vhdl_expr *param = translate_expr(ivl_expr_parm(e, i));
if (NULL == param) if (NULL == param) {
delete fcall;
return NULL; return NULL;
}
// Ensure the parameter has the correct VHDL type // Ensure the parameter has the correct VHDL type
ivl_signal_t param_sig; ivl_signal_t param_sig;