From 49000fc3b6c81a8480dcd300d12ee091a141dbb3 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 17 May 2021 22:33:12 -0700 Subject: [PATCH] base: Surround a DPRINTFS parameter in ()s. Since DPRINTFS is a macro, its arguments need to be properly wrapped so they expand as expected when used in expressions. This wasn't being done for the s argument which was used as s->name(). If s contained some other operator which had lower precedence than ->, the -> would happen first to whatever was on the right hand side. Change-Id: Id3250abb9ba51c4b0740f8de0d80ed730ba96944 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45619 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/base/trace.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/trace.hh b/src/base/trace.hh index fff05f7644..9e3984f335 100644 --- a/src/base/trace.hh +++ b/src/base/trace.hh @@ -189,7 +189,7 @@ const std::string &name(); #define DPRINTFS(x, s, ...) do { \ if (GEM5_UNLIKELY(TRACING_ON && Debug::x)) { \ Trace::getDebugLogger()->dprintf_flag( \ - curTick(), s->name(), #x, __VA_ARGS__); \ + curTick(), (s)->name(), #x, __VA_ARGS__); \ } \ } while (0)