From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Subject: [cocci] Improving support for code positions with opposite SmPL dependencies
Date: Thu, 8 Feb 2024 09:48:57 +0100 [thread overview]
Message-ID: <dcb996ea-f041-406e-b641-0e6b515b9a0a@web.de> (raw)
Hello,
I suggest to take another look at questionable data processing according to
a script variant (like the following) for the semantic patch language
also together with the software combination “Coccinelle 1.1.1-00676-g99513ec1”.
@find disable decl_init@
identifier var;
position call_pos, declaration_pos;
type t;
@@
t * var@declaration_pos;
... when != var
my_test@call_pos(&var)
@test_switch disable decl_init@
identifier find.var;
position find.call_pos, find.declaration_pos;
type find.t;
@@
t * var@declaration_pos;
... when != var
my_test@call_pos(&var)
<+... var ...+>
@adjustment1 depends on test_switch@
position find.call_pos;
@@
-my_test@call_pos
+test_case1
@adjustment2 depends on !test_switch disable decl_init@
identifier find.var;
position find.call_pos, find.declaration_pos;
type find.t;
@@
-t * var@declaration_pos;
... when != var
-my_test@call_pos
+test_case2
(
-&var
)
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci test2-switch_opposite_dependencies-20240208.cocci
…
meta: semantic error: position cannot be inherited over modifications: call_pos
File "test2-switch_opposite_dependencies-20240208.cocci", line 28, column 44, charpos = 572
around = ';',
whole content = position find.call_pos, find.declaration_pos;
Will source code transformations become better supported according to
opposite SmPL dependencies?
By the way:
I observed also that another test case can work as expected (in principle)
if the specification “virtual test_switch” is used instead of the shown
second SmPL rule.
Regards,
Markus
next reply other threads:[~2024-02-08 8:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 8:48 Markus Elfring [this message]
2024-02-08 11:41 ` [cocci] Improving support for code positions with opposite SmPL dependencies 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
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=dcb996ea-f041-406e-b641-0e6b515b9a0a@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).