On 09/16/2017 09:34 AM, Peter Maydell wrote: > Hi; I'm afraid this doesn't build with clang: > > /home/petmay01/linaro/qemu-for-merges/hw/ide/core.c:70:15: error: > comparison of unsigned enum expression >= 0 is always true > [-Werror,-Wtautological-compare] > if (enval >= 0 && enval < IDE_DMA__COUNT) { > ~~~~~ ^ ~ > 1 error generated. > > (It's impdef whether an enum with all positive values is > a signed type or unsigned type, so just deleting the > comparison against 0 would also be wrong...)
But if ((unsigned)enval < IDE_DMA__COUNT) { should work, regardless of the signedness of the enum. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature