Re: [PATCH igt] igt/perf_pmu: Protect macro args

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxxxxxx>
Cc: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
---
  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@xxxxxxxxx>

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux