linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mike Goodwin" <mike.goodwin@cantab.net>
To: linux-sparse@vger.kernel.org
Subject: Re: looking for any examples of using sparse
Date: Wed, 9 May 2007 23:34:39 -0700	[thread overview]
Message-ID: <c38fc0de0705092334u6c3635e6i5fc1dec91a00f319@mail.gmail.com> (raw)
In-Reply-To: <bb2368c50705090732w4948fcc0ka3aea74ba22945b5@mail.gmail.com>

I hear you, being in a similar situation myself. I believe I roughly
understand what is going on (though mostly I only care about up until
the parsing stage), but not well enough to explain.

Unless there is a trove of documentation I am missing, sparse at the
moment for better or worse seems to be an experts only (experts in
sparse that is!). The excessive amounts of comments I assume is said
with a little 2nd degree. For me what is lacking is the type of broad
comments (at the top of files say) that give an overall idea about how
things fit together - insightful remarks.

Probably most importantly the principal types are largely
undocumented. What invariants apply to them, when and how they will be
used. Ok, tokens are fairly self-explanatory and conventional, but
Symbols... Now I would hasard to say a symbol represents anything that
will be manifested in the compiled code, but this is probably
inaccurate (I am not sure what happens to unused types for instance if
this is true).

A couple of questions then:-
 -Preprocessing operates on tokens (i.e. before symbols are created).
So what role to NS_PREPROCESSOR and SYM_PREPROCESSOR have (and why are
both required)?

 -What is the meaning of SYM_NODE? (A block or statement in the code??)

From the top of symbol.h:
/*
 * An identifier with semantic meaning is a "symbol".
 *
 * There's a 1:n relationship: each symbol is always
 * associated with one identifier, while each identifier
 * can have one or more semantic meanings due to C scope
 * rules.
 *
 * The progression is symbol -> token -> identifier. The
 * token contains the information on where the symbol was
 * declared.
 */

Perhaps this could be elaborated upon.
"The progression is symbol -> token -> identifier."
Is this correct? Not wanting to embarrass myself, I would have thought
it would be something like
tokens->(identifier,symbol), i.e. we start with tokens, which groups
of which form symbols. One in the group will be the identifier. The
identifier structure itself is not namespace specific, so they are
shared between namespaces.

Sorry could say more but that was already longer than intended!

- Mike


On 5/9/07, Mish Mash <khalota@gmail.com> wrote:
> dear all,
>
> I'm trying to use sparse for writing various source code analysis
> tools (I was using ctool previously). I'm currently going through the
> source trying to figure out what I need. Given the excessive amounts
> of comments I'm having to wade through, this probably isn't the
> fastest way of figuring the beast out ;)
>
> Does anyone have any notes they've taken or can point me at code that
> uses sparse to help get a rough idea of how to use the beast? (Ideally
> slightly more detailed than Randy Dunlap's howto) I noticed smatch now
> uses sparse and i've applied their patch which I'm going over. Is
> there anything better? (I've already found the no longer very useful
> presentation at http://developer.osdl.org/dmo/sparse/)
>
> Thanks!
> nessim
> -
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2007-05-10  6:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-09 14:32 looking for any examples of using sparse Mish Mash
2007-05-10  6:34 ` Mike Goodwin [this message]
2007-05-10 17:46   ` A Sparse C Interpreter [was: looking for any examples of using sparse] Tommy Thorn
2007-07-28 17:44 ` looking for any examples of using sparse Randy Dunlap

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=c38fc0de0705092334u6c3635e6i5fc1dec91a00f319@mail.gmail.com \
    --to=mike.goodwin@cantab.net \
    --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).