Linux SPARSE checker discussions
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: 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: Thu, 29 Jun 2017 05:18:05 +0200	[thread overview]
Message-ID: <20170629031804.tptm423ouo3a5ma4@ltop.local> (raw)
In-Reply-To: <CANeU7Qm8Qjf--w-7dc1J5qXhORPoPduc859-tk0-75L8Gx5iww@mail.gmail.com>

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.
> 
> quote 6.8.5 3"The declaration part of a for statement shall only
> declare identifiers for
> objects having storage class auto or register."
> 
> However sparse already validate the for statement declaration in function
> "validate_for_loop_decl()" so I think it is fine.

Yes, and the patch take care of the scope too.

-- Luc

  reply	other threads:[~2017-06-29  3:18 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 [this message]
2017-07-01 14:03       ` Bernd Petrovitsch

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=20170629031804.tptm423ouo3a5ma4@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --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