All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Avoid labs(unsigned long)
Date: Wed, 12 Feb 2020 19:17:32 +0200	[thread overview]
Message-ID: <20200212171732.2187-1-ville.syrjala@linux.intel.com> (raw)

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

             reply	other threads:[~2020-02-12 17:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 17:17 Ville Syrjala [this message]
2020-02-12 17:23 ` [igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Avoid labs(unsigned long) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200212171732.2187-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.