On Sat, 12 Feb 2011, Håkon Løvdal wrote:
> On 12/02/2011, Jesper Louis Andersen <[email protected]> wrote:
> > On Fri, Feb 11, 2011 at 23:39, Håkon Løvdal <[email protected]> wrote:
> >> >From the main_grammar.pdf there is an example of adding static
> >> in front of a function. However trying to add something other than
> >> the phrase "static" does not work. Is this by design?
> >
> > In short, yes.
>
> OK, then I know that.
>
>
> > This also hints that Coccinelle is more than simply
> > a textual substituter - you can only write patches that makes sense in
> > C's syntax and grammar.
>
> What I was trying to do was to add some pre-processor
> macro that eventually could expand to "__attribute__((nothrow))".
> This is a gcc extention and I understand that it will not fit into
> coccinelle's C grammar.
>
> This attempt was triggered by the question at
> http://stackoverflow.com/questions/4695741/is-there-a-gcc-option-to-assume-all-extern-c-functions-cannot-propagate-excepti.
> Adding something in front of all functions in an existing code base
> will probably be a PITA, but I was just wondering if coccinelle
> could be used to do that in which case the pain might be
> tolerable.
>
> So this not something I need to solve and do something with.
> Thank you for the answer.
It's ugly, but I think the only solution would be to add a comment
containing what you want and then use sed to get rid of the comment.
On the other hand, I don't have any problems with supporting gcc
extensions. It could be possible to allow __attribute__((expresion)) to
the left of a function name if this would be useful. I think the C parser
already supports this.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)