On Tue, 24 Sep 2019, Markus Elfring wrote:
> >> elfring@Sonne:~/Projekte/Linux/next-patched> spatch
> >> ~/Projekte/Coccinelle/janitor/move_code_to_return2.cocci
> >> arch/arm64/kernel/ptrace.c
> >>
> >> Three source code places are pointed out by the SmPL rule “to_do1”
> >> as it would be expected.
> >> Unfortunately, I miss the message “INFO: May the local variable "err" be
> >> deleted?”
> >> for the function “ptrace_hbp_set_addr” according to the SmPL rule “to_do2”.
> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/ptrace.c?id=08f103b9a9502974109fab47ea35ca8542c4e57a#n451
> >>
> >> Which adjustments will become relevant here?
> >
> > In that function err is used elsewhere, so the second message should not
> > be printed.
>
> I disagree to this view (after the removal of previous uses).
What is causing the previous uses to be removed?
julia
>
> The following SmPL script variant can point also questionable variable
> declarations out.
>
> @check1@
> expression x;
> identifier rc;
> local idexpression lrc;
> position p;
> @@
> lrc@rc = x@p;
> return lrc;
>
> @check2@
> identifier check1.rc;
> position check1.p;
> type t;
> @@
> t rc@p;
> ... when != rc
>
> @script:python to_do1@
> p << check1.p;
> @@
> coccilib.org.print_todo(p[0],
> "WARNING: An expression was assigned to a local
> variable before it will be returned by the subsequent statement.")
>
> @script:python to_do2@
> p << check1.p;
> v << check1.rc;
> @@
> coccilib.org.print_todo(p[0],
> "INFO: May the local variable \""
> + v
> + "\" be deleted?")
>
>
> But how should be achieved that the notification for declarations
> which can be omitted will be presented only once for each affected local
> variable?
>
> Regards,
> Markus
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci