qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Corey Minyard <corey@minyard.net>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] cleanup: Drop pointless label at end of function
Date: Wed, 19 Mar 2025 15:51:39 -0500	[thread overview]
Message-ID: <Z9suW6Ipnaa3Gj3H@mail.minyard.net> (raw)
In-Reply-To: <871puskdhu.fsf@pond.sub.org>

On Wed, Mar 19, 2025 at 08:49:01PM +0100, Markus Armbruster wrote:
> Corey Minyard <corey@minyard.net> writes:
> 
> > On Wed, Mar 19, 2025 at 08:21:20PM +0100, Markus Armbruster wrote:
> >> Corey Minyard <corey@minyard.net> writes:
> >> 
> >> > Is this official coding style?  I'm not a big fan of having return
> >> > statements in the middle of functions, I generally only put them at
> >> > the beginning or the end.
> >> 
> >> There's nothing in docs/devel/style.rst.
> >> 
> >> I count more than 42,000 return statements with indentation > 4.  These
> >> are either within some block, or incorrectly indented.  I'd bet my own
> >> money that it's the former for pretty much all of them.
> >> 
> >> I count less than 130 labels right before a return statement at end of a
> >> function.
> >> 
> >> Based on that, I'd say return in the middle of function is
> >> overwhelmingly common in our code.
> >> 
> >
> > Ok.  It's not a huge deal to me.  I think it's more dangerous to
> > have returns in the middle; they are easy to miss and an "out:" at the
> > end make it more clear there are returns in the middle.  But that's
> > just my opinion.  To make wholesale changes like this I would prefer
> > it be in the style guide.  But, I don't want to start a holy war,
> > either.  Sigh.
> >
> > I mean, just a "return;" at the end of a function, yes, that's a
> > no-brainer, get rid of it.  But that's not what the ones in the IPMI
> > device are.
> 
> Well, you're the maintainer there.  If you'd like me to drop the five
> cases where return is directly after a label (all in hw/ipmi), I can do
> that for the low, low price of a "yes, please!"
> 

No, I'm fine, I woudl just like it in the style guide.

Signed-off-by: Corey Minyard <cminyard@mvista.com>


  reply	other threads:[~2025-03-19 20:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 15:21 [PATCH 0/3] Cleanups around returns Markus Armbruster
2025-03-19 15:21 ` [PATCH 1/3] cleanup: Re-run return_directly.cocci Markus Armbruster
2025-03-19 15:21 ` [PATCH 2/3] cleanup: Drop pointless return at end of function Markus Armbruster
2025-03-19 15:21 ` [PATCH 3/3] cleanup: Drop pointless label " Markus Armbruster
2025-03-19 18:59   ` Corey Minyard
2025-03-19 19:21     ` Markus Armbruster
2025-03-19 19:42       ` Corey Minyard
2025-03-19 19:49         ` Markus Armbruster
2025-03-19 20:51           ` Corey Minyard [this message]
2025-03-19 20:52             ` Corey Minyard
2025-03-20  9:28         ` Daniel P. Berrangé
2025-03-19 20:07       ` Alex Bennée
2025-03-19 16:00 ` [PATCH 0/3] Cleanups around returns Richard Henderson
2025-03-19 16:21 ` Peter Maydell
2025-03-19 19:09   ` Markus Armbruster

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=Z9suW6Ipnaa3Gj3H@mail.minyard.net \
    --to=corey@minyard.net \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).