From c456c31a5871a4ae1a8bbc687557ff304078aacc Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Tue, 13 Oct 2020 14:40:29 +0100 Subject: [PATCH] IVGCVSW-5434 Remove boost/preprocessor.hpp Change-Id: I51462d18ce0be4b88a23453cfdd16510f30dd1e3 Signed-off-by: Jim Flynn --- src/armnn/Profiling.hpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/armnn/Profiling.hpp b/src/armnn/Profiling.hpp index 08e55a1..c0d37dc 100644 --- a/src/armnn/Profiling.hpp +++ b/src/armnn/Profiling.hpp @@ -156,15 +156,21 @@ private: } // namespace armnn - -#include - -#define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(backendId, /*name,*/ ...) \ - armnn::ScopedProfilingEvent BOOST_PP_CAT(e_,__LINE__)(backendId, /*name,*/ __VA_ARGS__); - -// The event name must be known at compile time +#define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC_INNER(lineNumber, backendId, /*name,*/ ...) \ + armnn::ScopedProfilingEvent e_ ## lineNumber(backendId, /*name,*/ __VA_ARGS__); + +#define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(lineNumber, backendId, /*name,*/ ...) \ + ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC_INNER(lineNumber, backendId, /*name,*/ __VA_ARGS__) + +// The event name must be known at compile time i.e. if you are going to use this version of the macro +// in code the first argument you supply after the backendId must be the name. +// NOTE: need to pass the line number as an argument from here so by the time it gets to the UNIQUE_LOC_INNER +// above it has expanded to a string and will concat (##) correctly with the 'e_' prefix to yield a +// legal and unique variable name (so long as you don't use the macro twice on the same line). +// The concat preprocessing operator (##) very unhelpfully will not expand macros see +// https://gcc.gnu.org/onlinedocs/cpp/Concatenation.html for the gory details. #define ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(backendId, /*name,*/ ...) \ - ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(backendId, /*name,*/ __VA_ARGS__); + ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS_UNIQUE_LOC(__LINE__,backendId, /*name,*/ __VA_ARGS__) #define ARMNN_SCOPED_PROFILING_EVENT(backendId, name) \ ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(backendId, name, armnn::WallClockTimer()) -- 2.7.4