From: vladimir_zapolskiy@mentor.com (Vladimir Zapolskiy)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Matching from upper level struct
Date: Wed, 20 May 2015 23:35:16 +0300 [thread overview]
Message-ID: <555CF004.5010400@mentor.com> (raw)
Hello Julia,
please excuse me for a newbie question, I'm trying to find a way how to
match an assignment done from embracing struct or union.
If you consider this C code sample:
----8<----
static void a(void) {};
struct x {
void (*u)(void);
};
struct y {
struct x v;
};
struct x k = {
.u = a,
};
struct y l = {
.v = {
.u = a,
},
};
----8<----
where "struct x" type is known and "struct y" may be arbitrary/unknown,
and I would like to match both assignments.
My na?ve rule finds only k.u assignment:
----8<----
@@
struct x X;
identifier value;
@@
* X.u = value;
----8<----
I believe it should not be a problem for me to get access to ".u", if I
get ".v" identifier firstly, but here I encounter a problem, probably
because "{ .u = a, }" above is not considered as a valid expression to
be matched in a rule like ".f = E,".
Any help is appreciated, thank you in advance.
--
With best wishes,
Vladimir
next reply other threads:[~2015-05-20 20:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 20:35 Vladimir Zapolskiy [this message]
2015-05-20 20:58 ` [Cocci] Matching from upper level struct Julia Lawall
2015-05-21 12:21 ` Vladimir Zapolskiy
2015-05-21 17:32 ` 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=555CF004.5010400@mentor.com \
--to=vladimir_zapolskiy@mentor.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.