use SPOT_ASSERT instead of assert

For #184.

* spot/graph/graph.hh, spot/kripke/kripkegraph.hh,
spot/misc/bitvect.hh, spot/misc/common.hh, spot/misc/fixpool.hh,
spot/misc/mspool.hh, spot/misc/timer.hh, spot/tl/formula.hh,
spot/twa/acc.hh, spot/twa/taatgba.hh, spot/twa/twa.hh,
spot/twa/twagraph.hh, spot/twaalgos/emptiness_stats.hh,
spot/twaalgos/mask.hh, spot/twaalgos/ndfs_result.hxx,
spot/twaalgos/sccinfo.hh, spot/twaalgos/translate.hh: Replace
assert() by SPOT_ASSERT(), or an exception, or nothing, depending
on the case.
* tests/sanity/style.test: Flag all asserts in headers.
* HACKING: Discuss assertions.
This commit is contained in:
Alexandre Duret-Lutz 2016-07-24 23:26:59 +02:00
parent 9f7bf5ab2d
commit 20cf43b3ea
19 changed files with 163 additions and 124 deletions

View file

@ -191,7 +191,9 @@ namespace spot
{
if (op_ != o)
return nullptr;
assert(size_ == 1);
if (SPOT_UNLIKELY(size_ != 1))
throw std::invalid_argument
("get_child_of() expecting single-child node");
return nth(0);
}
@ -211,14 +213,18 @@ namespace spot
/// \see formula::min
unsigned min() const
{
assert(op_ == op::FStar || op_ == op::Star);
if (SPOT_UNLIKELY(op_ != op::FStar && op_ != op::Star))
throw std::invalid_argument
("min() only works on Star and FStar nodes");
return min_;
}
/// \see formula::max
unsigned max() const
{
assert(op_ == op::FStar || op_ == op::Star);
if (SPOT_UNLIKELY(op_ != op::FStar && op_ != op::Star))
throw std::invalid_argument
("max() only works on Star and FStar nodes");
return max_;
}
@ -580,8 +586,8 @@ namespace spot
bool
operator()(const fnode* left, const fnode* right) const
{
assert(left);
assert(right);
SPOT_ASSERT(left);
SPOT_ASSERT(right);
if (left == right)
return false;