On 24 October 2012 23:59, ron minnich <[email protected]> wrote:
> Somebody asked me about a way to semantically patch
> #ifdef X
> to
> #if configured(X)

As already suggested, a script in sed/perl should be able to give you a
quick result for a relative low investment, although it would likely not
distinguish comments/strings from code and possibly not be so robust,
so there is a need for manual inspection of the result.

If you want to write something that is more robust I would suggest taking
the source of stripcmt, http://www.bdc.cx/software/stripcmt/, and modify
that. The source of that tool is very simple, just complicated enough
to keep a states of being inside strings/comments, and then some code
to remove comments which you can remove and then just add some code to
recognise #ifdef X for your task.

BR Håkon Løvdal
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to