From: Johannes Berg <johannes@sipsolutions.net>
To: cocci <cocci@systeme.lip6.fr>
Cc: backports <backports@vger.kernel.org>
Subject: matching a modified identifier?
Date: Mon, 06 Feb 2017 12:35:02 +0100 [thread overview]
Message-ID: <1486380902.5430.1.camel@sipsolutions.net> (raw)
Hi,
In backports, we have the following spatch:
@ attribute_group @
identifier group;
declarer name ATTRIBUTE_GROUPS;
@@
ATTRIBUTE_GROUPS(group);
@ class_group depends on attribute_group @
identifier group_class;
identifier groups;
fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
@@
struct class group_class = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
.dev_groups = groups,
+#else
+ .dev_attrs = group_dev_attr,
+#endif
};
[...]
But this isn't sufficient and falls over if there are multiple
instances of ATTRIBUTE_GROUPS, it's essentially undefined which one
gets picked.
I tried to match a modified identifier like this:
@ attribute_group @
identifier group;
fresh identifier groups = group ## "_groups";
declarer name ATTRIBUTE_GROUPS;
@@
ATTRIBUTE_GROUPS(group);
@ class_group depends on attribute_group @
identifier group_class;
identifier attribute_group.groups;
fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
@@
struct class group_class = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
.dev_groups = groups,
+#else
+ .dev_attrs = group_dev_attr,
+#endif
};
[...]
but that doesn't work at all.
Any thoughts?
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
next reply other threads:[~2017-02-06 11:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 11:35 Johannes Berg [this message]
2017-02-06 11:55 ` matching a modified identifier? Johannes Berg
2017-02-06 12:22 ` [Cocci] " Julia Lawall
2017-02-06 12:37 ` Johannes Berg
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=1486380902.5430.1.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=backports@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox