Hi Peter,

On Thu, Feb 28, 2019 at 2:27 AM Peter Maydell <[email protected]> wrote:
> On Mon, 25 Feb 2019 at 20:32, Max Filippov <[email protected]> wrote:
> > please pull the following batch of target/xtensa updates:
>
> Hi -- I'm afraid this fails to build on some clang compilers:
>
> /Users/pm215/src/qemu-for-merges/target/xtensa/translate.c:967:14:
> error: result of comparison of constant 256 with expression of type
> 'enum resource_type' is always true
> [-Werror,-Wtautological-constant-out-of-range-compare]
>     assert(r < 256 && g < 256 && n < 65536);
>            ~ ^ ~~~

Thanks. I've fixed it up with the following:

diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 616ed8f57972..bda4e9469b86 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -865,11 +865,12 @@ struct slot_prop {
 enum resource_type {
     RES_REGFILE,
     RES_STATE,
+    RES_MAX,
 };

 static uint32_t encode_resource(enum resource_type r, unsigned g, unsigned n)
 {
-    assert(r < 256 && g < 256 && n < 65536);
+    assert(r < RES_MAX && g < 256 && n < 65536);
     return (r << 24) | (g << 16) | n;
 }

and pushed the updated tag 20190228-xtensa.

-- 
Thanks.
-- Max

Reply via email to