Add suppression for some cppheck problems.

The files we get from GTKWave are not under our control so we need to
ignore the cppcheck style warnings for them. The random routines are
from the standard so they should not be changed to fix style warnings
either. We also have some weird, but correct pointer subtraction that
cppcheck warns about. This patch adds suppression files for all these
warnings. You must have the latest cppcheck from git since I submitted
a patch that adds the ability to place comments in the suppression file.
This commit is contained in:
Cary R 2010-10-26 11:46:49 -07:00 committed by Stephen Williams
parent 8f7ca60e5f
commit 912f82b589
4 changed files with 48 additions and 2 deletions

View File

@ -157,7 +157,8 @@ endif
rm -rf autom4te.cache
cppcheck: $(O:.o=.cc) $(srcdir)/dosify.c $(srcdir)/version.c
cppcheck --enable=all -f $(INCLUDE_PATH) $^
cppcheck --enable=all -f --suppressions $(srcdir)/cppcheck.sup \
$(INCLUDE_PATH) $^
cppcheck-all:
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) cppcheck && ) true

3
cppcheck.sup Normal file
View File

@ -0,0 +1,3 @@
// These are correct and are used to find the base (zero) pin.
thisSubtraction:netlist.h:4119
thisSubtraction:netlist.h:4128

View File

@ -87,7 +87,8 @@ distclean: clean
rm -f vpi_config.h stamp-vpi_config-h
cppcheck: $(O:.o=.c) $(OPP:.o=.cc) $(M:.o=.c) $(V:.o=.c)
cppcheck --enable=all -f $(INCLUDE_PATH) $^
cppcheck --enable=all -f --suppressions $(srcdir)/cppcheck.sup \
$(INCLUDE_PATH) $^
Makefile: $(srcdir)/Makefile.in ../config.status
cd ..; ./config.status --file=vpi/$@

41
vpi/cppcheck.sup Normal file
View File

@ -0,0 +1,41 @@
// The following three files are copied directly from GTKWave and we do not
// have control over them. Tony has a specific programming style so these
// problems will not be fixed.
// fstapi.c from GTKWave
variableScope:fstapi.c:1485
variableScope:fstapi.c:1602
variableScope:fstapi.c:1642
variableScope:fstapi.c:1643
variableScope:fstapi.c:2336
variableScope:fstapi.c:2651
variableScope:fstapi.c:2655
variableScope:fstapi.c:2656
// lxt2_write.c from GTKWave
variableScope:lxt2_write.c:63
variableScope:lxt2_write.c:523
variableScope:lxt2_write.c:581
variableScope:lxt2_write.c:587
variableScope:lxt2_write.c:1602
variableScope:lxt2_write.c:2049
// lxt_write.c from GTKWave
variableScope:lxt_write.c:31
variableScope:lxt_write.c:587
variableScope:lxt_write.c:640
variableScope:lxt_write.c:1056
variableScope:lxt_write.c:1057
variableScope:lxt_write.c:1058
variableScope:lxt_write.c:1841
variableScope:lxt_write.c:2586
variableScope:lxt_write.c:2587
variableScope:lxt_write.c:2588
variableScope:lxt_write.c:2589
// The routines in sys_random.c are exact copies from IEEE1364-2005 and
// they have scope warnings that we need to ignore.
variableScope:sys_random.c:46
variableScope:sys_random.c:69
variableScope:sys_random.c:92
variableScope:sys_random.c:147