Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Searching for pass-through functions
Date: Sat, 04 Oct 2014 22:22:49 +0200	[thread overview]
Message-ID: <54305719.1050304@users.sourceforge.net> (raw)
In-Reply-To: <alpine.DEB.2.02.1410042116320.2079@localhost6.localdomain6>

>> How are the chances to complete the desired data extraction for all 23753 C
>> files in a shorter time frame?
> 
> Use the timeout option.

I would like to avoid it because I do not really have got an overview for source
file sizes and corresponding source code complexity.


> Then hopefully you can get a result for 23753-1 files.

Would you like to try out the discussed source code analysis approach also on
your software development system?

elfring at Sonne:~/Projekte/Coccinelle/lokal/demos/pass-through> spatch.opt -debug
--include-headers-for-types -I /usr/src/linux-stable/include -sp_file
list_pass-through_functions.cocci
/usr/src/linux-stable/drivers/media/pci/ttpci/av7110_ipack.c



init_defs_builtins: /usr/local/share/coccinelle/standard.h


-----------------------------------------------------------------------


processing semantic patch file: list_pass-through_functions.cocci


with isos from: /usr/local/share/coccinelle/standard.iso


-----------------------------------------------------------------------


@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")

-----------------------------------------------------------------------
script rule 1 =
-----------------------------------------------------------------------
dependencies for script satisfied:
binding in = []
HANDLING: /usr/src/linux-stable/drivers/media/pci/ttpci/av7110_ipack.c
-----------------------------------------------------------------------
let's go
-----------------------------------------------------------------------
-----------------------------------------------------------------------
-----------------------------------------------------------------------
is_pass_through =
-----------------------------------------------------------------------
dependencies for rule is_pass_through satisfied:
binding in = []
binding relevant in = []
     (ONCE) USING optional_storage builtin isomorphism
^C     C-c intercepted, will do some cleaning before exiting


In which time frame should such a SmPL script be usually executed?

Regards,
Markus

  reply	other threads:[~2014-10-04 20:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-04 17:49 [Cocci] Searching for pass-through functions SF Markus Elfring
2014-10-04 19:17 ` Julia Lawall
2014-10-04 20:22   ` SF Markus Elfring [this message]
2014-10-04 21:32     ` Julia Lawall
2014-10-05  6:48       ` SF Markus Elfring
2014-10-05  9:39         ` Julia Lawall
2014-10-05 13:15           ` SF Markus Elfring
2014-10-05 11:45       ` SF Markus Elfring
2014-10-05 11:48         ` Julia Lawall
2014-10-05 12:15           ` SF Markus Elfring
2014-10-05 15:33             ` Julia Lawall
2014-10-05 16:38               ` SF Markus Elfring
2014-10-05 16:42                 ` Julia Lawall
2014-10-05 16:55                   ` SF Markus Elfring
2014-10-05 17:01                     ` Julia Lawall
2014-10-05 17:09                       ` SF Markus Elfring
2014-10-05 18:37               ` SF Markus Elfring
2014-10-08 11:40               ` SF Markus Elfring
2014-10-08 11:51                 ` Julia Lawall
2014-10-08 12:01                   ` SF Markus Elfring
2014-10-08 12:08                     ` Julia Lawall
2014-10-08 12:20                       ` SF Markus Elfring
2014-10-08 12:48                         ` Julia Lawall
2014-10-08 13:01                           ` SF Markus Elfring
2014-10-08 18:05                           ` SF Markus Elfring
2014-10-09  5:37                             ` Julia Lawall
2014-10-07 19:39 ` SF Markus Elfring
2014-10-07 19:44   ` Julia Lawall
2014-10-07 20:20     ` SF Markus Elfring
2014-10-07 20:26       ` 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=54305719.1050304@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox