From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Finding function implementations that call only a single function.
Date: Sun, 07 Dec 2014 11:22:43 +0100 [thread overview]
Message-ID: <54842A73.4000203@users.sourceforge.net> (raw)
In-Reply-To: <alpine.DEB.2.02.1412071027040.2044@localhost6.localdomain6>
> OK, now the C file is manageable, if I drop the 20 lines of comments at
> the top of the file.
>
> The following is also a completely understandable semantic patch:
>
>> @single_function_call@
>> identifier caller, input, work;
>> type input_type, return_type;
>> @@
>> *return_type caller(input_type input)
>> {
>> (
>> work(input);
>> |
>> return work(input);
>> )
>> }
>>
>> @single_function_call_with_pointer@
>> identifier caller, element, input, work;
>> type input_type, return_type;
>> @@
>> *return_type caller(input_type * input)
>> {
>> (
>> work(input->element);
>> |
>> return work(input->element);
>> )
>> }
>
> So, now what is the problem with the following output?
The source code output is not the problem from the application
of such a small SmPL script.
I find that my filter patterns contain open issues here.
One part of each SmPL disjunction will always not match in this approach
if an analysed function implementation has got the return type "void".
Would the specification of a metavariable "return_type" be also
unnecessary and inappropriate in this use case?
>> One of my concerns here is the influence of the function return type
>> on the SmPL evaluation speed so that more fine-tuning will be appropriate
>> for the filter patterns.
>
> Worrying about the speed of matching of a couple of tokens is completely pointless.
I guess that this view will need adjustments if I am going to rerun
an extended version of the shown SmPL example on all Linux source files
as it happened for a couple of clean-ups around unnecessary (pointer) checks.
> If you want to see that in practice, just use the --profile
> option and see what is the time with and without the matching you are
> concerned about.
I might try that out more in the near future.
> Unless your pattern requires following a lot of different control-flow paths,
> eg due to sequences of conditionals, the C code parsing time will massively
> dominate the matching time.
The Coccinelle software has got difficulties with specific Linux source files
so that it became safer to add the command line parameter "timeout" for example.
I can only directly influence the SmPL scripts here. So I try to make them as good
and fast as I can. Other technical improvements will eventually need more efforts.
Regards,
Markus
next prev parent reply other threads:[~2014-12-07 10:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-28 22:33 [Cocci] Finding function implementations that call only a single function SF Markus Elfring
[not found] ` <alpine.DEB.2.02.1412032218310.2303@localhost6.localdomain6>
[not found] ` <547F8C2B.5090601@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1412032334330.2303@localhost6.localdomain6>
2014-12-05 14:20 ` SF Markus Elfring
[not found] ` <alpine.DEB.2.10.1412051633240.2360@hadrien>
2014-12-05 20:05 ` SF Markus Elfring
[not found] ` <54834F76.1090104@users.sourceforge.net>
[not found] ` <alpine.DEB.2.10.1412061955440.2042@hadrien>
[not found] ` <548358DE.6020409@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1412062139570.2256@localhost6.localdomain6>
[not found] ` <548371FB.9060402@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1412062219530.2256@localhost6.localdomain6>
[not found] ` <54837413.8000902@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1412062232470.2256@localhost6.localdomain6>
[not found] ` <5483806D.3070805@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1412062342540.2256@localhost6.localdomain6>
[not found] ` <5483902E.8060109@users.sourceforge.net>
[not found] ` <alpine.DEB.2.02.1412070749130.2044@localhost6.localdomain6>
2014-12-07 9:15 ` SF Markus Elfring
2014-12-07 9:31 ` Julia Lawall
2014-12-07 10:22 ` SF Markus Elfring [this message]
2014-12-07 10:28 ` Julia Lawall
2014-12-07 10:37 ` SF Markus Elfring
2014-12-07 11:45 ` Julia Lawall
2014-12-07 12:00 ` SF Markus Elfring
2014-12-07 12:38 ` Julia Lawall
2014-12-07 14:41 ` SF Markus Elfring
2014-12-17 15:30 ` SF Markus Elfring
2014-12-17 19:20 ` Julia Lawall
2014-12-17 20:30 ` [Cocci] Distinguishing pointer data types with SmPL SF Markus Elfring
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=54842A73.4000203@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.