Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 2021 19:22:21 +0000
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Vladimir Kondratyev <vladimir@kondratyev.su>
Cc:        John Baldwin <jhb@FreeBSD.org>, Ryan Libby <rlibby@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 16079c7233be - main - hid: quiet -Wswitch
Message-ID:  <486B154B-376A-4000-8946-844353D8504E@freebsd.org>
In-Reply-To: <915475fa-0072-2303-dfc9-dbeb42224434@kondratyev.su>
References:  <202101110554.10B5sW2q070743@gitrepo.freebsd.org> <700dd42d-2d73-e54a-5fcc-b62ed31df80d@FreeBSD.org> <915475fa-0072-2303-dfc9-dbeb42224434@kondratyev.su>

next in thread | previous in thread | raw e-mail | index | archive | help
On 11 Jan 2021, at 19:14, Vladimir Kondratyev <vladimir@kondratyev.su> =
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:
>>>=20
>>> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D16079c7233be8bd6c88e3421a70c7ca8=
7cfea370
>>>=20
>>> commit 16079c7233be8bd6c88e3421a70c7ca87cfea370
>>> Author:     Ryan Libby <rlibby@FreeBSD.org>
>>> AuthorDate: 2021-01-11 05:53:15 +0000
>>> Commit:     Ryan Libby <rlibby@FreeBSD.org>
>>> CommitDate: 2021-01-11 05:53:15 +0000
>>>=20
>>>    hid: quiet -Wswitch
>>>=20
>>>    Gcc builds complained that not all switch cases are handled.  Add
>>>    default cases to appease gcc.
>>>=20
>>>    Reviewed by:    hselasky (previous version), wulf
>>>    Sponsored by:   Dell EMC Isilon
>>>    Differential Revision:  https://reviews.freebsd.org/D28082
>>=20
>> If these cases are never reachable, then I think =
'__assert_unreachable()'
>> is preferred to a plain break.
>>=20
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?486B154B-376A-4000-8946-844353D8504E>