All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci]  rewrite C preprocessor
@ 2012-10-24 21:59 ron minnich
  2012-10-31 12:12 ` Michael Stefaniuc
  2012-11-17 23:16 ` Håkon Løvdal
  0 siblings, 2 replies; 3+ messages in thread
From: ron minnich @ 2012-10-24 21:59 UTC (permalink / raw)
  To: cocci

Somebody asked me about a way to semantically patch
#ifdef X
to
#if configured(X)

I'm not sure I can rewrite cpp bits in coccinelle, I failed on my
first few attempts, but .. can I?

ron
_______________________________________________
Cocci mailing list
Cocci at diku.dk
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cocci] rewrite C preprocessor
  2012-10-24 21:59 [Cocci] rewrite C preprocessor ron minnich
@ 2012-10-31 12:12 ` Michael Stefaniuc
  2012-11-17 23:16 ` Håkon Løvdal
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Stefaniuc @ 2012-10-31 12:12 UTC (permalink / raw)
  To: cocci

On 10/24/2012 11:59 PM, ron minnich wrote:
> Somebody asked me about a way to semantically patch
> #ifdef X
> to
> #if configured(X)
> 
> I'm not sure I can rewrite cpp bits in coccinelle, I failed on my
> first few attempts, but .. can I?
Use perl/sed/awk

bye
	michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cocci] rewrite C preprocessor
  2012-10-24 21:59 [Cocci] rewrite C preprocessor ron minnich
  2012-10-31 12:12 ` Michael Stefaniuc
@ 2012-11-17 23:16 ` Håkon Løvdal
  1 sibling, 0 replies; 3+ messages in thread
From: Håkon Løvdal @ 2012-11-17 23:16 UTC (permalink / raw)
  To: cocci

On 24 October 2012 23:59, ron minnich <rminnich@gmail.com> 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
Cocci at diku.dk
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-17 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24 21:59 [Cocci] rewrite C preprocessor ron minnich
2012-10-31 12:12 ` Michael Stefaniuc
2012-11-17 23:16 ` Håkon Løvdal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.