Re: [PATCH 2/2] make for-loop statement simpler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux