libuavcan core now uses UAVCAN_ASSERT() instead of assert() (autoreplace)

This commit is contained in:
Pavel Kirienko
2014-07-12 17:17:09 +04:00
parent cf19d86842
commit 530242819d
55 changed files with 208 additions and 208 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ int GenericSubscriberBase::genericStart(TransferListenerBase* listener,
{
if (listener == NULL)
{
assert(0);
UAVCAN_ASSERT(0);
return -ErrLogic;
}
stop(listener);
@@ -22,7 +22,7 @@ GlobalDataTypeRegistry::List* GlobalDataTypeRegistry::selectList(DataTypeKind ki
}
else
{
assert(0);
UAVCAN_ASSERT(0);
return NULL;
}
}
@@ -31,7 +31,7 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::remove(Entry* dtd)
{
if (!dtd)
{
assert(0);
UAVCAN_ASSERT(0);
return RegistResultInvalidParams;
}
if (isFrozen())
@@ -63,7 +63,7 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::registImpl(Entry* d
{
if (!dtd || (dtd->descriptor.getID() > DataTypeID::Max))
{
assert(0);
UAVCAN_ASSERT(0);
return RegistResultInvalidParams;
}
if (isFrozen())
@@ -103,7 +103,7 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::registImpl(Entry* d
const unsigned len_after = list->getLength();
if ((len_before + 1) != len_after)
{
assert(0);
UAVCAN_ASSERT(0);
std::abort();
}
}
@@ -114,7 +114,7 @@ GlobalDataTypeRegistry::RegistResult GlobalDataTypeRegistry::registImpl(Entry* d
{
if (id >= p->descriptor.getID().get())
{
assert(0);
UAVCAN_ASSERT(0);
std::abort();
}
id = p->descriptor.getID().get();
@@ -145,13 +145,13 @@ const DataTypeDescriptor* GlobalDataTypeRegistry::find(DataTypeKind kind, const
{
if (!name)
{
assert(0);
UAVCAN_ASSERT(0);
return NULL;
}
const List* list = selectList(kind);
if (!list)
{
assert(0);
UAVCAN_ASSERT(0);
return NULL;
}
Entry* p = list->get();
@@ -171,7 +171,7 @@ const DataTypeDescriptor* GlobalDataTypeRegistry::find(DataTypeKind kind, DataTy
const List* list = selectList(kind);
if (!list)
{
assert(0);
UAVCAN_ASSERT(0);
return NULL;
}
Entry* p = list->get();
@@ -189,12 +189,12 @@ const DataTypeDescriptor* GlobalDataTypeRegistry::find(DataTypeKind kind, DataTy
DataTypeSignature GlobalDataTypeRegistry::computeAggregateSignature(DataTypeKind kind,
DataTypeIDMask& inout_id_mask) const
{
assert(isFrozen()); // Computing the signature if the registry is not frozen is pointless
UAVCAN_ASSERT(isFrozen()); // Computing the signature if the registry is not frozen is pointless
const List* list = selectList(kind);
if (!list)
{
assert(0);
UAVCAN_ASSERT(0);
return DataTypeSignature();
}
@@ -220,13 +220,13 @@ DataTypeSignature GlobalDataTypeRegistry::computeAggregateSignature(DataTypeKind
signature_initialized = true;
}
assert(prev_dtid < dtid); // Making sure that list is ordered properly
UAVCAN_ASSERT(prev_dtid < dtid); // Making sure that list is ordered properly
prev_dtid++;
while (prev_dtid < dtid)
{
inout_id_mask[prev_dtid++] = false; // Erasing bits for missing types
}
assert(prev_dtid == dtid);
UAVCAN_ASSERT(prev_dtid == dtid);
p = p->getNextListNode();
}
@@ -245,13 +245,13 @@ void GlobalDataTypeRegistry::getDataTypeIDMask(DataTypeKind kind, DataTypeIDMask
const List* list = selectList(kind);
if (!list)
{
assert(0);
UAVCAN_ASSERT(0);
return;
}
Entry* p = list->get();
while (p)
{
assert(p->descriptor.getKind() == kind);
UAVCAN_ASSERT(p->descriptor.getKind() == kind);
mask[p->descriptor.getID().get()] = true;
p = p->getNextListNode();
}
+7 -7
View File
@@ -13,7 +13,7 @@ namespace uavcan
*/
void DeadlineHandler::startWithDeadline(MonotonicTime deadline)
{
assert(!deadline.isZero());
UAVCAN_ASSERT(!deadline.isZero());
stop();
deadline_ = deadline;
scheduler_.getDeadlineScheduler().add(this);
@@ -49,19 +49,19 @@ struct MonotonicDeadlineHandlerInsertionComparator
void DeadlineScheduler::add(DeadlineHandler* mdh)
{
assert(mdh);
UAVCAN_ASSERT(mdh);
handlers_.insertBefore(mdh, MonotonicDeadlineHandlerInsertionComparator(mdh->getDeadline()));
}
void DeadlineScheduler::remove(DeadlineHandler* mdh)
{
assert(mdh);
UAVCAN_ASSERT(mdh);
handlers_.remove(mdh);
}
bool DeadlineScheduler::doesExist(const DeadlineHandler* mdh) const
{
assert(mdh);
UAVCAN_ASSERT(mdh);
const DeadlineHandler* p = handlers_.get();
#if UAVCAN_DEBUG
MonotonicTime prev_deadline;
@@ -96,7 +96,7 @@ MonotonicTime DeadlineScheduler::pollAndGetMonotonicTime(ISystemClock& sysclock)
#if UAVCAN_DEBUG
if (mdh->getNextListNode()) // Order check
{
assert(mdh->getDeadline() <= mdh->getNextListNode()->getDeadline());
UAVCAN_ASSERT(mdh->getDeadline() <= mdh->getNextListNode()->getDeadline());
}
#endif
@@ -109,7 +109,7 @@ MonotonicTime DeadlineScheduler::pollAndGetMonotonicTime(ISystemClock& sysclock)
handlers_.remove(mdh);
mdh->handleDeadline(ts); // This handler can be re-registered immediately
}
assert(0);
UAVCAN_ASSERT(0);
return MonotonicTime();
}
@@ -156,7 +156,7 @@ int Scheduler::spin(MonotonicTime deadline)
{
if (inside_spin_) // Preventing recursive calls
{
assert(0);
UAVCAN_ASSERT(0);
return -ErrRecursiveCall;
}
inside_spin_ = true;
+2 -2
View File
@@ -12,7 +12,7 @@ namespace uavcan
*/
void TimerBase::handleDeadline(MonotonicTime current)
{
assert(!isRunning());
UAVCAN_ASSERT(!isRunning());
const MonotonicTime scheduled_time = getDeadline();
@@ -41,7 +41,7 @@ void TimerBase::startOneShotWithDelay(MonotonicDuration delay)
void TimerBase::startPeriodic(MonotonicDuration period)
{
assert(period < MonotonicDuration::getInfinite());
UAVCAN_ASSERT(period < MonotonicDuration::getInfinite());
stop();
period_ = period;
DeadlineHandler::startWithDelay(period);