From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v2] cppcheck: Work around some cppcheck 2.15.0 redundantInitialization warnings
Date: Fri, 6 Sep 2024 13:29:50 +0200 [thread overview]
Message-ID: <20240906132950.48da4e59@elisabeth> (raw)
In-Reply-To: <20240905112204.2661135-1-david@gibson.dropbear.id.au>
On Thu, 5 Sep 2024 21:22:04 +1000
David Gibson <david@gibson.dropbear.id.au> wrote:
> cppcheck-2.15.0 has apparently broadened when it throws a warning about
> redundant initialization to include some cases where we have an initializer
> for some fields, but then set other fields in the function body.
>
> This is arguably a false positive: although we are technically overwriting
> the zero-initialization the compiler supplies for fields not explicitly
> initialized, this sort of construct makes sense when there are some fields
> we know at the top of the function where the initializer is, but others
> that require more complex calculation.
>
> That said, in the two places this shows up, it's pretty easy to work
> around. The results are arguably slightly clearer than what we had, since
> they move the parts of the initialization closer together.
>
> So do that rather than having ugly suppressions or dealing with the
> tedious process of reporting a cppcheck false positive.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Applied.
--
Stefano
prev parent reply other threads:[~2024-09-06 11:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 11:22 [PATCH v2] cppcheck: Work around some cppcheck 2.15.0 redundantInitialization warnings David Gibson
2024-09-06 11:29 ` Stefano Brivio [this message]
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=20240906132950.48da4e59@elisabeth \
--to=sbrivio@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
/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).