[Piglit] [PATCH] fs-discard-exit-2: Fix Clang absolute-value warnings.

Brian Paul brianp at vmware.com
Mon Mar 23 07:37:18 PDT 2015


On 03/22/2015 12:46 AM, Vinson Lee wrote:
> fs-discard-exit-2.c:118:13: warning: using floating point absolute value function 'fabs' when argument is of integer type [-Wabsolute-value]
>                          int dx = fabs(sx - x / 8);
>                                   ^
> fs-discard-exit-2.c:118:13: note: use function 'abs' instead
>                          int dx = fabs(sx - x / 8);
>                                   ^~~~
>                                   abs
> fs-discard-exit-2.c:119:13: warning: using floating point absolute value function 'fabs' when argument is of integer type [-Wabsolute-value]
>                          int dy = fabs(sy - y / 8);
>                                   ^
> fs-discard-exit-2.c:119:13: note: use function 'abs' instead
>                          int dy = fabs(sy - y / 8);
>                                   ^~~~
>                                   abs
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   tests/spec/glsl-1.30/execution/fs-discard-exit-2.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c b/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c
> index e9b6cd2..0ce32dc 100644
> --- a/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c
> +++ b/tests/spec/glsl-1.30/execution/fs-discard-exit-2.c
> @@ -115,8 +115,8 @@ piglit_display(void)
>   		for (y = 0; y < SIZE; y++) {
>   			int sx = x % 8;
>   			int sy = y % 8;
> -			int dx = fabs(sx - x / 8);
> -			int dy = fabs(sy - y / 8);
> +			int dx = abs(sx - x / 8);
> +			int dy = abs(sy - y / 8);
>   			float pixel[4];
>
>   			if (dx == 0 && dy == 0) {
>

Reviewed-by: Brian Paul <brianp at vmware.com>




More information about the Piglit mailing list