On Sun, May 13, 2012 at 1:52 AM, Konrad Eisele <eiselekd@xxxxxxxxx> wrote: > I have thought about how to implement empty expansion tracing without > introducing a new token type. I came up with a solution, however I need > one callback, I called it substitute_arg(), see patch attached. > What do you think, is it apply-able? > I am very sorry that my speed of absorbing patches is much slower than your speed of producing it :( About propagating the empty expansions, may I ask a silly question? Is that the goal is you are able to track that, after the recursive expansion, you are able to tell in the result stream, there is an macro expand to nothing in the this location? Obviously, if the empty expansion is happen in the top level macro expand, you can always keep track of where is the original location of the expand using macro token->pos. The tricky part is the, if the empty expansion happen inside a multi-level macro expand. Then it is hard to keep track of where that empty macro should have been landed if it is not empty. Is that the problem you are trying to solve? About the two example usage you give. The first one is using the html to show how macro expand recursively. I like that demo. It only need to remember at which level the macro expand to empty. It don't need to remember where the empty macro need to land in the result stream. For the second usage example, the shrinking program. I think it only need to remember empty macro expand at the top level. Which is easy because you have the macro token->pos pointing to where this macro used in the source stream. For the empty macro expand inside another macro, you only need to remember it is a dependent of the the top level macro. Because when you trim the source code, you can't split a top level macro. I think a lot of the complexity is introduced try to remember where that empty macro will land, if it is not being empty. However, exactly because the macro is being empty, it will not show up in the result token list. So where it should land is actually not very useful information, the parser never see it any way. We can relax the requirement a little bit, only need to remember where the empty macro will land in the top level case. That will greatly simplify the solution. Is my understanding correct? Thanks 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