[Intel-gfx] [PATCH igt] igt/perf_pmu: Protect macro args

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Nov 22 20:05:33 UTC 2017


On 22/11/2017 19:43, Chris Wilson wrote:
> In particular we fix the evaluation of "(double)x" when x is a compound.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>   tests/perf_pmu.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c
> index b8422211..5d5f2b30 100644
> --- a/tests/perf_pmu.c
> +++ b/tests/perf_pmu.c
> @@ -99,10 +99,10 @@ static void pmu_read_multi(int fd, unsigned int num, uint64_t *val)
>   }
>   
>   #define assert_within_epsilon(x, ref, tolerance) \
> -	igt_assert_f((double)(x) <= (1.0 + tolerance) * (double)ref && \
> -		     (double)(x) >= (1.0 - tolerance) * (double)ref, \
> +	igt_assert_f((double)(x) <= (1.0 + (tolerance)) * (double)(ref) && \
> +		     (double)(x) >= (1.0 - (tolerance)) * (double)(ref), \
>   		     "'%s' != '%s' (%f not within %f%% tolerance of %f)\n",\
> -		     #x, #ref, (double)x, tolerance * 100.0, (double)ref)
> +		     #x, #ref, (double)(x), (tolerance) * 100.0, (double)ref)
>   
>   /*
>    * Helper for cases where we assert on time spent sleeping (directly or
> 

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list