Zheng Bao (zheng.bao@amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12330
-gerrit
commit 33fb34b209151864ef3848922ecd6cf34c167576 Author: zbao fishbaozi@gmail.com Date: Thu Nov 5 14:35:57 2015 +0800
cbfstool: Comparing enum causes error when cc=clang
If HOSTCC=clang, the -Wtautological-constant-out-of-range-compare is set automaticaaly. That assume the value of type enum is in the defined range. Then testing if a type enum is out of range causes build error.
Error: coreboot/util/cbfstool/cbfs_image.c:1387:16: error: comparison of constant 4 with expression of type 'enum vb2_hash_algorithm' is always false [-Werror,-Wtautological-constant-out-of-range-compare] if (hash_type >= CBFS_NUM_SUPPORTED_HASHES) ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
clang version: FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512 Target: x86_64-unknown-freebsd10.2 Thread model: posix
Change-Id: I3e1722bf6f9553793a9f0c7f4e790706b6938522 Signed-off-by: Zheng Bao fishbaozi@gmail.com --- util/cbfstool/cbfs_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index f5ef680..1ff88eb 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -1384,7 +1384,7 @@ struct cbfs_file_attribute *cbfs_add_file_attr(struct cbfs_file *header, int cbfs_add_file_hash(struct cbfs_file *header, struct buffer *buffer, enum vb2_hash_algorithm hash_type) { - if (hash_type >= CBFS_NUM_SUPPORTED_HASHES) + if ((uint32_t)hash_type >= (uint32_t)CBFS_NUM_SUPPORTED_HASHES) return -1;
unsigned hash_size = widths_cbfs_hash[hash_type];