From: Tom Rini Date: Fri, 8 May 2020 13:41:38 -0400 Subject: [PATCH] cmd: env: fix unreachable statements In-Reply-To: <69560907-763e-321d-2b91-5ed8caf862a0@gmx.de> References: <20200508055145.7621-1-takahiro.akashi@linaro.org> <9921b3cc-7d35-215a-162c-59588ccaa3e3@gmx.de> <20200508161902.GG12564@bill-the-cat> <69560907-763e-321d-2b91-5ed8caf862a0@gmx.de> Message-ID: <20200508174138.GH12564@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, May 08, 2020 at 07:27:05PM +0200, Heinrich Schuchardt wrote: > On 5/8/20 6:19 PM, Tom Rini wrote: > > On Fri, May 08, 2020 at 06:10:27PM +0200, Heinrich Schuchardt > > wrote: > >> On 08.05.20 07:51, AKASHI Takahiro wrote: > >>> C's switch statement takes an integer value for switching. As > >>> efi_status_t is defined as unsigned long and each error code > >>> has the top bit set, all "cases" cannot be reachable. > >>> > >>> Signed-off-by: AKASHI Takahiro > >>> Reported-by: Coverity (CID 300335) > >> > >> The requirement of C 1999 specification is: "The controlling > >> expression of a switch statement shall have integer type." The > >> requirement is not that the controlling expression should be > >> int. > >> > >> GCC works fine with uint64_t as argument of a switch statement. > > > > OK, but for the record what about C11 with GNU extensions? > > C11: "The controlling expression of a switchstatement shall have > integer type." (https://web.cs.dal.ca/~vlado/pl/C_Standard_2011-n1570.pdf) > > Why did you expect anything that is incompatible to C99? I didn't really, I just wanted a reference to C11. It's odd I think Coverity hit this as a false positive, but it's just a tool. Thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: