From: Julia Lawall <julia.lawall@lip6.fr>
To: Johan Hovold <johan@kernel.org>
Cc: Michal Marek <mmarek@suse.com>,
Gilles Muller <Gilles.Muller@lip6.fr>,
Nicolas Palix <nicolas.palix@imag.fr>,
linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr
Subject: Re: [PATCH] coccinelle: misc: remove "complex return code" warnings
Date: Sat, 3 Oct 2015 18:24:27 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.10.1510031823480.2586@hadrien> (raw)
In-Reply-To: <20151001174718.GJ4284@localhost>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Perhaps there is a more restricted version that can be acceptable, but I'm
OK with dropping the current version.
julia
On Thu, 1 Oct 2015, Johan Hovold wrote:
> On Thu, Oct 01, 2015 at 07:20:10AM +0200, Julia Lawall wrote:
> > On Wed, 30 Sep 2015, Johan Hovold wrote:
> >
> > > This effectively reverts 932058a5d5f9 ("coccinelle: misc: semantic patch
> > > to delete overly complex return code processing").
> > >
> > > There can be both symmetry and readability reasons for not wanting to do
> > > the final function call as part of the return statement and to maintain
> > > a clear separation of success and error paths.
> > >
> > > Since this is in no way mandated by the coding standard, let's just
> > > remove this semantic patch to avoid having "clean up" patches being
> > > posted over and over in response to these Coccinelle warnings.
> >
> > What do you mean by "posted"? Are you referring to 0-day build testing
> > or individual usage of make coccicheck? Maybe it would make sense to
> > remove the semantic patch from 0-day build testing but leave it in the
> > kernel, perhaps removing the < 0 case because that one in practice doesn't
> > seem to turn up much that is useful?
>
> Individuals running coccicheck on in-kernel code and posting patches to
> "fix warnings", where the end result is not necessarily an improvement.
>
> But I don't think these warnings should be enabled for 0-day build
> testing either as it is should be up to the author to decide what style
> to prefer in each case.
>
> > Perhaps it could also be improved to detect a previous != 0 case and then
> > not return a warning. On some functions, this change can make some nice
> > simplifications.
>
> Yes, that would at least improve things.
>
> I don't think warnings should be generated at all for the following
> code:
>
> {
> int ret;
>
> ret = init_a(...);
> if (ret)
> return ret;
>
> ret = init_b(...);
> if (ret)
> return ret;
>
> return 0;
> }
>
> as it is (at least to me) preferred over:
>
> {
> int ret;
>
> ret = init_a(...);
> if (ret)
> return ret;
>
> return init_b(...);
> }
>
> for symmetry and readability reasons (e.g. I don't have to look at
> init_b to figure out what the functions returns). And with a long
> parameter list to init_b with line breaks, this would look even worse.
>
> But either way, it should be up to the author of the code to decide what
> style to use.
>
> Thanks,
> Johan
>
next prev parent reply other threads:[~2015-10-03 16:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-30 22:37 Johan Hovold
2015-10-01 5:20 ` Julia Lawall
2015-10-01 17:47 ` Johan Hovold
2015-10-02 21:33 ` Julia Lawall
2015-10-04 10:50 ` Johan Hovold
2015-10-03 16:24 ` Julia Lawall [this message]
2015-10-04 10:52 ` Johan Hovold
2015-10-03 16:25 ` Julia Lawall
2015-10-28 9:54 ` Johan Hovold
2015-10-28 10:04 ` Michal Marek
2015-10-28 10:09 ` Johan Hovold
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=alpine.DEB.2.10.1510031823480.2586@hadrien \
--to=julia.lawall@lip6.fr \
--cc=Gilles.Muller@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.com \
--cc=nicolas.palix@imag.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
all inboxes | Powered by JetHome®