cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Reducing source code around return statements with SmPL?
Date: Tue, 24 Sep 2019 21:24:50 +0200	[thread overview]
Message-ID: <f41b8e72-9a79-e65a-a652-8a257d5fac71@web.de> (raw)
In-Reply-To: <alpine.DEB.2.21.1909241729310.2282@hadrien>

> rc comes from check1 so it should be inherited from check1.

I stumble on understanding difficulties for the currently supported
software functionality.

@check1@
expression x;
identifier rc;
local idexpression lrc;
position p;
@@
 lrc@rc = x@p;
 return lrc;

@check2@
identifier check1.rc;
position 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 << check2.p;
v << check1.rc;
@@
coccilib.org.print_todo(p[0],
                        "INFO: May the local variable \""
                        + v
                        + "\" be deleted?")


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?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  parent reply	other threads:[~2019-09-24 19:25 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23  8:50 [Cocci] Reducing source code around return statements with SmPL? Markus Elfring
2019-09-23  8:59 ` Julia Lawall
2019-09-23 11:17   ` Markus Elfring
2019-09-24 15:27   ` Markus Elfring
2019-09-24 15:30     ` Julia Lawall
2019-09-24 15:40       ` Markus Elfring
     [not found]         ` <alpine.DEB.2.21.1909241750490.2281@hadrien>
2019-09-24 16:00           ` Markus Elfring
     [not found]             ` <alpine.DEB.2.21.1909241804490.2281@hadrien>
2019-09-24 16:14               ` Markus Elfring
2019-09-24 19:24       ` Markus Elfring [this message]
2019-09-24 20:16         ` Julia Lawall
2019-09-24 20:35           ` Markus Elfring
2019-09-24 20:49             ` Julia Lawall
2019-09-24 20:55               ` Markus Elfring
2019-09-25  6:13               ` Markus Elfring
2019-09-25  6:22                 ` Julia Lawall
2019-09-25  6:28                   ` Markus Elfring
     [not found]                     ` <alpine.DEB.2.21.1909250837140.2482@hadrien>
2019-09-25  6:40                       ` Markus Elfring
     [not found]                         ` <alpine.DEB.2.21.1909250854190.2482@hadrien>
2019-09-25  7:00                           ` Markus Elfring
     [not found]                             ` <alpine.DEB.2.21.1909251138120.2654@hadrien>
2019-09-25 11:00                               ` Markus Elfring
2019-09-24 18:20   ` Markus Elfring
2019-09-24 20:21     ` Julia Lawall
2019-09-24 20:48       ` Markus Elfring
2019-09-24 20:52         ` Julia Lawall
2019-09-24 21:00           ` Markus Elfring
2019-09-24 21:03             ` Julia Lawall
2019-09-25  6:04               ` Markus Elfring
2019-09-25  8:22               ` Markus Elfring
2019-09-25  8:22               ` Markus Elfring
2019-09-24 18:33   ` Markus Elfring
2019-09-25 11:33   ` [Cocci] [PATCH] Coccinelle: Add a SmPL script for the reconsideration of specific combinations of assignment and return statements Markus Elfring
2019-10-01 14:30     ` [Cocci] [PATCH v2] " Markus Elfring

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=f41b8e72-9a79-e65a-a652-8a257d5fac71@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@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;
as well as URLs for NNTP newsgroup(s).