From: Denis Efremov <efremov@linux.com>
To: Coccinelle <cocci@systeme.lip6.fr>
Subject: [Cocci] expression without side effects
Date: Wed, 2 Sep 2020 15:27:14 +0300 [thread overview]
Message-ID: <218db681-5a0f-020d-874c-457044f628e9@linux.com> (raw)
Hi,
I'm trying to write a pattern to match expression without side-effects,
i.e expression E but not i++, --i, function call.
While trying to write it I faced that this expression matches different
array indices. Actually, it's quite unexpected for me:
@@
expression E;
identifier A;
@@
* E->A || E->A
Actually, I would expect it not to match the file at all:
$ spatch --cocci-file ./test.cocci ./drivers/md/dm-clone-metadata.c
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: ./drivers/md/dm-clone-metadata.c
diff =
--- ./drivers/md/dm-clone-metadata.c
+++ /tmp/cocci-output-11041-66b4fb-dm-clone-metadata.c
@@ -947,7 +947,6 @@ bool dm_clone_changed_this_transaction(s
unsigned long flags;
spin_lock_irqsave(&cmd->bitmap_lock, flags);
- r = cmd->dmap[0].changed || cmd->dmap[1].changed;
spin_unlock_irqrestore(&cmd->bitmap_lock, flags);
return r;
Thanks,
Denis
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next reply other threads:[~2020-09-02 12:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 12:27 Denis Efremov [this message]
2020-09-02 12:32 ` [Cocci] expression without side effects Julia Lawall
2020-09-02 13:00 ` Denis Efremov
2020-09-02 13:14 ` 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=218db681-5a0f-020d-874c-457044f628e9@linux.com \
--to=efremov@linux.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.