backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Finding and replacing a struct inside another struct
@ 2018-08-22  9:30 Luca Coelho
  2018-08-22  9:38 ` Luca Coelho
  2018-08-22 10:52 ` Julia Lawall
  0 siblings, 2 replies; 5+ messages in thread
From: Luca Coelho @ 2018-08-22  9:30 UTC (permalink / raw)
  To: cocci; +Cc: backports

Hi,

I need some help again. :)

I have a struct (cfg80211_crypto_settings) that contains a new element
that I want to substitute for a function call
(cfg_control_port_over_nl80211).  But this struct appears inside
another struct.

So I tried this:

First I try to find a struct that contains the struct I want (with the
@parent_child@ rule):

@parent_child@
identifier child;
identifier parent_type;
@@
struct parent_type
{
...
struct cfg80211_crypto_settings child;
...
}

And then I try to match usage of the parent struct that I found:

@@
identifier parent_child.child;
identifier parent_child.parent_type;
identifier p;
@@
struct parent_type *p;
<...
-p.child.control_over_nl80211
+cfg_control_port_over_nl80211(&p.child)
...>


But I'm getting some cryptic errors:

struct parent_type*
warning: line 715: req, previously declared as a metavariable, is used as an identifier
warning: line 732: req, previously declared as a metavariable, is used as an identifier
warning: line 740: req, previously declared as a metavariable, is used as an identifier
warning: line 912: should name_assign_type be a metavariable?
warning: line 918: params, previously declared as a metavariable, is used as an identifier
warning: line 933: params, previously declared as a metavariable, is used as an identifier
warning: line 941: should reqid be a metavariable?
line 1175: non-structure type in field ref
struct parent_type*
warning: line 715: req, previously declared as a metavariable, is used as an identifier
warning: line 732: req, previously declared as a metavariable, is used as an identifier
warning: line 740: req, previously declared as a metavariable, is used as an identifier
warning: line 912: should name_assign_type be a metavariable?
warning: line 918: params, previously declared as a metavariable, is used as an identifier
warning: line 933: params, previously declared as a metavariable, is used as an identifier
warning: line 941: should reqid be a metavariable?
line 1175: non-structure type in field ref


Does anyone know if there is a proper way to do is?

--
Cheers,
Luca.

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-22 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-22  9:30 Finding and replacing a struct inside another struct Luca Coelho
2018-08-22  9:38 ` Luca Coelho
2018-08-22 10:20   ` Luca Coelho
2018-08-22 10:54     ` [Cocci] " Julia Lawall
2018-08-22 10:52 ` Julia Lawall

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 NNTP newsgroup(s).