From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752585AbbE0W5I (ORCPT ); Wed, 27 May 2015 18:57:08 -0400 Received: from mta-out1.inet.fi ([62.71.2.195]:59007 "EHLO jenni1.inet.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751055AbbE0W5F (ORCPT ); Wed, 27 May 2015 18:57:05 -0400 Date: Thu, 28 May 2015 01:56:51 +0300 From: "Kirill A. Shutemov" To: Linus Torvalds Cc: Jens Axboe , Linux Kernel Mailing List Subject: Re: block: new gcc-5.1 warnings.. Message-ID: <20150527225651.GA23427@node.dhcp.inet.fi> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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