From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Analysis for Linux source files
Date: Tue, 02 Apr 2013 17:37:30 +0200 [thread overview]
Message-ID: <515AFB3A.8030408@users.sourceforge.net> (raw)
In-Reply-To: <alpine.DEB.2.02.1304021723390.1939@hadrien>
> Again, to understand the problem, I need the .cocci file, and preferably
> the .c file as well. Preferably a small .c file that shows the problem.
Would you like to reproduce my issue with the following SmPL filter pattern on
the source file
"https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/init/calibrate.c?id=8595c539f0360477189eef91f6337ba44962f72d"?
elfring at Sonne:~/Projekte/Coccinelle/lokal/demos/pass-through> cat
list_pass-through_functions2.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)
mark[1] = typ
fields.append(''.join(mark))
fields.append(pt_param)
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 15:37 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
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 [this message]
[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=515AFB3A.8030408@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--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 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.