[Intel-gfx] [PATCH igt] igt/perf_pmu: Protect macro args
Chris Wilson
chris at chris-wilson.co.uk
Wed Nov 22 19:43:57 UTC 2017
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
--
2.15.0
More information about the Intel-gfx
mailing list