From: Pierre Habouzit <pierre.habouzit@m4x.org>
To: Chris Li <christ.li@gmail.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: for (int i = expr; ....)
Date: Sat, 23 Feb 2008 14:33:30 +0100 [thread overview]
Message-ID: <20080223133330.GA10967@artemis.madism.org> (raw)
In-Reply-To: <70318cbf0802221226l7888c24auafbe2aabfa9774b9@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]
On Fri, Feb 22, 2008 at 08:26:30PM +0000, Chris Li wrote:
> On Thu, Feb 21, 2008 at 7:05 AM, Pierre Habouzit
> <pierre.habouzit@m4x.org> wrote:
> > Sparse doesn't support the C99 construct `for (int i = expr; ....)` properly.
> > for example, the following C code:
> >
> > #include <stdlib.h>
> >
> > int main(void)
> > {
> > for (int i = atoi("12"); i < 10; i++);
> > return 0;
> > }
> >
> > make sparse spit:
> >
> > $ sparse -Wall test.c
> > test.c:5:22: warning: call with no type!
> >
> > In fact sparse doesn't support 'expr' to be a complex enough expression
> > (expressions that can be folded work, but not any other afaict).
>
> Nah, sparse supports expression in initializer all right.
> It just need to evaluate them to give it the correct ctype.
>
> Please try the this one line patch I attached.
Works for me, thanks.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2008-02-23 13:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 15:05 for (int i = expr; ....) Pierre Habouzit
2008-02-22 20:26 ` Chris Li
2008-02-23 13:33 ` Pierre Habouzit [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=20080223133330.GA10967@artemis.madism.org \
--to=pierre.habouzit@m4x.org \
--cc=christ.li@gmail.com \
--cc=linux-sparse@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).