From 837f3f04793851278bb1d2cca21b5a0fbd7e3029 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 23 Apr 2018 15:50:00 -0700 Subject: ART: Fix SCOPED_TRACE macro Correctly evaluate __LINE__ through a preprocessor indirection. Avoid duplicate-variable errors for multiple SCOPED_TRACE uses. Test: mmma art Change-Id: Ib1960b5e2c6ddcbaf766b7d1cb2927ccf5925593 --- libartbase/base/systrace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libartbase/base/systrace.h b/libartbase/base/systrace.h index 2ff33e8c84..d995dce285 100644 --- a/libartbase/base/systrace.h +++ b/libartbase/base/systrace.h @@ -24,6 +24,7 @@ #include #include "android-base/stringprintf.h" +#include "macros.h" namespace art { @@ -75,7 +76,7 @@ class ScopedTraceNoStart { }; #define SCOPED_TRACE \ - ::art::ScopedTraceNoStart trace ## __LINE__; \ + ::art::ScopedTraceNoStart APPEND_TOKENS_AFTER_EVAL(trace, __LINE__) ; \ (ATRACE_ENABLED()) && ::art::ScopedTraceNoStart::ScopedTraceMessageHelper().stream() } // namespace art -- cgit v1.2.3-59-g8ed1b