From owner-dev-commits-src-all@freebsd.org Mon Jan 11 20:24:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DBC34E5282; Mon, 11 Jan 2021 20:24:41 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp.infotel.ru (corp.infotel.ru [195.170.219.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DF4tx1r87z4pV9; Mon, 11 Jan 2021 20:24:41 +0000 (UTC) (envelope-from vladimir@kondratyev.su) Received: from corp (corp.infotel.ru [195.170.219.3]) by corp.infotel.ru (Postfix) with ESMTP id 66160182098; Mon, 11 Jan 2021 23:24:39 +0300 (MSK) X-Virus-Scanned: amavisd-new at corp.infotel.ru Received: from corp.infotel.ru ([195.170.219.3]) by corp (corp.infotel.ru [195.170.219.3]) (amavisd-new, port 10024) with ESMTP id MJLn-Mv49VP8; Mon, 11 Jan 2021 23:24:34 +0300 (MSK) Received: from mail.cicgroup.ru (unknown [195.170.219.74]) by corp.infotel.ru (Postfix) with ESMTP id 2D0F518208B; Mon, 11 Jan 2021 23:24:34 +0300 (MSK) Received: from mail.cicgroup.ru (localhost [127.0.0.1]) by mail.cicgroup.ru (Postfix) with ESMTP id A993942211F; Mon, 11 Jan 2021 23:24:32 +0300 (MSK) Received: from mail.cicgroup.ru ([127.0.0.1]) by mail.cicgroup.ru (mail.cicgroup.ru [127.0.0.1]) (amavisd-new, port 10024) with SMTP id Eu3p7J0pNI6Y; Mon, 11 Jan 2021 23:24:25 +0300 (MSK) Received: from [192.168.0.30] (gateway [10.0.2.2]) by mail.cicgroup.ru (Postfix) with ESMTPA id 6B7AE42211C; Mon, 11 Jan 2021 23:24:25 +0300 (MSK) Subject: Re: git: 16079c7233be - main - hid: quiet -Wswitch To: Ryan Libby , Jessica Clarke Cc: John Baldwin , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" References: <202101110554.10B5sW2q070743@gitrepo.freebsd.org> <700dd42d-2d73-e54a-5fcc-b62ed31df80d@FreeBSD.org> <915475fa-0072-2303-dfc9-dbeb42224434@kondratyev.su> <486B154B-376A-4000-8946-844353D8504E@freebsd.org> From: Vladimir Kondratyev Message-ID: Date: Mon, 11 Jan 2021 23:24:13 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DF4tx1r87z4pV9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2021 20:24:41 -0000 On 11.01.2021 22:36, Ryan Libby wrote: > On Mon, Jan 11, 2021 at 11:22 AM Jessica Clarke wrote: >> >> On 11 Jan 2021, at 19:14, Vladimir Kondratyev wrote: >>> On 11.01.2021 21:03, John Baldwin wrote: >>>> On 1/10/21 9:54 PM, Ryan Libby wrote: >>>>> The branch main has been updated by rlibby: >>>>> >>>>> URL: https://cgit.FreeBSD.org/src/commit/?id=16079c7233be8bd6c88e3421a70c7ca87cfea370 >>>>> >>>>> commit 16079c7233be8bd6c88e3421a70c7ca87cfea370 >>>>> Author: Ryan Libby >>>>> AuthorDate: 2021-01-11 05:53:15 +0000 >>>>> Commit: Ryan Libby >>>>> CommitDate: 2021-01-11 05:53:15 +0000 >>>>> >>>>> hid: quiet -Wswitch >>>>> >>>>> Gcc builds complained that not all switch cases are handled. Add >>>>> default cases to appease gcc. >>>>> >>>>> Reviewed by: hselasky (previous version), wulf >>>>> Sponsored by: Dell EMC Isilon >>>>> Differential Revision: https://reviews.freebsd.org/D28082 >>>> >>>> If these cases are never reachable, then I think '__assert_unreachable()' >>>> is preferred to a plain break. >>>> >>> These cases are reachable. They are NOP steps of state machine. >> >> How many states are there? It might be better to document that using an >> explicit set of case labels that just immediately break (and then >> -Wswitch will help you in future in case you ever forget to update one >> of the switch statements). Where possible -Wswitch is best fixed, not >> silenced with default, though there are times when the latter is >> preferable. >> >> Jess >> > > There are currently two other enum values, and four total. > > I agree with your and John's points in general. In this case, this was > specifically discussed in review and reviewers requested use of default. > From my perspective, if that's what maintainers prefer after having > considered the options, use of default is acceptable. > Skipping of this 2 steps requires addition of extra flags just to avoid calling of NOP routine once at device_probe() and once at device_detach(). I see no reason to add such a micro-optimization at cost of simplicity.