From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Analysis for Linux source files
Date: Tue, 2 Apr 2013 14:47:05 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1304021446260.1939@hadrien> (raw)
In-Reply-To: <515ACBBD.3050309@users.sourceforge.net>
When I try, it complains because the parameter fun of store_positions does
not have an ident field. Do you not see that problem?
julia
On Tue, 2 Apr 2013, SF Markus Elfring wrote:
> > Without your semantic patch and some example code, I don't know.
>
> I let the following SmPL filter pattern run on source files from the current
> Linux 3.8.5.
> https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git
>
>
> elfring at Sonne:~/Projekte/Coccinelle/lokal/demos/pass-through> cat
> list_pass-through_functions.cocci
> @initialize:python@
> import sys
> result = []
> mark = ['"', '', '"']
> delimiter = '|'
>
> def store_positions(fun, typ, pt_param, places, data_structure = ""):
> """Add source code positions to an internal list."""
>
>
> for place in places:
>
>
> fields = []
>
>
> fields.append(fun.ident)
>
>
>
>
>
> mark[1] = typ
>
>
> fields.append(''.join(mark))
>
>
>
>
>
> fields.append(pt_param.ident)
>
>
> fields.append(data_structure)
>
>
>
>
>
> mark[1] = place.file.replace('"', '""')
>
>
> fields.append(''.join(mark))
>
>
>
>
>
> fields.append(place.line)
>
>
> fields.append(str(int(place.column) + 1))
>
>
> result.append(delimiter.join(fields))
>
>
>
>
>
> @is_pass_through@
>
>
> identifier pt_function, input;
> type data_type;
> position pos;
> @@
> data_type at pos pt_function(...,data_type input,...)
> {
> <+...
> return input;
> ...+>
> }
>
> @is_pass_through_member_candidate@
> identifier pt_function, input, tag;
> type data_type;
> position pos;
> @@
> struct tag
> {
> ...
> data_type at pos (*pt_function)(...,data_type input,...);
> ...
> }
>
> @script:python collection1 depends on is_pass_through@
> typ << is_pass_through.data_type;
> fun << is_pass_through.pt_function;
> pt_param << is_pass_through.input;
> places << is_pass_through.pos;
> @@
> store_positions(fun, typ, pt_param, places)
>
> @script:python collection2 depends on is_pass_through_member_candidate@
> tag << is_pass_through_member_candidate.tag;
> typ << is_pass_through_member_candidate.data_type;
> fun << is_pass_through_member_candidate.pt_function;
> pt_param << is_pass_through_member_candidate.input;
> places << is_pass_through_member_candidate.pos;
> @@
> store_positions(fun, typ, pt_param, places, tag)
>
> @finalize:python@
> if result:
> result.insert(0, delimiter.join(("function", '"data type"', "parameter",
> '"contained in"', '"source file"', "line", "column")))
> print("\r\n".join(result))
> else:
> sys.stderr.write("No result for this analysis!\n")
>
>
>
> Regards,
> Markus
>
next prev parent reply other threads:[~2013-04-02 12:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 10:12 [Cocci] Analysis for Linux source files SF Markus Elfring
2013-04-02 11:45 ` Julia Lawall
2013-04-02 12:14 ` SF Markus Elfring
2013-04-02 12:47 ` Julia Lawall [this message]
2013-04-02 15:17 ` SF Markus Elfring
2013-04-02 15:23 ` Julia Lawall
2013-04-02 15:30 ` SF Markus Elfring
2013-04-02 15:48 ` Julia Lawall
2013-04-02 16:21 ` Julia Lawall
2013-04-02 15:24 ` Julia Lawall
2013-04-02 15:37 ` SF Markus Elfring
[not found] <mailman.1.1364983201.25969.cocci@systeme.lip6.fr>
2013-04-08 14:29 ` Nic Volanschi (R&D)
2013-04-08 14:54 ` Julia Lawall
2013-04-08 14:56 ` Julia Lawall
2013-04-08 15:05 ` Nic Volanschi (R&D)
2013-04-15 14:29 ` 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=alpine.DEB.2.02.1304021446260.1939@hadrien \
--to=julia.lawall@lip6.fr \
--cc=cocci@systeme.lip6.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox