Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Subject: [cocci] Adjusting applicability of “block markers” (for SmPL)?
Date: Thu, 19 Jun 2025 16:26:10 +0200	[thread overview]
Message-ID: <74697802-b4d4-4f5e-ae52-c2b6d30a0c15@web.de> (raw)

Hello,

The application of “iterators” (or “block markers”) can trigger special software
development challenges (because the source code search specification shares
properties according to function definitions).
Some of them can be indicated by test cases like the following.

A)
SmPL script example:
@compound_display@
statement list sl;
@@
 do_something(...)
 {
*sl
 }

Corresponding test result example:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> time /usr/bin/spatch show_something_as_function_with_compound_statement.cocci return_test_value.c
…
@@ -1,5 +1,4 @@
 char do_something (int context)
 {
- return MY_TEST;
 }
 

real    0m0,419s
user    0m0,052s
sys     0m0,061s


B)
The SmPL declaration “iterator name do_something;” can be added to the previous example.

Another test result example:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> time /usr/bin/spatch show_something_with_compound_statement.cocci return_test_value2.c
…
@@ -1,7 +1,6 @@
 int do_another_thing (char input)
 {do_something(1)
  {
-  return MY_TEST2;
  }
  return 5;
 }

real    0m0,068s
user    0m0,037s
sys     0m0,031s


How can a collection of such “iterators” (or “block markers”) become a general
part of the Coccinelle system configuration for a selected source code base
(so that parsing of involved source files can usually succeed)?

Regards,
Markus

                 reply	other threads:[~2025-06-19 14:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=74697802-b4d4-4f5e-ae52-c2b6d30a0c15@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).