[PATCH] cmd: env: fix unreachable statements

Tom Rini trini at konsulko.com
Fri May 8 18:19:02 CEST 2020


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 <takahiro.akashi at linaro.org>
> > 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?

> To me this is a false positive of Coverity.

I can go mark it as such after the above is answered, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200508/f9aed0a8/attachment.sig>


More information about the U-Boot mailing list