cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Coccinelle <cocci@systeme.lip6.fr>
Cc: Navid Emamdoost <emamd001@umn.edu>, Kangjie Lu <kjlu@umn.edu>,
	Stephen McCamant <smccaman@umn.edu>,
	Aditya Pakki <pakki001@umn.edu>
Subject: Re: [Cocci] Searching for last two statements in code blocks
Date: Tue, 22 Oct 2019 17:19:54 +0200	[thread overview]
Message-ID: <2efbea4c-1886-d268-1545-111a921212b7@web.de> (raw)
In-Reply-To: <4b7189d4-d421-13df-007a-cc40ae79b394@web.de>

Hello,

I have tried another tiny SmPL script out.

@display@
statement s1, s2;
type T;
@@
 T nouveau_bo_alloc(...)
 {
 ... when any
 {
    ... when any
*   s1
*   s2
 }
 ... when any
 }


Such a search pattern can point source code places out which can trigger
further development considerations.
https://elixir.bootlin.com/linux/v5.4-rc2/source/drivers/gpu/drm/nouveau/nouveau_bo.c#L194
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nouveau_bo.c?id=3b7c59a1950c75f2c0152e5a9cd77675b09233d6#n194

System details can probably trigger also collateral evolution for
the semantic patch language (Coccinelle software).
The metavariable type “statement” supports to find C statements
according to known categories.
* Compound
* Iteration
* Selection

Can this type be restricted to C statements according to the categories
“expression” and “jump” by a way which might be simpler than the specification
of similar SmPL disjunctions?
https://en.cppreference.com/w/c/language/statements

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply	other threads:[~2019-10-22 15:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12  9:42 [Cocci] Checking the “display” of last two statements in code blocks Markus Elfring
2019-04-12  9:45 ` Julia Lawall
2019-04-12 10:28   ` Markus Elfring
2019-04-12 10:32     ` Julia Lawall
2019-04-12 10:42       ` [Cocci] Clarification for SmPL asterisk functionality Markus Elfring
2019-04-18 10:00 ` [Cocci] Searching for last two statements in code blocks Markus Elfring
2019-10-22 15:19   ` Markus Elfring [this message]
2019-04-19 12:14 ` [Cocci] Checking the search for duplicate statements at the end of if branches Markus Elfring
2019-04-20  7:30   ` [Cocci] Checking execution environment for Python code in SmPL scripts Markus Elfring
2019-04-20  7:35     ` Julia Lawall
2019-04-20  7:51       ` Markus Elfring
2019-04-20  8:05         ` Julia Lawall
2019-04-20  8:11           ` 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=2efbea4c-1886-d268-1545-111a921212b7@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=emamd001@umn.edu \
    --cc=kjlu@umn.edu \
    --cc=pakki001@umn.edu \
    --cc=smccaman@umn.edu \
    /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;
as well as URLs for NNTP newsgroup(s).