From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jens Axboe <axboe@kernel.dk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: block: new gcc-5.1 warnings..
Date: Thu, 28 May 2015 01:56:51 +0300 [thread overview]
Message-ID: <20150527225651.GA23427@node.dhcp.inet.fi> (raw)
In-Reply-To: <CA+55aFyfXJedGRwteFR30V0Qce9jJ0rJUuN=mQzDQOFA+cd0Mw@mail.gmail.com>
On Wed, May 27, 2015 at 03:32:15PM -0700, Linus Torvalds wrote:
> So gcc-5.1 seems to have a few new warnings, most of which seem of
> dubious value, but whatever.
>
> One of them
>
> drivers/block/hd.c: In function ‘hd_request’:
> drivers/block/hd.c:630:11: warning: switch condition has boolean value
> [-Wswitch-bool]
> switch (rq_data_dir(req)) {
> ^
>
> just made me go "what?" since doing a switch on a boolean is perfectly
> fine, and there can be various valid reasons to do so (using "break"
> and fall-through etc can make the structure of the true/false cases
> nicer).
In which situation fall-through switch() would make better structure then
plain if()? It's easier to miss-read fall-through.
--
Kirill A. Shutemov
next prev parent reply other threads:[~2015-05-27 22:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-27 22:32 block: new gcc-5.1 warnings Linus Torvalds
2015-05-27 22:56 ` Kirill A. Shutemov [this message]
2015-05-27 23:18 ` Linus Torvalds
2015-05-27 23:34 ` Linus Torvalds
2015-05-27 23:16 ` Jens Axboe
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=20150527225651.GA23427@node.dhcp.inet.fi \
--to=kirill@shutemov.name \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.