On Tue, 24 Sep 2019, Markus Elfring wrote:

> >> I suggest to compare this output with the following source code 
> >> transformation approach.
> …
> >> * Why are the functions “ptrace_hbp_create” and “ptrace_hbp_fill_attr_ctrl”
> >>   presented here?
> >
> > What does "here" mean.  You give two semantic patches with two sets of
> > output.  Which is here?
>
> Please check the relevance of the mentioned two function names once more.
>
>
> >> * Why is the first variable declaration from the function 
> >> “ptrace_hbp_set_addr”
> >>   not marked by the SmPL asterisk functionality in this test example?
> >
> > I don't know what you ae referring to so I can't answer precisely,
>
> Do you find corresponding links clearer?
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/ptrace.c?id=08f103b9a9502974109fab47ea35ca8542c4e57a#n451
> https://elixir.bootlin.com/linux/v5.3.1/source/arch/arm64/kernel/ptrace.c#L451
>
>
> > but you should know that the only connection between your first two rules 
> > with a *
> > is the name of an identifier.
>
> I would expect that the selected identifier should refer to the same scope
> of the enclosing function implementation.

It doesn't.  Identifier metavariables have no scope, and scope is only
taken into account within a rule, not beterrn rules.

>
>
> > There is no guarantee that the two rules match code in the same function.
>
> Will any additional metavariables be needed to achieve this?

Maybe you can match the whole function definition.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to