[Mesa-dev] [PATCH] glsl: Fix tautological comparison.

Kenneth Graunke kenneth at whitecape.org
Fri Nov 21 17:02:46 PST 2014


On Friday, November 21, 2014 03:19:12 PM Matt Turner wrote:
> Caught by clang.
> 
> warning: comparison of constant -1 with expression of type
>          'ir_texture_opcode' is always false
>       [-Wtautological-constant-out-of-range-compare]
>       if (op == -1)
>           ~~ ^  ~~
> ---
>  src/glsl/ir_reader.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
> index ae00e79..fd318c0 100644
> --- a/src/glsl/ir_reader.cpp
> +++ b/src/glsl/ir_reader.cpp
> @@ -972,7 +972,7 @@ ir_reader::read_texture(s_expression *expr)
>        op = ir_query_levels;
>     } else if (MATCH(expr, other_pattern)) {
>        op = ir_texture::get_opcode(tag->value());
> -      if (op == -1)
> +      if (op == (ir_texture_opcode) -1)
>  	 return NULL;
>     } else {
>        ir_read_error(NULL, "unexpected texture pattern %s", tag->value());
> 

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141121/98fd7e49/attachment.sig>


More information about the mesa-dev mailing list