git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: Jeff King <peff@peff.net>
Cc: GIT <git@vger.kernel.org>, Elia Pinto <gitter.spiros@gmail.com>
Subject: Re: [RFC/PATCH] Makefile: add cppcheck target
Date: Wed, 14 Dec 2016 21:23:53 +1300	[thread overview]
Message-ID: <CAFOYHZD5iUzXFH6CFCKhG8UmQb8q0CiUZFSBAeicUmjSt9mgig@mail.gmail.com> (raw)
In-Reply-To: <20161213122854.pphyp342tstxbbqe@sigill.intra.peff.net>

On Wed, Dec 14, 2016 at 1:28 AM, Jeff King <peff@peff.net> wrote:
> On Tue, Dec 13, 2016 at 07:15:10AM -0500, Jeff King wrote:
>
>> I think these last two are a good sign that we need to be feeding the
>> list of source files to cppcheck. I tried your patch and it also started
>> looking in t/perf/build, which are old versions of git built to serve
>> the performance-testing suite.
>>
>> See the way that the "tags" target is handled for a possible approach.
>
> Maybe something like this:
>
> diff --git a/Makefile b/Makefile
> index 8b5976d88..e7684ae63 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2638,4 +2638,6 @@ cover_db_html: cover_db
>  .PHONY: cppcheck
>
>  cppcheck:
> -       cppcheck --force --quiet --inline-suppr $(CPPCHECK_ADD) .
> +       $(FIND_SOURCE_FILES) |\
> +       grep -v ^t/t |\
> +       xargs cppcheck --force --quiet --inline-suppr $(CPPCHECK_ADD)

Will look at something like this for v2.

>
>> My main complaint with any static checker is how we can handle false
>> positives. [...]

<snip>

> So I think it is capable of finding real problems, but I think we'd need
> some way of squelching false positives, preferably in a way that carries
> forward as the code changes (so not just saying "foo.c:1234 is a false
> positive", which will break when it becomes "foo.c:1235").

If we're prepared to wear them, the --inline-suppr will let us
annotate the code to avoid the false-positives. Suppressions can also
be specified with --suppressions-list=file-with-suppressions but that
would suffer from the moving target problem although you can specify
the file without the line number to squash a class of warning for a
whole file.

  reply	other threads:[~2016-12-14  8:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13  9:22 [RFC/PATCH] Makefile: add cppcheck target Chris Packham
2016-12-13  9:32 ` Chris Packham
2016-12-13  9:37   ` stefan.naewe
2016-12-13 12:15 ` Jeff King
2016-12-13 12:28   ` Jeff King
2016-12-14  8:23     ` Chris Packham [this message]
2016-12-14  8:33   ` Chris Packham
2016-12-14 11:18     ` Jeff King
2016-12-14  9:27 ` [RFC/PATCHv2] " Chris Packham
2016-12-14 11:24   ` Jeff King
2016-12-14 14:46     ` Jeff King
2016-12-15 23:22     ` [RFC/PATCH] Makefile: suppress some cppcheck false-positives Chris Packham
2016-12-16 18:43       ` Junio C Hamano
2016-12-16 22:16         ` Jeff King
     [not found]     ` <6ABA4AA4-BD5C-4178-BB3B-91CA045EA2AD@gmail.com>
2016-12-17  7:31       ` [RFC/PATCHv2] Makefile: add cppcheck target Chris Packham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFOYHZD5iUzXFH6CFCKhG8UmQb8q0CiUZFSBAeicUmjSt9mgig@mail.gmail.com \
    --to=judge.packham@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitter.spiros@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).