On Fri, May 24, 2019 at 2:38 PM Julia Lawall <[email protected]> wrote:
> On Fri, 24 May 2019, Timur Tabi wrote:
> > I figured it out:
> >
> > @@
> > identifier func;
> > fresh identifier label = func ## "_exit";
>
> Yes, that works too. Simpler than my suggestion.
I managed to break it somehow. I suspect I ran into some other quirk
of coccinelle. I'm trying to convert that looks like this:
x = MACRO1(stuff);
if (x == NULL)
{
BREAKPOINT();
status = ERROR;
goto myfunc_exit;
}
into:
x = MACRO1(stuff);
CHECK_OR_BP_AND_GOTO(x == NULL, status, ERROR, _exit);
I thought this would work:
@@
type T;
expression y, z;
identifier x, s;
identifier func;
fresh identifier label = func ## "_exit";
@@
func(...) {
<+...
x =
(T)
\(MACRO1\|MACRO2\)
(...);
-if (y)
-{
- BREAKPOINT();
- s = z;
- goto label;
-}
+CHECK_OR_BP_AND_GOTO(y, s, z, _exit);
...
label:
...+>
}
but I get this error:
18: unexpected use of a fresh identifier label
What am I missing?
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci