I've slightly changed one of my requirements.
I want:
1. arch_reset functions (or functions pointed to by an arch_reset
function pointer) containing a call to cpu_reset(expr) to be
replaced with a call to soft_restart(expr).
2. arch_reset functions (or functions pointed to by an arch_reset
function pointer) not containing soft_restart to have a call to
setup_restart() inserted at their beginning after any variable
declaration.
(1) is easy to achieve:
@ rule1 @
identifier fn;
@@
arch_reset = fn;
@@
identifier rule1.fn, m, c;
expression e;
@@
void fn(char m, const char *c)
{
<...
-cpu_reset(e);
+soft_restart(e);
...>
}
@@
identifier m, c;
expression e;
@@
void arch_reset(char m, const char *c)
{
<...
-cpu_reset(e);
+soft_restart(e);
...>
}
But (2) seems to be much harder. I've tried:
@@
identifier m, c, a;
type t;
@@
void arch_reset(char m, const char *c)
{
t a;
+setup_restart();
... when != _restart
}
@@
identifier m, c;
@@
void arch_reset(char m, const char *c)
{
+setup_restart();
... when != _restart
}
which doesn't see either setup_restart() nor soft_restart(). I've tried
listing setup_restart and soft_restart separately in various ways but
that just produces a parse error.
I'm again at a loss how to get coccinelle to do what I want.
--
Russell King
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)