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 <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-05-17 22:33:12 -07:00
parent 157e7e2e3b
commit 49000fc3b6

View File

@@ -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)