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] Checking exception handling implementations with SmPL
Date: Sun, 14 May 2017 17:41:20 +0200	[thread overview]
Message-ID: <c77fb009-04c5-c381-e016-549cd7592059@users.sourceforge.net> (raw)

Hello,

I would like to check the implementation of exception handling in various
source files. The following script for the semantic patch language tries to
express a few possibilities for such a source code search pattern.


@show_special_reactions@
expression error_code, var;
identifier action =~ "^(?:malloc|strdup)$",
           no_return =~ "[Aa]bort",
           label;
statement es;
@@
 var = action(...);
 if (failed(var))
 {
(
*   return error_code;
|
*   goto label;
|
*   no_return();
)
 }
 else
 es


I find this approach too simple and therefore incomplete. Three well-known
reactions are shown. But there can be more source code before these statements
like further function calls and variable assignments.
We do eventually not know the extra code there and it can also be
generally optional.

How can the Coccinelle software help any more in such an use case?

Regards,
Markus

             reply	other threads:[~2017-05-14 15:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-14 15:41 SF Markus Elfring [this message]
2017-05-18 13:00 ` [Cocci] Checking source code (including optional parts) with SmPL SF Markus Elfring
2017-05-18 15:21 ` [Cocci] Safe determination of function properties for SmPL scripts SF Markus Elfring
2017-05-18 16:00 ` [Cocci] Checking failure predicates with SmPL SF Markus Elfring
2017-05-23  9:01 ` [Cocci] Easier search for assignment targets " SF Markus Elfring
2017-05-23  9:06   ` Julia Lawall
2017-05-23 10:52     ` 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=c77fb009-04c5-c381-e016-549cd7592059@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