Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Christopher Li <sparse@chrisli.org>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH 2/2] make for-loop statement simpler
Date: Sat, 01 Jul 2017 16:03:38 +0200	[thread overview]
Message-ID: <1498917818.7320.1.camel@petrovitsch.priv.at> (raw)
In-Reply-To: <20170629031804.tptm423ouo3a5ma4@ltop.local>

On Thu, 2017-06-29 at 05:18 +0200, Luc Van Oostenryck wrote:
> On Wed, Jun 28, 2017 at 05:18:18PM -0700, Christopher Li wrote:
> > On Wed, Jun 28, 2017 at 1:49 PM, Luc Van Oostenryck
> > <luc.vanoostenryck@gmail.com> wrote:
> > > The for-statement needs a lot of fields in struct statement, much
> > > more than any other statement. This is due to the complexity of
> > > the for-statement.
> > > 
> > > However part of this complexity can be removed by processing the
> > > 'pre-' statement separately from the loop. This is equivalent to
> > > transform a single-statement for-loop like:
> > >         for (pre; cond; post)
> > >                 body
> > > into a compound statement like:
> > >         pre;
> > >         for (;cond; post)
> > >                 body;
> > 
> > Notice that the two are not exactly the same.
[...]
> Yes, and the patch take care of the scope too.
Just update the explanation to
----  snip  ----
transform a single-statement for-loop like:
        for (pre; cond; post)
                body
into a compound statement like:
{
        pre;
        for (;cond; post)
                body;
}
----  snip  ----
which makes it identical.

MfG,
	Bernd
-- 
Bernd Petrovitsch                  Email : bernd@petrovitsch.priv.at
                     LUGA : http://www.luga.at

      reply	other threads:[~2017-07-01 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 20:49 [PATCH 0/2] simplify for-statement & make struct statement smaller Luc Van Oostenryck
2017-06-28 20:49 ` [PATCH 1/2] avoid some struct symbol member for for-statements Luc Van Oostenryck
2017-06-28 20:49 ` [PATCH 2/2] make for-loop statement simpler Luc Van Oostenryck
2017-06-29  0:18   ` Christopher Li
2017-06-29  3:18     ` Luc Van Oostenryck
2017-07-01 14:03       ` Bernd Petrovitsch [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=1498917818.7320.1.camel@petrovitsch.priv.at \
    --to=bernd@petrovitsch.priv.at \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.org \
    /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