IVGCVSW-5434 Remove boost/preprocessor.hpp
authorJim Flynn <jim.flynn@arm.com>
Tue, 13 Oct 2020 13:40:29 +0000 (14:40 +0100)
committerJim Flynn <jim.flynn@arm.com>
Tue, 13 Oct 2020 13:40:29 +0000 (14:40 +0100)
Change-Id: I51462d18ce0be4b88a23453cfdd16510f30dd1e3
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
src/armnn/Profiling.hpp

index 08e55a1..c0d37dc 100644 (file)
@@ -156,15 +156,21 @@ private:
 
 } // namespace armnn
 
-
-#include <boost/preprocessor.hpp>
-
-#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())