From: Konrad Eisele <konrad@gaisler.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Konrad Eisele <eiselekd@gmail.com>,
Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Fwd: dependency tee from c parser entities downto token
Date: Mon, 07 May 2012 08:12:13 +0200 [thread overview]
Message-ID: <4FA767BD.8060703@gaisler.com> (raw)
In-Reply-To: <CANeU7Qm-M7u0h6MswEMw3KZ7wxaxiikpChXJAuhkV0EzcHkH9A@mail.gmail.com>
Christopher Li wrote:
> On Sat, May 5, 2012 at 4:38 PM, Konrad Eisele<eiselekd@gmail.com> wrote:
>>
>> I appended a diff for review. Is this kind of interface ok?
>> This is kind of not a patch to apply, rather I want to avoid to put
>> effort in it and you telling me later I am too intrusive...:). So
>> can you give a ok or comment...
>>
>> Interface so far:
>> struct preprocess_hook {
>> def : called when #define is processed
>
> Why do you need #define hooks? The macro symbol
> should have pos and macro body already.
I need to hook to insert a TOKEN_M_EMPTY into the substitution body
if the define is an empty define. The "post" hook is then used to
remove all TOKEN_M_EMPTY again after the preprocessing (or rather
to save it internally).
>
>> args_beg : called before argument expasnion
>> args_end : called after argument expasnion
>> body_beg : called before body expansion
>> body_end : called after body expansion
>
> I am wondering why is do you need 4 call backs for macro
> expand instead of just one like the patch I post previously.
> That macro expand give you the name of the macro need to
> be expand and the replacement list. My guess is that you
> want the end position of the macro before expand. That
> can be add to the macro expand hook. Will that be sufficient?
I want to trace the complete macro substitution. Using a before-after
hook for both body and arg I can reconstruct what is done in the
expand (Not just dependencies but the whole of expand).
>
>
>> post : called after preprocess
>
> I don't think the post call back is needed. You can call
> the preprocessor directly. It will return when it complete.
> Then you can do your post work. You can invoke the parser
> separately. The sparse wrapper function does it all in
> one function but that did not stop you it step by step
> if you wants to.
See above. I need the post to filter out the helper TOKEN_M_EMPTY.
>
>
>> All of there I found are needed. There might be more to be added...
>>
>> I also introduce a tokentype TOKEN_M_EMPTY so that I can track
>> empty expansion. To filter these out again I add the post hook.
>
> What purpose does the token_m_empty if you filter those token later?
> Rember where in the stream there is an invisible macro?
See above. I use it as a placeholder. The "post" hook saves the information
then and removes the token again.
>
> Chris
> --
> 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
>
>
next prev parent reply other threads:[~2012-05-07 6:22 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 9:54 dependency tee from c parser entities downto token Konrad Eisele
2012-04-25 20:10 ` [PATCH] depend.c: build up a dependency tree from c entities downto tokens: entries in the tree are: macro-depend: tree of #if nesting macro-expansions: possible macro expansion source of a token tok->macro-expansions->macro tok->macro-depend->macro c entities are linked in via [stmt|expr|sym]->start-end-token Konrad Eisele
2012-04-30 22:58 ` dependency tee from c parser entities downto token Christopher Li
2012-05-02 7:27 ` Konrad Eisele
2012-05-03 23:52 ` Christopher Li
2012-05-04 7:33 ` Konrad Eisele
2012-05-04 9:25 ` Christopher Li
2012-05-04 10:36 ` Konrad Eisele
2012-05-04 12:36 ` Konrad Eisele
2012-05-04 15:30 ` Josh Triplett
2012-05-04 20:53 ` Konrad Eisele
2012-05-04 22:30 ` Christopher Li
2012-05-05 0:32 ` Josh Triplett
2012-05-05 8:59 ` Konrad Eisele
2012-05-05 8:56 ` Konrad Eisele
2012-05-04 18:02 ` Christopher Li
2012-05-04 21:46 ` Konrad Eisele
2012-05-04 21:56 ` Konrad Eisele
2012-05-04 23:05 ` Christopher Li
2012-05-05 8:54 ` Konrad Eisele
2012-05-05 11:12 ` Christopher Li
2012-05-05 16:59 ` Konrad Eisele
[not found] ` <CANeU7Qn7vUzLQAF6JGRECro_pPDnL7MCswkrNACe1wohLHZu7g@mail.gmail.com>
2012-05-05 19:56 ` Fwd: " Christopher Li
2012-05-05 23:38 ` Konrad Eisele
2012-05-06 18:34 ` Christopher Li
2012-05-07 6:12 ` Konrad Eisele [this message]
2012-05-07 22:06 ` Christopher Li
2012-05-08 6:38 ` Konrad Eisele
2012-05-09 9:18 ` Christopher Li
2012-05-09 9:48 ` Konrad Eisele
2012-05-09 22:50 ` Christopher Li
2012-05-10 6:19 ` Konrad Eisele
2012-05-10 6:38 ` Konrad Eisele
2012-05-10 9:37 ` Christopher Li
2012-05-10 9:51 ` Konrad Eisele
2012-05-10 11:25 ` Christopher Li
2012-05-10 12:14 ` Konrad Eisele
2012-05-10 12:28 ` Konrad Eisele
2012-05-11 19:40 ` Christopher Li
2012-05-11 21:48 ` Konrad Eisele
2012-05-12 11:02 ` Christopher Li
2012-05-12 17:46 ` Konrad Eisele
2012-05-12 17:57 ` Konrad Eisele
2012-05-13 8:52 ` Konrad Eisele
2012-05-15 6:30 ` Christopher Li
2012-05-15 7:52 ` Konrad Eisele
2012-05-15 9:44 ` Christopher Li
2012-05-15 13:03 ` Konrad Eisele
2012-05-14 10:53 ` Christopher Li
2012-05-10 9:03 ` Christopher Li
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=4FA767BD.8060703@gaisler.com \
--to=konrad@gaisler.com \
--cc=eiselekd@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.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).