diff --git a/PPI/Connectors.cc b/PPI/Connectors.cc index 22f39296691b132ecee76ebb2d22272eec171450..4c5a3ea3f7cd7e68263035c677371a9553b868ee 100644 --- a/PPI/Connectors.cc +++ b/PPI/Connectors.cc @@ -41,13 +41,21 @@ prefix_ void senf::ppi::connector::Connector::connect(Connector & target) { // The connector is not registered -> route() or noroute() statement missing - SENF_ASSERT( module_ ); + SENF_ASSERT( module_ && + "senf::ppi::connector::Connector::connect(): (source) " + "Missing route() or noroute()" ); // The connector is already connected - SENF_ASSERT( ! peer_ ); + SENF_ASSERT( ! peer_ && + "senf::ppi::connector::Connector::connect(): (source) " + "duplicate connection" ); // The target connector is not registered -> route() or noroute() statement missing - SENF_ASSERT( target.module_ ); + SENF_ASSERT( target.module_ && + "senf::ppi::connector::Connector::connect(): (target) " + "Missing route() or noroute()" ); // The target connector is already connected - SENF_ASSERT( ! target.peer_ ); + SENF_ASSERT( ! target.peer_ && + "senf::ppi::connector::Connector::connect(): (target) " + "duplicate connection" ); if (! (packetTypeID() == typeid(void) || target.packetTypeID() == typeid(void) || packetTypeID() == target.packetTypeID()) ) @@ -69,7 +77,8 @@ prefix_ void senf::ppi::connector::Connector::connect(Connector & target) prefix_ void senf::ppi::connector::Connector::disconnect() { // Cannot disconnected a non-connected connector - SENF_ASSERT( peer_ ); + SENF_ASSERT( peer_ && + "senf::ppi::connector::Connector::disconnect(): Not connected" ); Connector & peer (*peer_); peer_ = 0; peer.peer_ = 0; diff --git a/PPI/Connectors.cci b/PPI/Connectors.cci index 3f24b5d99521d0b84f041ea4c9223141777d5a03..e6a73911a79d20387537a65f9693a2c3a3bcb281 100644 --- a/PPI/Connectors.cci +++ b/PPI/Connectors.cci @@ -37,7 +37,7 @@ prefix_ senf::ppi::connector::Connector & senf::ppi::connector::Connector::peer( const { // The connector is not connected - SENF_ASSERT(peer_); + SENF_ASSERT(peer_ && "senf::ppi::connect() call missing"); return *peer_; } @@ -46,7 +46,7 @@ prefix_ senf::ppi::module::Module & senf::ppi::connector::Connector::module() { // The connector is not registered in the module -> probably a route() or noroute() statement is // missing. - SENF_ASSERT(module_); + SENF_ASSERT(module_ && "Connector not registered: Missing route() or noroute()"); return *module_; } @@ -162,8 +162,8 @@ prefix_ senf::ppi::connector::PassiveConnector::PassiveConnector() prefix_ void senf::ppi::connector::PassiveConnector::emit() { - // No event callback has been registered (onEvent() call missing) - SENF_ASSERT(callback_); + // No event callback has been registered (onRequest() call missing) + SENF_ASSERT(callback_ && "senf::ppi::connector::PassiveConnector: missing onRequest()"); if (!throttled()) callback_(); } @@ -232,7 +232,8 @@ prefix_ senf::Packet senf::ppi::connector::InputConnector::peek() const { // Cannot peek() head of empty queue - SENF_ASSERT( ! queue_.empty() ); + SENF_ASSERT( ! queue_.empty() && + "senf::ppi::connector::InputConnector: cannot call peek() on empty queue" ); return queue_.back(); } diff --git a/PPI/DebugModules.cc b/PPI/DebugModules.cc index 409c5cef615965ca2614a3415981f0008dbadabc..2826166f13f4ba17c13d198650c915fe38201076 100644 --- a/PPI/DebugModules.cc +++ b/PPI/DebugModules.cc @@ -37,7 +37,9 @@ prefix_ void senf::ppi::module::debug::PassiveSource::request() { - SENF_ASSERT( ! packets_.empty() ); + SENF_ASSERT( ! packets_.empty() && + "senf::ppi::module::debug::PassiveSource::request(): " + "Requesting packet from empty source." ); output(packets_.front()); packets_.pop_front(); if (packets_.empty()) diff --git a/PPI/Events.cti b/PPI/Events.cti index 1dca3da11b03294c2b4a1b0132a9321d1ca2c12d..435fe3a34638acd5d0bd83c9b853401d15199f87 100644 --- a/PPI/Events.cti +++ b/PPI/Events.cti @@ -59,7 +59,8 @@ template <class EventType, class Self> prefix_ senf::ppi::detail::EventBinding<EventType> & senf::ppi::EventImplementationHelper<EventType,Self>::binding() { - SENF_ASSERT( static_cast<Self*>(this)->binding_ ); + SENF_ASSERT( static_cast<Self*>(this)->binding_ && + "senf::ppi::EventImplementationHelper::binding(): Missing registerEvent()" ); return * static_cast<Self*>(this)->binding_; } @@ -89,7 +90,8 @@ template <class Self> prefix_ senf::ppi::detail::EventBinding<void> & senf::ppi::EventImplementationHelper<void,Self>::binding() { - SENF_ASSERT( static_cast<Self*>(this)->binding_ ); + SENF_ASSERT( static_cast<Self*>(this)->binding_ && + "senf::ppi::EventImplementationHelper::binding(): Missing registerEvent()" ); return * static_cast<Self*>(this)->binding_; } diff --git a/PPI/IOEvent.cc b/PPI/IOEvent.cc index ea70efcddad888bc753130ee89459422b65b0f3e..7517e41b3a813667eb642976bb5839e810f91954 100644 --- a/PPI/IOEvent.cc +++ b/PPI/IOEvent.cc @@ -59,8 +59,7 @@ prefix_ void senf::ppi::IOEvent::cb(int event) else if (event & Hup) throw HangupException(); else - // This cannot happen. - SENF_ASSERT(false); + SENF_ASSERT(false && "Internal failure in senf::ppi::IOEvent::cb(int)"); } else { IOEventInfo info = { event }; callback(info); diff --git a/Utils/intrusive_refcount.cci b/Utils/intrusive_refcount.cci index 7ac3df2d573cdf0ee2f15588ad987eb99aa5818a..99b23bc189503f456a014261fef8df6632c73696 100644 --- a/Utils/intrusive_refcount.cci +++ b/Utils/intrusive_refcount.cci @@ -52,7 +52,9 @@ prefix_ void senf::intrusive_refcount_base::add_ref() prefix_ bool senf::intrusive_refcount_base::release() { - SENF_ASSERT(refcount_>0); + SENF_ASSERT(refcount_>0 && + "senf::intrusive_refcount_base: Internal inconsistency: " + "Calling release on dead object."); return --refcount_ == 0; } diff --git a/Utils/pool_alloc_mixin.cti b/Utils/pool_alloc_mixin.cti index e2a80abdd28e45c7d6615b8c067b6509c325fa9f..93b062ffd4fdd82dd08877d7021d9626c584d625 100644 --- a/Utils/pool_alloc_mixin.cti +++ b/Utils/pool_alloc_mixin.cti @@ -36,7 +36,9 @@ prefix_ void * senf::pool_alloc_mixin<Self>::operator new(size_t size) { // When deriving from Self you may not change the class's size without // inheriting from pool_alloc_mixin again. See pool_alloc_mixin documentation. - SENF_ASSERT( size <= sizeof(Self) ); + SENF_ASSERT( size <= sizeof(Self) && + "senf::pool_alloc_mixin::operator new(): " + "Bad object size. Missing pool_alloc_mixin base in derived class?" ); #ifdef SENF_DEBUG allocCounter(1); #endif