[igt-dev] [PATCH i-g-t] benchmarks/gem_wsim: Avoid labs(unsigned long)

Chris Wilson chris at chris-wilson.co.uk
Wed Feb 12 17:23:33 UTC 2020


Quoting Ville Syrjala (2020-02-12 17:17:32)
> From: Ville Syrjälä <ville.syrjala at 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 at linux.intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list