From e3725de9fa5053f3a7db2cc0dfe05a9d1957555e Mon Sep 17 00:00:00 2001 From: Ivan Butygin Date: Mon, 24 Sep 2018 22:44:52 +0300 Subject: [PATCH] ADE version 0.1.1b (#4) --- sources/ade/include/ade/communication/comm_buffer.hpp | 1 + sources/ade/include/ade/util/assert.hpp | 5 +++++ sources/ade/include/ade/util/checked_cast.hpp | 1 + sources/ade/include/ade/util/md_view.hpp | 1 + sources/ade/source/memory_descriptor_view.cpp | 2 ++ sources/ade/source/passes/communications.cpp | 2 ++ 6 files changed, 12 insertions(+) diff --git a/sources/ade/include/ade/communication/comm_buffer.hpp b/sources/ade/include/ade/communication/comm_buffer.hpp index 6f6d2d3..b2baaca 100644 --- a/sources/ade/include/ade/communication/comm_buffer.hpp +++ b/sources/ade/include/ade/communication/comm_buffer.hpp @@ -107,6 +107,7 @@ class DataBufferView final Span ret = span + m_span.origin(); for (auto i: util::iota(m_span.dims_count())) { + ADE_UNUSED(i); ADE_ASSERT(ret[i].begin >= m_span[i].begin); ADE_ASSERT(ret[i].end <= m_span[i].end); } diff --git a/sources/ade/include/ade/util/assert.hpp b/sources/ade/include/ade/util/assert.hpp index 7460bb1..9efc9ce 100644 --- a/sources/ade/include/ade/util/assert.hpp +++ b/sources/ade/include/ade/util/assert.hpp @@ -70,6 +70,11 @@ namespace details /// @param str String description. #define ADE_UNREACHABLE(str) ADE_ASSERT_STRONG(!str) +/// Mark variable UNUSED, suitable if it is used only in ADE_ASSERT +/// +/// @param x Variable to mark +#define ADE_UNUSED(x) (void)(x) + namespace ade { /// Convenient function for exception throwing. diff --git a/sources/ade/include/ade/util/checked_cast.hpp b/sources/ade/include/ade/util/checked_cast.hpp index 94527d0..063857f 100644 --- a/sources/ade/include/ade/util/checked_cast.hpp +++ b/sources/ade/include/ade/util/checked_cast.hpp @@ -104,6 +104,7 @@ struct CheckedCastDefHandler final template void operator()(bool valid, T&& /*value*/) const { + ADE_UNUSED(valid); ADE_ASSERT(valid); } }; diff --git a/sources/ade/include/ade/util/md_view.hpp b/sources/ade/include/ade/util/md_view.hpp index f1dd4a9..091d9f9 100644 --- a/sources/ade/include/ade/util/md_view.hpp +++ b/sources/ade/include/ade/util/md_view.hpp @@ -431,6 +431,7 @@ struct DynMdView final ADE_ASSERT(span.dims_count() == count()); for (auto i: util::iota(count())) { + ADE_UNUSED(i); ADE_ASSERT(span[i].begin <= span[i].end); ADE_ASSERT(span[i].begin >= 0 && span[i].end <= dimensions[i].length); } diff --git a/sources/ade/source/memory_descriptor_view.cpp b/sources/ade/source/memory_descriptor_view.cpp index 6b762e2..8937fac 100644 --- a/sources/ade/source/memory_descriptor_view.cpp +++ b/sources/ade/source/memory_descriptor_view.cpp @@ -310,10 +310,12 @@ bool operator!=(const MemoryDescriptorView& ref, std::nullptr_t) void MemoryDescriptorView::checkSpans(MemoryDescriptor& descriptor) const { + ADE_UNUSED(descriptor); ADE_ASSERT(descriptor.dimensions().dims_count() == m_span.dims_count()); for (auto i: util::iota(m_span.dims_count())) { auto& val = m_span[i]; + ADE_UNUSED(val); ADE_ASSERT(val.begin >= 0); ADE_ASSERT(val.end <= descriptor.dimensions()[i]); } diff --git a/sources/ade/source/passes/communications.cpp b/sources/ade/source/passes/communications.cpp index 7ed05dc..63b4e7c 100644 --- a/sources/ade/source/passes/communications.cpp +++ b/sources/ade/source/passes/communications.cpp @@ -293,6 +293,7 @@ ade::IDataBuffer::MapId HostBufferImpl::map(const Span& span, Access /*access*/) ADE_ASSERT(nullptr != view); ADE_ASSERT(span.dims_count() == m_size.dims_count()); auto accessCount = ++m_accessCount; + ADE_UNUSED(accessCount); ADE_ASSERT(accessCount > 0); return MapId{view.slice(span), 0}; } @@ -300,6 +301,7 @@ ade::IDataBuffer::MapId HostBufferImpl::map(const Span& span, Access /*access*/) void HostBufferImpl::unmap(const MapId& /*id*/) { auto accessCount = --m_accessCount; + ADE_UNUSED(accessCount); ADE_ASSERT(accessCount >= 0); }