IVGCVSW-4485 Introduce ARMNN_ASSERT(_MSG) macros
authorDerek Lamberti <derek.lamberti@arm.com>
Wed, 19 Feb 2020 13:25:42 +0000 (13:25 +0000)
committerDerek Lamberti <derek.lamberti@arm.com>
Thu, 5 Mar 2020 09:02:38 +0000 (09:02 +0000)
Change-Id: Iba372f7311a68877a42e52595430db212c5c9fec
Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
CMakeLists.txt
include/armnn/utility/Assert.hpp [new file with mode: 0644]

index b85030a..2f8761a 100644 (file)
@@ -247,6 +247,7 @@ list(APPEND armnn_sources
     include/armnn/Version.hpp
     include/armnn/profiling/IProfilingGuidGenerator.hpp
     include/armnn/profiling/ISendTimelinePacket.hpp
+    include/armnn/utility/Assert.hpp
     include/armnn/utility/IgnoreUnused.hpp
     profiling/common/include/SocketConnectionException.hpp
     src/armnn/layers/LayerCloneBase.hpp
diff --git a/include/armnn/utility/Assert.hpp b/include/armnn/utility/Assert.hpp
new file mode 100644 (file)
index 0000000..4d2f47b
--- /dev/null
@@ -0,0 +1,21 @@
+//
+// Copyright © 2020 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#pragma once
+
+#include <cassert>
+
+namespace armnn
+{
+
+#ifndef NDEBUG
+#   define ARMNN_ASSERT(COND) assert(COND)
+#   define ARMNN_ASSERT_MSG(COND, MSG) assert(COND && MSG)
+#else
+#   define ARMNN_ASSERT(COND)
+#   define ARMNN_ASSERT_MSG(COND, MSG)
+#endif
+
+} //namespace armnn
\ No newline at end of file