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] Finding unstored return values with SmPL
Date: Sun, 19 Jul 2015 15:43:44 +0200	[thread overview]
Message-ID: <55ABA990.30703@users.sourceforge.net> (raw)
In-Reply-To: <alpine.DEB.2.02.1507182154010.2086@localhost6.localdomain6>

>> I would like to achieve a bit of functionality which is already provided
>> by other popular static source code analysis tools
> 
> Why not use them then?

Such tools have got properties or limitations which I do not like.
I would like to reuse the strengths of the Coccinelle software a bit more.
I like its interfaces for the programming languages "OCaml" and "Python"
in principle.


>>   @show_unstored_return_values
>>    depends on !find_calls_for_initialisations
>>            && !find_calls_for_designated_initialisations
>>            && !find_calls_for_assignments@
> 
> I have the impression that you just want
> 
> f(...);

I would like to find a function call which has got specific properties
at such a source code place.
I can see the affected properties as an advanced software developer
almost immediately at the call site while I struggle with a mapping
to the semantic patch language in this use case.


> once you have determined that f has a return value.

I imagine to connect a function name list with this identifier in
a SmPL constraint again.


> No need for positions or dependencies on other rules.

I got the impression for a moment that it is eventually harder to match
something when a detail is absent compared to easily visible source code.
So I tried to use individual SmPL rules as dedicated filters.
Do I fiddle with them in a way which should be better covered
by SmPL disjunctions?

Is it strange anyhow that so many special cases would need to be excluded
so that a specific function call with an unchecked return value is finally
left over for further considerations?


> On the other hand, this is very liable to false positives when there
> is some good reason why the return value of the particular call
> to f doesn't matter.

I can agree to your view to some degree.

I see some opportunities for further fine-tuning of affected source code.
How often would it make sense to mark such special places with a cast
to void?

Regards,
Markus

  reply	other threads:[~2015-07-19 13:43 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15  9:00 [Cocci] Finding unstored return values with SmPL SF Markus Elfring
2015-07-15 10:30 ` Julia Lawall
2015-07-18 11:40   ` SF Markus Elfring
2015-07-18 11:52     ` Julia Lawall
2015-07-18 12:32       ` SF Markus Elfring
2015-07-18 12:52         ` Julia Lawall
2015-07-18 13:36           ` SF Markus Elfring
2015-07-18 19:57             ` Julia Lawall
2015-07-19 13:43               ` SF Markus Elfring [this message]
2015-07-18 20:09             ` Julia Lawall
2015-07-19 12:54               ` SF Markus Elfring
2015-07-19 13:06                 ` Julia Lawall
2015-07-19 14:42                   ` SF Markus Elfring
2015-07-19 16:21                     ` Julia Lawall
2015-07-19 18:48                       ` SF Markus Elfring
2015-07-19 18:49                         ` Julia Lawall
2015-07-20 11:31       ` SF Markus Elfring
2015-07-20 11:37         ` Julia Lawall
2015-07-20 12:55           ` [Cocci] Finding designated initialisers " SF Markus Elfring
2015-07-20 13:27           ` [Cocci] Finding unstored return values " SF Markus Elfring
2015-07-20 16:28             ` Julia Lawall
2015-07-20 20:23               ` [Cocci] Finding designated initialisers " SF Markus Elfring
2015-07-20 20:38                 ` Julia Lawall
2015-07-21  5:47                   ` SF Markus Elfring
2015-08-08  8:05                     ` SF Markus Elfring
2015-08-08  8:25                       ` Julia Lawall
2015-08-08  8:41                         ` SF Markus Elfring
2015-08-08 11:40                       ` Julia Lawall
2015-08-08 11:58                         ` SF Markus Elfring
2015-08-08 12:10                           ` Julia Lawall
2015-08-08 12:56                             ` SF Markus Elfring
2015-07-22 17:42         ` [Cocci] Finding unstored return values " SF Markus Elfring
2015-07-22 17:44           ` Julia Lawall
2015-07-23  5:20             ` SF Markus Elfring
2015-07-23  5:26               ` Julia Lawall
2015-08-05 11:00                 ` SF Markus Elfring
     [not found]                   ` <alpine.DEB.2.02.1508051434540.2198@localhost6.localdomain6>
     [not found]                     ` <55C2229E.7030409@users.sourceforge.net>
     [not found]                       ` <alpine.DEB.2.02.1508051652140.2198@localhost6.localdomain6>
     [not found]                         ` <55C2280A.6000204@users.sourceforge.net>
     [not found]                           ` <alpine.DEB.2.02.1508051718110.2198@localhost6.localdomain6>
     [not found]                             ` <55C2328C.5020405@users.sourceforge.net>
     [not found]                               ` <alpine.DEB.2.02.1508051948060.2039@localhost6.localdomain6>
2015-08-06  9:04                                 ` [Cocci] Fine-tuning for the processing of function name lists? 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=55ABA990.30703@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