From 089b7ecf63177a72f70168678b004aa50fc58312 Mon Sep 17 00:00:00 2001 From: Simon Hoinkis Date: Tue, 25 Oct 2022 16:25:34 +0200 Subject: [PATCH] iox-#1751 Replace 'assert's with 'Expects' --- .../internal/cxx/variant_internal.hpp | 15 ++++++++------- .../iceoryx_hoofs/internal/cxx/variant_queue.inl | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_internal.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_internal.hpp index b71d0d869a7..9e56e63e512 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_internal.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_internal.hpp @@ -17,7 +17,8 @@ #ifndef IOX_HOOFS_CXX_VARIANT_INTERNAL_HPP #define IOX_HOOFS_CXX_VARIANT_INTERNAL_HPP -#include +#include "iceoryx_hoofs/cxx/requires.hpp" + #include #include #include @@ -191,7 +192,7 @@ struct call_at_index } else { - assert(false && "Could not call destructor for variant element"); + ExpectsWithMsg(false, "Could not call destructor for variant element"); } } @@ -207,7 +208,7 @@ struct call_at_index } else { - assert(false && "Could not call move assignment for variant element"); + ExpectsWithMsg(false, "Could not call move assignment for variant element"); } } @@ -223,7 +224,7 @@ struct call_at_index } else { - assert(false && "Could not call move constructor for variant element"); + ExpectsWithMsg(false, "Could not call move constructor for variant element"); } } @@ -237,7 +238,7 @@ struct call_at_index } else { - assert(false && "Could not call copy assignment for variant element"); + ExpectsWithMsg(false, "Could not call copy assignment for variant element"); } } @@ -253,7 +254,7 @@ struct call_at_index } else { - assert(false && "Could not call copy constructor for variant element"); + ExpectsWithMsg(false, "Could not call copy constructor for variant element"); } } @@ -267,7 +268,7 @@ struct call_at_index // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) return *reinterpret_cast(lhs) == *reinterpret_cast(rhs); } - assert(false && "Could not call equality operator for variant element"); + ExpectsWithMsg(false, "Could not call equality operator for variant element"); return false; } }; diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_queue.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_queue.inl index ea0dc772b3a..becb7d1fc0c 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_queue.inl +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/variant_queue.inl @@ -192,7 +192,7 @@ inline bool VariantQueue::setCapacity(const uint64_t newCap case VariantQueueTypes::FiFo_SingleProducerSingleConsumer: { /// @todo iox-#1147 must be implemented for FiFo - assert(false); + Expects(false); return false; } case VariantQueueTypes::SoFi_SingleProducerSingleConsumer: