[Piglit] [PATCH] arb_internalformat_query2: Remove comparison of unsigned expression < 0.

Alejandro Piñeiro apinheiro at igalia.com
Wed Apr 6 08:02:44 UTC 2016


On 06/04/16 03:35, Vinson Lee wrote:
> All paths that call test_data_equal_at_index do so with an unsigned index.
>
> Fixes clang tautological-compare warning.
>
> common.c:880:48: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
>         if (index > data->params_size || index < 0) {
>                                          ~~~~~ ^ ~

As all the other methods at common.h uses int as the type of index, for
consistency, probably it would be better to change the type. Having said
so, as you mention, it is always called with an unsigned index, so
probably it is simpler this way.

So either if you change the type of the parameter, or just use this patch:

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>


> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/spec/arb_internalformat_query2/common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/arb_internalformat_query2/common.c b/tests/spec/arb_internalformat_query2/common.c
> index a50a7b7336a0..e07e2c507ba0 100644
> --- a/tests/spec/arb_internalformat_query2/common.c
> +++ b/tests/spec/arb_internalformat_query2/common.c
> @@ -877,7 +877,7 @@ test_data_equal_at_index(test_data *data,
>                          " auxiliar test data structures\n");
>                  return false;
>          }
> -        if (index > data->params_size || index < 0) {
> +        if (index > data->params_size) {
>                  fprintf(stderr, "ERROR: invalid index while setting"
>                          " auxiliar test data\n");
>                  return false;



More information about the Piglit mailing list