On Sat, 28 Jan 2023, Luca Coelho wrote: > On Sat, 2023-01-28 at 10:49 +0100, Julia Lawall wrote: > > > > On Sat, 28 Jan 2023, Markus Elfring wrote: > > > > > > @@ > > > > identifier nested_macros.nm; > > > > function f; > > > > identifier dev_priv; > > > > > > > > > How do you think about to use the following SmPL code variant instead of > > > the metavariable type “function”? > > > > > > > > > identifier dev_priv, f; > > > > Good suggestion, Function is not really supported. I think it behaves > > just like identifier, but it would be better to just use identifier. > > Function was an idea thta never actually got implemented. > > Good idea, I generally don't use function, but I'd been trying lots of > different things before I reached out for help. 🙂 I guess I tried with > function at some point and then ended up leaving it there. > > Now I tried with f as identifier, but it didn't make a difference. > > I can actually match _one_ of the occurrences now, but there are many > other ones that are not matching... > > This is what I'm using: > > @macros_noargs@ > identifier m; > expression e =~ "dev_priv"; > @@ > #define m <+...e...+> > > @nested_macros@ > identifier macros_noargs.m; > identifier nm; > @@ > #define nm(...) <+...m...+> > > @@ > identifier nested_macros.nm; > identifier dev_priv, f; > expression e; > @@ > f(...) { > ... > - struct drm_i915_private *dev_priv = e; > + struct drm_i915_private *i915 = e; > > <+... > nm(...) > ...+> > } > > ...and this is the command line: > > spatch --sp-file ~/dev_priv_i915.spatch -I drivers/gpu/drm/i915/display \ > --recursive-includes --in-place --dir ./drivers/gpu/drm/i915/display > > ...and this is the only match I get: > > HANDLING: ./drivers/gpu/drm/i915/display/intel_display.c > diff = > diff -u -p a/intel_display.c b/intel_display.c > --- a/intel_display.c > +++ b/intel_display.c > @@ -3943,7 +3943,7 @@ static bool bxt_get_dsi_transcoder_state > struct intel_display_power_domain_set *power_domain_set) > { > struct drm_device *dev = crtc->base.dev; > - struct drm_i915_private *dev_priv = to_i915(dev); > + struct drm_i915_private *i915 = to_i915(dev); > enum transcoder cpu_transcoder; > enum port port; > u32 tmp; > > Many other files are handled, but there are no matches, though I > believe there should be. Sorry, but it's not obvious how to debug this without any idea of what should be found, Maybe the proper macro definitions are not being found. Maybe the proper uses are not being found. Do you have a concrete example where a change should happen? thanks, julia