Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@inria.fr>, cocci@inria.fr
Subject: Re: [cocci] Improving support for code positions with opposite SmPL dependencies
Date: Fri, 9 Feb 2024 09:37:01 +0100	[thread overview]
Message-ID: <256efa8b-64cc-4806-a780-facfa42fba11@web.de> (raw)
In-Reply-To: <55ea3e4-8ef8-b457-ea92-9d612ba9d943@inria.fr>

>>> How will the handling of  “if … else …” constructs evolve further for SmPL code?
>
> You need to figure out how to put the two cases in the different branches
> of a single disjunction.

Further development ideas can hopefully be clarified better also with the help
of the following SmPL script example.


@selection disable decl_init@
identifier var;
type t;
@@
(t * var;
 ... when != var
-my_test
+test_case1
 (&var)
 ... when exists
 var
|
-t * var;
 ... when != var
-my_test
+test_case2
 (
-&var
 )
)



May I expect that the same data processing result will be produced
if “a virtual item” is replaced by another SmPL rule in the following SmPL script variant?


virtual test_switch

@find@
position pos;
@@
 my_test@pos(...)

@adjustment1 depends on test_switch@
position find.pos;
@@
-my_test@pos
+test_case1

@adjustment2 depends on !test_switch@
position find.pos;
@@
-my_test@pos
+test_case2


Regards,
Markus

  parent reply	other threads:[~2024-02-09  8:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08  8:48 [cocci] Improving support for code positions with opposite SmPL dependencies Markus Elfring
2024-02-08 11:41 ` Julia Lawall
2024-02-08 12:50   ` Markus Elfring
2024-02-08 13:04     ` Julia Lawall
2024-02-08 13:16       ` Markus Elfring
2024-02-08 13:23         ` Julia Lawall
2024-02-08 13:24           ` Julia Lawall
2024-02-08 13:40             ` Markus Elfring
2024-02-08 13:45               ` Julia Lawall
2024-02-09  8:37             ` Markus Elfring [this message]
2024-02-08 13:35           ` Markus Elfring
2024-02-08 13:39             ` Julia Lawall
2024-02-08 14:05               ` 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=256efa8b-64cc-4806-a780-facfa42fba11@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=julia.lawall@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).