Re: Fwd: dependency tee from c parser entities downto token

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

 



On Fri, May 11, 2012 at 2:48 PM, Konrad Eisele <eiselekd@xxxxxxxxx> wrote:
>
> This seems ok. expanding_macro has to be global not static to be
> used... (?)

The expand_macro call back use the parent argument which get
from expanding_macro list. The caller should be able to create tree
from the leaf node using the parent pointer.

Feel free to change to use the expanding_macro instead if that make
building the tree easier.

> I think the fact that argument expansion is recursive and
> body expansion is non-recursive is one of the things that
> make the preprocessor kindof hard to grasp.

The body expansion can't be recursive on same macro  otherwise
it can result in unlimited expansion. The C stander specify
the macro expand this way.

>
> I cannot say this before I've tried it.
>
> I'd like to straighten things out a bit: My last emails
> where a bit too harsh and I'd like to apologize. Sorry
> for that.

No problem at all. I figure you just want to the patch to
get included.

> The next step then is: I'll write a patch to add a
> test-prog that uses this api to trace the token generation
> and generate a tree for it.
> For a start I'll printout for all tokens of a preprocessor
> run all macros-expansions that generated them.

That is great. I have a test-macro program in that
branch which is very close to print out all the tokens.

> Now, I've learned not to run too fast towards the
> goal, (which is still "dependency tee from c parser entities downto
> token"), maybe you can think about how to achieve the next steps
> in an API :
> - An #include #ifdef #else #endif pushdown-stack
>  to record the nestings for each token

Let me think about this. Just thinking out lound,
The #include and #ifdef can consider as a special kind
of predefine macro as well.

> - How to connect all this to the AST.

For symbol, it relative easy because symbol has pos range
and aux pointer.

Do you need to attach the dependency for the statment and
expression as well?

Chris
--
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