[Piglit] [PATCH] gl-1.0-readpixsanity: Fix Clang absolute-value warning.

Vinson Lee vlee at freedesktop.org
Tue Mar 3 18:26:28 PST 2015


readpix.c:238:10: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
                                dd = abs(actual - expected);
                                     ^
readpix.c:238:10: note: use function 'fabs' instead
                                dd = abs(actual - expected);
                                     ^~~
                                     fabs

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/spec/gl-1.0/readpix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/spec/gl-1.0/readpix.c b/tests/spec/gl-1.0/readpix.c
index 9597706..a2822b4 100644
--- a/tests/spec/gl-1.0/readpix.c
+++ b/tests/spec/gl-1.0/readpix.c
@@ -235,7 +235,7 @@ check_depth(void)
 		for (y = 0; y < h; ++y) {
 			for (x = 0; x < w; ++x) {
 				actual = buf[y*w + x]/(double)0xffffffffU;
-				dd = abs(actual - expected);
+				dd = fabs(actual - expected);
 				err = error_bits(dd, dbits);
 				if (err > current_error) {
 					current_error = err;
-- 
2.3.1



More information about the Piglit mailing list