* [Cocci] Matching attributes
@ 2021-01-08 23:48 Lukas Straub
2021-01-09 7:34 ` Julia Lawall
0 siblings, 1 reply; 2+ messages in thread
From: Lukas Straub @ 2021-01-08 23:48 UTC (permalink / raw)
To: Julia Lawall; +Cc: cocci
[-- Attachment #1.1: Type: text/plain, Size: 729 bytes --]
Hello Everyone,
I am toying with coccinelle to assist in writing c code. My first try is to
automatically free/cleanup local variables when they go out of scope.
This works very well already:
@@
type T;
identifier var;
attribute name autofree;
@@
T var
- autofree
= NULL;
...
++ free(var);
return ...;
But this fails:
@@
type T;
identifier var;
attribute name autofree;
@@
T var autofree;
...
++ free(var);
return ...;
with
minus: parse error:
File "autofree.cocci", line 7, column 17, charpos = 73
around = ';',
whole content = T var autofree;
What am I doing wrong here?
I tried both with v1.0.8 and latest git.
--
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Cocci] Matching attributes
2021-01-08 23:48 [Cocci] Matching attributes Lukas Straub
@ 2021-01-09 7:34 ` Julia Lawall
0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2021-01-09 7:34 UTC (permalink / raw)
To: Lukas Straub; +Cc: cocci
> But this fails:
>
> @@
> type T;
> identifier var;
> attribute name autofree;
> @@
>
> T var autofree;
> ...
> ++ free(var);
> return ...;
>
> with
>
> minus: parse error:
> File "autofree.cocci", line 7, column 17, charpos = 73
> around = ';',
> whole content = T var autofree;
>
> What am I doing wrong here?
> I tried both with v1.0.8 and latest git.
Thanks for the report. I will look into it.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-09 7:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 23:48 [Cocci] Matching attributes Lukas Straub
2021-01-09 7:34 ` Julia Lawall
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.