cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: "Ondřej Surý" <ondrej@sury.org>
To: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Detecting functions with dummy return value
Date: Fri, 1 Nov 2019 14:22:23 -0500	[thread overview]
Message-ID: <07F58C35-52CF-4DA3-A9A7-62B2A82A8B2D@sury.org> (raw)
In-Reply-To: <alpine.DEB.2.21.1911012003140.2883@hadrien>

Hi Julia,

thanks for the quick response.

> On 1 Nov 2019, at 14:09, Julia Lawall <julia.lawall@lip6.fr> wrote:
> 
> This is not possible.  ... describes control-flow paths.  Nothing happens
> after a return.  Your attempt above would match functions where all
> control-flow paths end with return (ISC_R_SUCCESS);, even if some of those
> returns are in if branches.

I think that would be still fine, I mostly want the Coccinelle to select the functions
that need my attention and we also use Coccinelle in our CI pipelines, so we don’t
reintroduce the code we already cleaned up.

So, if I could just mark the functions that *only* return ISC_R_SUCCESS anywhere,
it would be enough for my use case.  I would then go through the results by hand
and write a targeted spatch for every selected function.  That’s fine, even though
Coccinelle feels like a magic wand, I don’t expect it to be one.

The spatch you sent ends up with:

minus: parse error:
  File "cocci/dummy.spatch", line 7, column 0, charpos = 50
  around = 'foo',
  whole content = foo(...) {

BTW Coccinelle is such a great tool, it has helped with BIND 9 refactoring so much,
so thank you for working on that!

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

  reply	other threads:[~2019-11-01 20:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-01 14:52 [Cocci] Detecting functions with dummy return value Ondřej Surý
2019-11-01 19:09 ` Julia Lawall
2019-11-01 19:22   ` Ondřej Surý [this message]
2019-11-02  6:40     ` Julia Lawall

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=07F58C35-52CF-4DA3-A9A7-62B2A82A8B2D@sury.org \
    --to=ondrej@sury.org \
    --cc=cocci@systeme.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).