From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Error predicate determination with SmPL?
Date: Mon, 13 Jul 2015 12:55:04 +0200 [thread overview]
Message-ID: <55A39908.6060600@users.sourceforge.net> (raw)
In-Reply-To: <55A36680.1020707@users.sourceforge.net>
> The semantic patch language can also be used to find
> specific return statements in the source files.
> How can this software help to find all of them
> within a function implementation?
>
> How are the chances to improve static source code analysis
> possibilities for such a purpose?
A simple SmPL filter approach like the following works
already as expected to some degree.
@returns@
expression express;
identifier work;
type return_type;
@@
return_type work(...)
{
... when any
- return express;
... when any
}
elfring at Sonne:~/Projekte/Coccinelle/Probe> spatch.opt -sp-file show_returns1.cocci API-test1.c
init_defs_builtins: /usr/local/lib/coccinelle/standard.h
HANDLING: API-test1.c
diff =
--- API-test1.c
+++ /tmp/cocci-output-6241-92ed9e-API-test1.c
@@ -2,10 +2,8 @@
int my_status(void)
{
- return 1;
}
int main(void)
{
- return my_status();
}
I see further software development challenges here.
1. Do I need to specify a SmPL constraint like "non-void"
for such a script?
2. The expression which is used for a specific return statement
can be assigned to a SmPL metavariable in an other script variant.
I would appreciate if I could process the extracted data
in a more structured way somehow.
Regards,
Markus
next prev parent reply other threads:[~2015-07-13 10:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-13 7:19 [Cocci] Error predicate determination with SmPL? SF Markus Elfring
2015-07-13 10:55 ` SF Markus Elfring [this message]
2015-07-13 11:00 ` Julia Lawall
2015-07-13 11:14 ` SF Markus Elfring
2015-07-13 11:46 ` Julia Lawall
2015-07-13 12:01 ` SF Markus Elfring
2015-07-13 13:00 ` [Cocci] Data processing for expression ASTs SF Markus Elfring
2015-07-13 16:19 ` [Cocci] Error predicate determination with SmPL? SF Markus Elfring
2015-07-13 17:02 ` Julia Lawall
2015-07-13 17:10 ` SF Markus Elfring
2015-07-13 17:20 ` SF Markus Elfring
2015-07-13 17:24 ` Julia Lawall
2015-07-13 17:39 ` [Cocci] Checking of OCaml functionality SF Markus Elfring
2015-07-13 17:48 ` Julia Lawall
2015-07-13 18:03 ` SF Markus Elfring
2015-07-13 18:07 ` Julia Lawall
2015-07-13 18:11 ` SF Markus Elfring
2015-07-13 18:15 ` 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=55A39908.6060600@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