All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Straub <lukasstraub2@web.de>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@systeme.lip6.fr
Subject: [Cocci] Matching attributes
Date: Sat, 9 Jan 2021 00:48:41 +0100	[thread overview]
Message-ID: <20210109004841.34cb9174@gecko.fritz.box> (raw)


[-- 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

             reply	other threads:[~2021-01-09  7:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 23:48 Lukas Straub [this message]
2021-01-09  7:34 ` [Cocci] Matching attributes Julia Lawall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210109004841.34cb9174@gecko.fritz.box \
    --to=lukasstraub2@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.