From 5853e32f82f2d355e1290b5036bb25efa7c586e1 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 13 Sep 2016 23:44:44 -0700 Subject: [PATCH] Fix some cppcheck warning issues --- cppcheck.sup | 4 ++-- elab_expr.cc | 2 +- elab_lval.cc | 11 ++--------- eval_tree.cc | 4 ++-- netlist.cc | 2 +- pform.cc | 1 - vvp/cppcheck.sup | 28 ---------------------------- 7 files changed, 8 insertions(+), 44 deletions(-) diff --git a/cppcheck.sup b/cppcheck.sup index 0c51fc608..c3648b228 100644 --- a/cppcheck.sup +++ b/cppcheck.sup @@ -1,6 +1,6 @@ // These are correct and are used to find the base (zero) pin. -thisSubtraction:netlist.h:4991 -thisSubtraction:netlist.h:5000 +thisSubtraction:netlist.h:5081 +thisSubtraction:netlist.h:5090 // These are the functions that the compiler exports to the targets. //ivl_branch_island() diff --git a/elab_expr.cc b/elab_expr.cc index 84754cc46..d3d6e52d9 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1657,7 +1657,7 @@ NetExpr* PECallFunction::elaborate_access_func_(Design*des, NetScope*scope, static NetExpr* check_for_enum_methods(const LineInfo*li, Design*des, NetScope*scope, const netenum_t*netenum, - pform_name_t use_path, + const pform_name_t&use_path, perm_string method_name, NetExpr*expr, unsigned rtn_wid, diff --git a/elab_lval.cc b/elab_lval.cc index eec2aabd1..d1ee58fb7 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -75,15 +75,8 @@ */ NetAssign_* PExpr::elaborate_lval(Design*, NetScope*, bool, bool) const { - NetNet*ll = 0; - if (ll == 0) { - cerr << get_fileline() << ": Assignment l-value too complex." - << endl; - return 0; - } - - NetAssign_*lv = new NetAssign_(ll); - return lv; + cerr << get_fileline() << ": Assignment l-value too complex." << endl; + return 0; } /* diff --git a/eval_tree.cc b/eval_tree.cc index 0b373312c..8c0c35f0b 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2016 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 @@ -545,7 +545,7 @@ NetEConst* NetEBComp::eval_eqeq_real_(bool ne_flag, const NetExpr*le, const NetE bool flag = get_real_arguments(le, re, lval, rval); if (! flag) return 0; - verinum result(((lval == rval) ^ ne_flag) ? + verinum result(((lval == rval) != ne_flag) ? verinum::V1 : verinum::V0, 1); NetEConst*res = new NetEConst(result); ivl_assert(*this, res); diff --git a/netlist.cc b/netlist.cc index 26f45a33b..d611f2b03 100644 --- a/netlist.cc +++ b/netlist.cc @@ -558,7 +558,7 @@ void NetNet::calculate_slice_widths_from_packed_dims_(void) ivl_assert(*this, ! slice_wids_.empty()); slice_wids_[0] = netrange_width(slice_dims_); vector::const_iterator cur = slice_dims_.begin(); - for (size_t idx = 1 ; idx < slice_wids_.size() ; idx += 1, cur++) { + for (size_t idx = 1 ; idx < slice_wids_.size() ; idx += 1, ++cur) { slice_wids_[idx] = slice_wids_[idx-1] / cur->width(); } } diff --git a/pform.cc b/pform.cc index c353269ec..1cf58e4fa 100644 --- a/pform.cc +++ b/pform.cc @@ -622,7 +622,6 @@ static void pform_put_wire_in_scope(perm_string name, PWire*net) static void pform_put_enum_type_in_scope(enum_type_t*enum_set) { if (lexical_scope) { - ivl_assert(*enum_set, lexical_scope); lexical_scope->enum_sets.insert(enum_set); } else { pform_enum_sets.insert(enum_set); diff --git a/vvp/cppcheck.sup b/vvp/cppcheck.sup index 9be4ef9b6..2e52e77f2 100644 --- a/vvp/cppcheck.sup +++ b/vvp/cppcheck.sup @@ -5,31 +5,3 @@ uninitVar:vvp_net.cc:167 // These functions are not used by Icarus // __libvpi_c_dummy_function() unusedFunction:libvpi.c:24 -// yy_flex_strlen() -unusedFunction:lexor.cc:3632 -// yy_scan_string() -unusedFunction:lexor.cc:3417 -// yyget_debug() -unusedFunction:lexor.cc:3557 -// yyget_in() -unusedFunction:lexor.cc:3501 -// yyget_leng() -unusedFunction:lexor.cc:3517 -// yyget_lineno() -unusedFunction:lexor.cc:3492 -// yyget_out() -unusedFunction:lexor.cc:3509 -// yyget_text() -unusedFunction:lexor.cc:3526 -// yylex_destroy() -unusedFunction:lexor.cc:3596 -// yypush_buffer_state() -unusedFunction:lexor.cc:3282 -// yyset_debug() -unusedFunction:lexor.cc:3562 -// yyset_in() -unusedFunction:lexor.cc:3547 -// yyset_lineno() -unusedFunction:lexor.cc:3535 -// yyset_out() -unusedFunction:lexor.cc:3552