public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Avoid labs(unsigned long)
@ 2020-02-12 17:17 Ville Syrjala
  2020-02-12 17:23 ` Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ville Syrjala @ 2020-02-12 17:17 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

../benchmarks/gem_wsim.c: In function ‘calibrate_nop’:
../benchmarks/gem_wsim.c:2999:4: warning: taking the absolute value of unsigned type ‘long unsigned int’ has no effect [-Wabsolute-value]
 2999 |    labs(size - last_size) > (size * tolerance_pct / 100));

Frankly the warning looks like nonsense to me, unless the compiler
actually optimizes the labs() away. Otherwise there's going to be an
implicit cast to signed long anyway since that's what labs() takes.
But the warning is easy enough to avoid here so let's do it.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 benchmarks/gem_wsim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c
index 0ef1cf28f76f..aaf3a16198df 100644
--- a/benchmarks/gem_wsim.c
+++ b/benchmarks/gem_wsim.c
@@ -2969,7 +2969,7 @@ static unsigned long calibrate_nop(unsigned int tolerance_pct, struct intel_exec
 		.buffers_ptr = (uintptr_t)&obj,
 		.flags = engine->flags
 	};
-	unsigned long size, last_size;
+	long size, last_size;
 	struct timespec t_0, t_end;
 
 	clock_gettime(CLOCK_MONOTONIC, &t_0);
-- 
2.24.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-14 20:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-12 17:17 [igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Avoid labs(unsigned long) Ville Syrjala
2020-02-12 17:23 ` Chris Wilson
2020-02-12 18:55 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-02-14 20:23 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox