git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC/PATCH] Makefile: suppress some cppcheck false-positives

From
Chris Packham <judge.packham@gmail.com>
Date
Dec 15, 2016, 23:22 UTC
Message-ID
<20161215232240.19427-1-judge.packham@gmail.com>
In-Reply-To
<20161214112401.mq3n5kui5eeebdtk@sigill.intra.peff.net>

Pass a list of suppressions to cppcheck so that legitimate errors are more obvious.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
On Thu, Dec 15, 2016 at 12:24 AM, Jeff King <peff@peff.net> wrote:
> The patch itself is OK to me, I guess. The interesting part will be
> whether people start actually _using_ cppcheck and squelching the false
> positives. I'm not sure how I feel about the in-code annotations. I'd
> have to see a patch first.

So here's a patch that adds supression files. It would work well for things in contrib/compat that don't change that often. It would be a nightmare to maintain for high-touch code.

 Makefile       | 7 ++++++-
 nedmalloc.supp | 4 ++++
 regcomp.supp   | 8 ++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 nedmalloc.supp
 create mode 100644 regcomp.supp
diff --git a/Makefile b/Makefile
index e5c86decf..bb335ca0f 100644
--- a/Makefile
+++ b/Makefile
@@ -2637,7 +2637,12 @@ cover_db_html: cover_db
 
 .PHONY: cppcheck
 
-CPPCHECK_FLAGS = --force --quiet --inline-suppr $(if $(CPPCHECK_ADD),--enable=$(CPPCHECK_ADD))
+CPPCHECK_SUPP = --suppressions-list=nedmalloc.supp \
+	--suppressions-list=regcomp.supp
+
+CPPCHECK_FLAGS = --force --quiet --inline-suppr \
+	$(if $(CPPCHECK_ADD),--enable=$(CPPCHECK_ADD)) \
+	$(CPPCHECK_SUPP)
 
 cppcheck:
 	@cppcheck --version
diff --git a/nedmalloc.supp b/nedmalloc.supp
new file mode 100644
index 000000000..37bd54def
--- /dev/null
+++ b/nedmalloc.supp
@@ -0,0 +1,4 @@
+nullPointer:compat/nedmalloc/malloc.c.h:4093
+nullPointer:compat/nedmalloc/malloc.c.h:4106
+memleak:compat/nedmalloc/malloc.c.h:4646
+
diff --git a/regcomp.supp b/regcomp.supp
new file mode 100644
index 000000000..3ae023c26
--- /dev/null
+++ b/regcomp.supp
@@ -0,0 +1,8 @@
+memleak:compat/regex/regcomp.c:3086
+memleak:compat/regex/regcomp.c:3634
+memleak:compat/regex/regcomp.c:3086
+memleak:compat/regex/regcomp.c:3634
+uninitvar:compat/regex/regcomp.c:2802
+uninitvar:compat/regex/regcomp.c:2805
+memleak:compat/regex/regcomp.c:532
+
-- 
2.11.0.24.ge6920cf
Previous: Jeff KingNext: Junio C Hamano
Message 12 of 15 in “Makefile: add cppcheck target”
  1. Makefile: add cppcheck targetChris Packham, Dec 13, 2016
  2. Chris PackhamDec 13, 2016
  3. stefan.naewe@atlas-elektronik.comDec 13, 2016
  4. Jeff KingDec 13, 2016
  5. Jeff KingDec 13, 2016
  6. Chris PackhamDec 14, 2016
  7. Chris PackhamDec 14, 2016
  8. Jeff KingDec 14, 2016
  9. [RFC/PATCHv2] Makefile: add cppcheck targetChris Packham, Dec 14, 2016
  10. Jeff KingDec 14, 2016
  11. Jeff KingDec 14, 2016
  12. Makefile: suppress some cppcheck false-positivesChris Packham, Dec 15, 2016
  13. Junio C HamanoDec 16, 2016
  14. Jeff KingDec 16, 2016
  15. Chris PackhamDec 17, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.