qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel@nongnu.org, "Daniel P. Berrangé" <berrange@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Juan Quintela" <quintela@redhat.com>
Subject: Re: [RFC PATCH] docs/style: permit inline loop variables
Date: Thu, 24 Aug 2023 14:18:53 +0100	[thread overview]
Message-ID: <CAFEAcA8wobO5F16vYhbQCjeadfN5Zwx5CQ7L4vQ3fh8c_6ngJg@mail.gmail.com> (raw)
In-Reply-To: <87jztmz4bu.fsf@pond.sub.org>

On Wed, 23 Aug 2023 at 06:59, Markus Armbruster <armbru@redhat.com> wrote:
>
> Peter Maydell <peter.maydell@linaro.org> writes:
>
> > On Tue, 22 Aug 2023 at 16:50, Alex Bennée <alex.bennee@linaro.org> wrote:
> >> I've already wasted enough of my time debugging aliased variables in
> >> deeply nested loops.
> >
> > In theory we could try to enable -Wshadow and deal with
> > all the existing cases of aliasing, which would then
> > allow us to turn it into an error and catch your bugs :-)
>
> In practice, a quick compile with -Wshadow -Wno-error=shadow coughs up
> almost 6000 warnings.  There are duplicates since we compile many files
> multiple times, so I piped through sort -u | wc -l, and got about 1200.

-Wshadow=local has only 211 non-duplicate warnings, which
is almost tractable...

(A lot of the duplicates are from local variables declared in macros
like MAX(), MIN() and QOBJECT(), when those macros are used in a nested
way, like MIN(MIN(x,y),z). We could deal with those by using the
__COUNTER__ trick, I guess.)

-- PMM


  reply	other threads:[~2023-08-24 13:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 15:50 [RFC PATCH] docs/style: permit inline loop variables Alex Bennée
2023-08-22 15:52 ` Stefan Hajnoczi
2023-08-22 15:57 ` Peter Maydell
2023-08-23  5:59   ` Markus Armbruster
2023-08-24 13:18     ` Peter Maydell [this message]
2023-08-31 13:29       ` Markus Armbruster
2023-08-22 16:09 ` Richard Henderson
2023-08-22 16:13 ` Thomas Huth
2023-08-22 16:31 ` Philippe Mathieu-Daudé

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=CAFEAcA8wobO5F16vYhbQCjeadfN5Zwx5CQ7L4vQ3fh8c_6ngJg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=thuth@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.
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 NNTP newsgroup(s).