From 912f82b5892113b3d7c6adb7bc8fe15461fb8013 Mon Sep 17 00:00:00 2001 From: Cary R Date: Tue, 26 Oct 2010 11:46:49 -0700 Subject: [PATCH] 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. --- Makefile.in | 3 ++- cppcheck.sup | 3 +++ vpi/Makefile.in | 3 ++- vpi/cppcheck.sup | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 cppcheck.sup create mode 100644 vpi/cppcheck.sup diff --git a/Makefile.in b/Makefile.in index bf7bda583..4b268c883 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/cppcheck.sup b/cppcheck.sup new file mode 100644 index 000000000..76827e0c2 --- /dev/null +++ b/cppcheck.sup @@ -0,0 +1,3 @@ +// These are correct and are used to find the base (zero) pin. +thisSubtraction:netlist.h:4119 +thisSubtraction:netlist.h:4128 diff --git a/vpi/Makefile.in b/vpi/Makefile.in index a9720dbd7..18e06489a 100644 --- a/vpi/Makefile.in +++ b/vpi/Makefile.in @@ -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/$@ diff --git a/vpi/cppcheck.sup b/vpi/cppcheck.sup new file mode 100644 index 000000000..fa763acd9 --- /dev/null +++ b/vpi/cppcheck.sup @@ -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