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

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2011, 2012, 2013, 2014, 2015 Laboratoire de
// Copyright (C) 2009, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -91,7 +91,7 @@ namespace spot
void
start()
{
assert(!running);
SPOT_ASSERT(!running);
running = true;
#ifdef SPOT_HAVE_TIMES
struct tms tmp;
@ -115,7 +115,7 @@ namespace spot
#else
total_.utime += clock() - start_.utime;
#endif
assert(running);
SPOT_ASSERT(running);
running = false;
}
@ -194,8 +194,9 @@ namespace spot
cancel(const std::string& name)
{
tm_type::iterator i = tm.find(name);
assert(i != tm.end());
assert(0 < i->second.second);
if (SPOT_UNLIKELY(i == tm.end()))
throw std::invalid_argument("timer_map::cancel(): unknown name");
SPOT_ASSERT(0 < i->second.second);
if (0 == --i->second.second)
tm.erase(i);
}
@ -205,7 +206,8 @@ namespace spot
timer(const std::string& name) const
{
tm_type::const_iterator i = tm.find(name);
assert(i != tm.end());
if (SPOT_UNLIKELY(i == tm.end()))
throw std::invalid_argument("timer_map::timer(): unknown name");
return i->second.first;
}