diff --git a/tgt-blif/Makefile.in b/tgt-blif/Makefile.in index 1c63c8776..88a984b04 100644 --- a/tgt-blif/Makefile.in +++ b/tgt-blif/Makefile.in @@ -57,7 +57,8 @@ distclean: clean rm -f Makefile config.log cppcheck: $(O:.o=.cc) - cppcheck --enable=all -f $(INCLUDE_PATH) $^ + cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \ + --relative-paths=$(srcdir) $(INCLUDE_PATH) $^ Makefile: $(srcdir)/Makefile.in ../config.status cd ..; ./config.status --file=tgt-blif/$@ diff --git a/tgt-blif/cppcheck.sup b/tgt-blif/cppcheck.sup new file mode 100644 index 000000000..94e263a9f --- /dev/null +++ b/tgt-blif/cppcheck.sup @@ -0,0 +1,8 @@ +// These are the global access functions called from the compiler so they +// are not used here. + +// target_design() +unusedFunction:blif.cc:66 + +// target_query() +unusedFunction:blif.cc:98 diff --git a/tgt-fpga/Makefile.in b/tgt-fpga/Makefile.in index cee67286b..1bb9e697f 100644 --- a/tgt-fpga/Makefile.in +++ b/tgt-fpga/Makefile.in @@ -61,7 +61,8 @@ distclean: clean rm -f Makefile config.log cppcheck: $(O:.o=.c) - cppcheck --enable=all -f $(INCLUDE_PATH) $^ + cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \ + --relative-paths=$(srcdir) $(INCLUDE_PATH) $^ Makefile: $(srcdir)/Makefile.in ../config.status cd ..; ./config.status --file=tgt-fpga/$@ diff --git a/tgt-fpga/cppcheck.sup b/tgt-fpga/cppcheck.sup new file mode 100644 index 000000000..18c1c0abc --- /dev/null +++ b/tgt-fpga/cppcheck.sup @@ -0,0 +1,5 @@ +// These are the global access functions called from the compiler so they +// are not used here. + +// target_design() +unusedFunction:fpga.c:104 diff --git a/tgt-fpga/d-generic-edif.c b/tgt-fpga/d-generic-edif.c index cfa0b3af0..9e30b6e02 100644 --- a/tgt-fpga/d-generic-edif.c +++ b/tgt-fpga/d-generic-edif.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2010 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 @@ -384,24 +384,23 @@ static void edif_show_logic(ivl_net_logic_t net) static void edif_show_generic_dff(ivl_lpm_t net) { - ivl_nexus_t nex; char jbuf[1024]; unsigned idx; ivl_nexus_t aclr = ivl_lpm_async_clr(net); ivl_nexus_t aset = ivl_lpm_async_set(net); - ivl_expr_t avalue = 0; const char*abits = 0; const char*fdcell = "FDCE"; if (aset != 0) { + ivl_expr_t avalue = ivl_lpm_aset_value(net); fdcell = "FDCPE"; - avalue = ivl_lpm_aset_value(net); assert(avalue); abits = ivl_expr_bits(avalue); assert(abits); } for (idx = 0 ; idx < ivl_lpm_width(net) ; idx += 1) { + ivl_nexus_t nex; edif_uref += 1; diff --git a/tgt-fpga/d-generic.c b/tgt-fpga/d-generic.c index e75f568ff..0ded8c44d 100644 --- a/tgt-fpga/d-generic.c +++ b/tgt-fpga/d-generic.c @@ -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 @@ -358,7 +358,7 @@ static void generic_show_cmp_eq(ivl_lpm_t net) static void generic_show_mux(ivl_lpm_t net) { char name[1024]; - ivl_nexus_t nex, sel; + ivl_nexus_t sel; unsigned idx; xnf_mangle_lpm_name(net, name, sizeof name); @@ -369,6 +369,8 @@ static void generic_show_mux(ivl_lpm_t net) sel = ivl_lpm_select(net, 0); for (idx = 0 ; idx < ivl_lpm_width(net) ; idx += 1) { + ivl_nexus_t nex; + fprintf(xnf, "SYM, %s/M%u, EQN, " "EQN=((I0 * ~I2) + (I1 * I2))\n", name, idx); diff --git a/tgt-fpga/d-lpm.c b/tgt-fpga/d-lpm.c index 8d95aa547..b7d7c3c4a 100644 --- a/tgt-fpga/d-lpm.c +++ b/tgt-fpga/d-lpm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-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 @@ -735,7 +735,6 @@ static void lpm_show_mult(ivl_lpm_t net) edif_cell_t cell; edif_cellref_t ref; - edif_joint_t jnt; sprintf(name, "mult%u", ivl_lpm_width(net)); cell = edif_xlibrary_findcell(xlib, name); @@ -773,6 +772,7 @@ static void lpm_show_mult(ivl_lpm_t net) for (idx = 0 ; idx < ivl_lpm_width(net) ; idx += 1) { unsigned pin; ivl_nexus_t nex; + edif_joint_t jnt; sprintf(name, "Result%u", idx); pin = edif_cell_port_byname(cell, name); diff --git a/tgt-fpga/fpga.c b/tgt-fpga/fpga.c index 116d381a4..95c9fc65b 100644 --- a/tgt-fpga/fpga.c +++ b/tgt-fpga/fpga.c @@ -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 @@ -39,11 +39,10 @@ device_t device = 0; int scope_has_attribute(ivl_scope_t s, const char *name) { int i; - const struct ivl_attribute_s *a; for (i=0; ikey,name) == 0) - return 1; + const struct ivl_attribute_s *a; + a = ivl_scope_attr_val(s, i); + if (strcmp(a->key,name) == 0) return 1; } return 0; } diff --git a/tgt-fpga/xilinx.c b/tgt-fpga/xilinx.c index eb5390e63..22ca68603 100644 --- a/tgt-fpga/xilinx.c +++ b/tgt-fpga/xilinx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2012 Stephen Williams (steve at icarus.com) + * Copyright (c) 2003-2014 Stephen Williams (steve at 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 @@ -505,8 +505,7 @@ static void edif_cellref_logic(ivl_net_logic_t net, const char*def) char*pins; edif_cell_t cell; edif_cellref_t ref; - edif_joint_t jnt; - unsigned idx, port; + unsigned idx; pins = strchr(str, ':'); assert(pins); @@ -520,6 +519,8 @@ static void edif_cellref_logic(ivl_net_logic_t net, const char*def) for (idx = 0 ; idx < ivl_logic_pins(net) ; idx += 1) { char*tmp; + edif_joint_t jnt; + unsigned port; assert(pins); tmp = strchr(pins,','); @@ -707,9 +708,6 @@ void xilinx_mux(ivl_lpm_t net) { unsigned idx; - edif_cellref_t lut; - edif_joint_t jnt; - assert(ivl_lpm_selects(net) == 1); /* A/B Mux devices are made from LUT3 devices. I0 is connected @@ -730,6 +728,8 @@ void xilinx_mux(ivl_lpm_t net) INIT = "CA" */ for (idx = 0 ; idx < ivl_lpm_width(net) ; idx += 1) { + edif_cellref_t lut; + edif_joint_t jnt; lut = edif_cellref_create(edf, xilinx_cell_lut3(xlib)); @@ -756,8 +756,6 @@ void xilinx_mux(ivl_lpm_t net) void xilinx_add(ivl_lpm_t net) { const char*ha_init = 0; - edif_cellref_t lut; - edif_joint_t jnt; switch (ivl_lpm_type(net)) { case IVL_LPM_ADD: @@ -774,6 +772,8 @@ void xilinx_add(ivl_lpm_t net) half-adder. Normally this is an XOR, but if this is a SUB then it is an XNOR. */ if (ivl_lpm_width(net) == 1) { + edif_cellref_t lut; + edif_joint_t jnt; lut = edif_cellref_create(edf, xilinx_cell_lut2(xlib)); @@ -801,7 +801,7 @@ void xilinx_add(ivl_lpm_t net) void xilinx_shiftl(ivl_lpm_t net) { unsigned width = ivl_lpm_width(net); - unsigned nsel = 0, swid = 0; + unsigned nsel = 0; unsigned sdx, qdx; edif_cellref_t* cells; @@ -818,6 +818,7 @@ void xilinx_shiftl(ivl_lpm_t net) emits zeros. */ while (nsel < ivl_lpm_selects(net)) { + unsigned swid; nsel += 1; diff --git a/tgt-null/Makefile.in b/tgt-null/Makefile.in index 1de125ccd..997905fe9 100644 --- a/tgt-null/Makefile.in +++ b/tgt-null/Makefile.in @@ -56,7 +56,8 @@ distclean: clean rm -f Makefile config.log cppcheck: $(O:.o=.c) - cppcheck --enable=all -f $(INCLUDE_PATH) $^ + cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \ + --relative-paths=$(srcdir) $(INCLUDE_PATH) $^ Makefile: $(srcdir)/Makefile.in ../config.status cd ..; ./config.status --file=tgt-null/$@ diff --git a/tgt-null/cppcheck.sup b/tgt-null/cppcheck.sup new file mode 100644 index 000000000..61111b2f4 --- /dev/null +++ b/tgt-null/cppcheck.sup @@ -0,0 +1,8 @@ +// These are the global access functions called from the compiler so they +// are not used here. + +// target_design() +unusedFunction:null.c:50 + +// target_query() +unusedFunction:null.c:56 diff --git a/tgt-pal/Makefile.in b/tgt-pal/Makefile.in index b880cba02..0efa180d4 100644 --- a/tgt-pal/Makefile.in +++ b/tgt-pal/Makefile.in @@ -55,7 +55,8 @@ distclean: clean rm -f Makefile config.log cppcheck: $(O:.o=.c) - cppcheck --enable=all -f $(INCLUDE_PATH) $^ + cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \ + --relative-paths=$(srcdir) $(INCLUDE_PATH) $^ Makefile: $(srcdir)/Makefile.in ../config.status cd ..; ./config.status --file=tgt-pal/$@ diff --git a/tgt-pal/cppcheck.sup b/tgt-pal/cppcheck.sup new file mode 100644 index 000000000..7d4b20042 --- /dev/null +++ b/tgt-pal/cppcheck.sup @@ -0,0 +1,5 @@ +// These are the global access functions called from the compiler so they +// are not used here. + +// target_design() +unusedFunction:imain.c:59 diff --git a/tgt-pcb/Makefile.in b/tgt-pcb/Makefile.in index abf46cf93..a7521775b 100644 --- a/tgt-pcb/Makefile.in +++ b/tgt-pcb/Makefile.in @@ -61,7 +61,11 @@ distclean: clean rm -f stamp-pcb_config-h pcb_config.h cppcheck: $(O:.o=.cc) - cppcheck --enable=all -f $(INCLUDE_PATH) $^ + cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \ + -UYY_USER_INIT \ + -UYYPARSE_PARAM -UYYPRINT -Usize_t -Ushort -Uyyoverflow \ + -UYYTYPE_INT8 -UYYTYPE_INT16 -UYYTYPE_UINT8 -UYYTYPE_UINT16 \ + --relative-paths=$(srcdir) $(INCLUDE_PATH) $^ Makefile: $(srcdir)/Makefile.in ../config.status cd ..; ./config.status --file=tgt-pcb/$@ diff --git a/tgt-pcb/cppcheck.sup b/tgt-pcb/cppcheck.sup new file mode 100644 index 000000000..d0bfcfe5b --- /dev/null +++ b/tgt-pcb/cppcheck.sup @@ -0,0 +1,8 @@ +// These are the global access functions called from the compiler so they +// are not used here. + +// target_design() +unusedFunction:pcb.cc:52 + +// target_query() +unusedFunction:pcb.cc:84 diff --git a/tgt-sizer/Makefile.in b/tgt-sizer/Makefile.in index ad771a714..dad317786 100644 --- a/tgt-sizer/Makefile.in +++ b/tgt-sizer/Makefile.in @@ -56,7 +56,8 @@ distclean: clean rm -f Makefile config.log cppcheck: $(O:.o=.cc) - cppcheck --enable=all -f $(INCLUDE_PATH) $^ + cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \ + --relative-paths=$(srcdir) $(INCLUDE_PATH) $^ Makefile: $(srcdir)/Makefile.in ../config.status cd ..; ./config.status --file=tgt-sizer/$@ diff --git a/tgt-sizer/cppcheck.sup b/tgt-sizer/cppcheck.sup new file mode 100644 index 000000000..f0672ed5c --- /dev/null +++ b/tgt-sizer/cppcheck.sup @@ -0,0 +1,8 @@ +// These are the global access functions called from the compiler so they +// are not used here. + +// target_design() +unusedFunction:sizer.cc:76 + +// target_query() +unusedFunction:sizer.cc:65 diff --git a/tgt-sizer/sizer.cc b/tgt-sizer/sizer.cc index 8eabea097..000496496 100644 --- a/tgt-sizer/sizer.cc +++ b/tgt-sizer/sizer.cc @@ -193,11 +193,9 @@ static void show_stats(struct sizer_statistics&stats) unsigned get_nexus_width(ivl_nexus_t nex) { - ivl_signal_t sig = 0; - for (unsigned idx = 0 ; idx < ivl_nexus_ptrs(nex) ; idx += 1) { ivl_nexus_ptr_t ptr = ivl_nexus_ptr(nex,idx); - sig = ivl_nexus_ptr_sig(ptr); + ivl_signal_t sig = ivl_nexus_ptr_sig(ptr); if (sig) return ivl_signal_width(sig); } diff --git a/tgt-vvp/Makefile.in b/tgt-vvp/Makefile.in index 0aee3a915..37083138e 100644 --- a/tgt-vvp/Makefile.in +++ b/tgt-vvp/Makefile.in @@ -65,7 +65,8 @@ distclean: clean rm -f stamp-vvp_config-h vvp_config.h cppcheck: $(O:.o=.c) - cppcheck --enable=all -f $(INCLUDE_PATH) $^ + cppcheck --enable=all -f --suppressions-list=$(srcdir)/cppcheck.sup \ + --relative-paths=$(srcdir) $(INCLUDE_PATH) $^ Makefile: $(srcdir)/Makefile.in ../config.status cd ..; ./config.status --file=tgt-vvp/$@ diff --git a/tgt-vvp/cppcheck.sup b/tgt-vvp/cppcheck.sup new file mode 100644 index 000000000..ec869c2a2 --- /dev/null +++ b/tgt-vvp/cppcheck.sup @@ -0,0 +1,8 @@ +// These are the global access functions called from the compiler so they +// are not used here. + +// target_design() +unusedFunction:vvp.c:89 + +// target_query() +unusedFunction:vvp.c:184