public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, Laine Stump <laine@redhat.com>
Subject: Re: [PATCH] conf, tap: Silence two false positive invalidFunctionArg from cppcheck
Date: Fri, 17 Feb 2023 20:10:48 +1100	[thread overview]
Message-ID: <Y+9EmIoUutEnV986@yekko> (raw)
In-Reply-To: <20230217090453.419bb4f9@elisabeth>

[-- Attachment #1: Type: text/plain, Size: 1608 bytes --]

On Fri, Feb 17, 2023 at 09:04:53AM +0100, Stefano Brivio wrote:
> On Fri, 17 Feb 2023 09:53:28 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Thu, Feb 16, 2023 at 07:22:10PM +0100, Stefano Brivio wrote:
> > > The newly introduced die() calls exit(), but cppcheck doesn't see it
> > > and warns about possibly invalid arguments used after the check which
> > > triggers die(). Add return statements to silence the warnings.
> > > 
> > > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>  
> > 
> > Oof, that's super ugly.  Any chance that cppcheck will recognize the
> > ((noreturn)) attribute if we added it to die()?
> 
> It doesn't. I guess Library::isnoreturn() in lib/library.cpp is fooled
> by the way we build die with a macro. I couldn't find a corresponding
> ticket, there's a vaguely related false _negative_ here:
> 	https://trac.cppcheck.net/ticket/7933
> 
> but I admit I might have missed one from this list:
> 	https://trac.cppcheck.net/query?status=!closed&keywords=~valueflow
> 
> I see a few alternatives:
> 
> - move exit() after the function body, instead of using 'doexit', I
>   couldn't find a "nice" way to do so but it should be possible

I prefer this option - I don't love flags which dramatically change
behaviour any way.

> - fix the issue in cppcheck
> 
> - or... would you prefer if I use a cppcheck-suppress token here?
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-02-17  9:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 18:22 [PATCH] conf, tap: Silence two false positive invalidFunctionArg from cppcheck Stefano Brivio
2023-02-16 22:53 ` David Gibson
2023-02-17  8:04   ` Stefano Brivio
2023-02-17  9:10     ` David Gibson [this message]
2023-02-17 14:29   ` Laine Stump
2023-02-17 14:37     ` Stefano Brivio

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

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

  git send-email \
    --in-reply-to=Y+9EmIoUutEnV986@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=laine@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /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://passt.top/passt

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 IMAP folder(s).