<div dir="ltr"><div><div>Hello,<br><br></div>I did more tests... and I didn't experience any error.<br></div><div>I attach last version of the script.<br><br></div><div>Cheers,<br></div><div>Francesco<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-04 19:50 GMT+02:00 Francesco Ansanelli <span dir="ltr"><<a href="mailto:francians@gmail.com" target="_blank">francians@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi Eric,<br><br></div>after your question:<br><br></div><div>[snip]<br></div><div><span class=""><span>
</span>I expect, with enums having varying size, that this cast will<br>
not always work.<br></span>[snip]<br><br>I started a script for testing with variable enum sizes and compilers...<br></div>If does makes sense to you, I'll try to loop from 1 to n (suggestions?) and build with gcc and clang (and others?) to find the case you're taking about.<br></div>I'm also thinking about a negative test...<br></div>What do you think?<br><div><br></div><div>Cheers,<br></div><div>Francesco<br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2016-08-01 14:10 GMT+02:00 Eric Engestrom <span dir="ltr"><<a href="mailto:eric.engestrom@imgtec.com" target="_blank">eric.engestrom@imgtec.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Sat, Jul 30, 2016 at 09:49:57AM +0200, Francesco Ansanelli wrote:<br>
> Signed-off-by: Francesco Ansanelli <<a href="mailto:francians@gmail.com" target="_blank">francians@gmail.com</a>><br>
> ---<br>
>  src/gallium/drivers/freedreno/<wbr>a2xx/fd2_screen.c |    8 ++++----<br>
>  1 file changed, 4 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/gallium/drivers/freedren<wbr>o/a2xx/fd2_screen.c b/src/gallium/drivers/freedren<wbr>o/a2xx/fd2_screen.c<br>
> index fe4849b..007b9e6 100644<br>
> --- a/src/gallium/drivers/freedren<wbr>o/a2xx/fd2_screen.c<br>
> +++ b/src/gallium/drivers/freedren<wbr>o/a2xx/fd2_screen.c<br>
> @@ -61,7 +61,7 @@ fd2_screen_is_format_supported<wbr>(struct pipe_screen *pscreen,<br>
><br>
>       if ((usage & (PIPE_BIND_SAMPLER_VIEW |<br>
>                               PIPE_BIND_VERTEX_BUFFER)) &&<br>
> -                     (fd2_pipe2surface(format) != ~0u)) {<br>
> +                     (fd2_pipe2surface(format) != (enum a2xx_sq_surfaceformat)~0)) {<br>
<br>
</span>You said the compiler warning goes away, but is the condition guaranteed<br>
to hit? I expect, with enums having varying size, that this cast will<br>
not always work. I agree with Rob Herring, adding the error value to the<br>
enum is better.<br>
<span><br>
>               retval |= usage & (PIPE_BIND_SAMPLER_VIEW |<br>
>                               PIPE_BIND_VERTEX_BUFFER);<br>
>       }<br>
> @@ -70,7 +70,7 @@ fd2_screen_is_format_supported<wbr>(struct pipe_screen *pscreen,<br>
>                               PIPE_BIND_DISPLAY_TARGET |<br>
>                               PIPE_BIND_SCANOUT |<br>
>                               PIPE_BIND_SHARED)) &&<br>
> -                     (fd2_pipe2color(format) != ~0u)) {<br>
> +                     (fd2_pipe2color(format) != (enum a2xx_colorformatx)~0)) {<br>
>               retval |= usage & (PIPE_BIND_RENDER_TARGET |<br>
>                               PIPE_BIND_DISPLAY_TARGET |<br>
>                               PIPE_BIND_SCANOUT |<br>
> @@ -78,12 +78,12 @@ fd2_screen_is_format_supported<wbr>(struct pipe_screen *pscreen,<br>
>       }<br>
><br>
>       if ((usage & PIPE_BIND_DEPTH_STENCIL) &&<br>
> -                     (fd_pipe2depth(format) != ~0u)) {<br>
> +                     (fd_pipe2depth(format) != (enum adreno_rb_depth_format)~0)) {<br>
>               retval |= PIPE_BIND_DEPTH_STENCIL;<br>
>       }<br>
><br>
>       if ((usage & PIPE_BIND_INDEX_BUFFER) &&<br>
> -                     (fd_pipe2index(format) != ~0u)) {<br>
> +                     (fd_pipe2index(format) != (enum pc_di_index_size)~0)) {<br>
>               retval |= PIPE_BIND_INDEX_BUFFER;<br>
>       }<br>
><br>
> --<br>
> 1.7.9.5<br>
><br>
</span>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>