common: introduce SPOT_UNREACHABLE and SPOT_UNIMPLEMENTED.

* src/misc/common.hh (SPOT_UNIMPLEMENTED, SPOT_UNREACHABLE,
SPOT_UNREACHABLE_BUILTIN): New macros.
* src/bin/dstar2tgba.cc, src/bin/ltlcross.cc,
src/dstarparse/dstar2tgba.cc, src/eltlparse/eltlparse.yy,
src/ltlast/binop.cc, src/ltlast/bunop.cc, src/ltlast/constant.cc,
src/ltlast/formula_tree.cc, src/ltlast/multop.cc, src/ltlast/nfa.cc,
src/ltlast/unop.cc, src/ltlvisit/dotty.cc, src/ltlvisit/lbt.cc,
src/ltlvisit/lunabbrev.cc, src/ltlvisit/mark.cc,
src/ltlvisit/randomltl.cc, src/ltlvisit/simpfg.cc,
src/ltlvisit/simplify.cc, src/ltlvisit/snf.cc, src/ltlvisit/tostring.cc,
src/misc/intvcomp.cc, src/misc/minato.cc, src/tgba/bdddict.cc,
src/tgba/formula2bdd.cc, src/tgba/tgbasafracomplement.cc,
src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/ltl2taa.cc,
src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/ltl2tgba_lacim.cc,
src/tgbaalgos/simulation.cc, src/tgbatest/ltl2tgba.cc:  Use them.
* src/sanity/style.test: Catch assert(0) and assert(!"text");
This commit is contained in:
Alexandre Duret-Lutz 2014-06-27 14:42:54 +02:00
parent c93b41a2c7
commit 2beacc3924
33 changed files with 190 additions and 227 deletions

View file

@ -300,9 +300,7 @@ namespace spot
case UConcat:
return "UConcat";
}
// Unreachable code.
assert(0);
return 0;
SPOT_UNREACHABLE();
}
binop::map binop::instances;

View file

@ -107,9 +107,7 @@ namespace spot
case Star:
return "Star";
}
// Unreachable code.
assert(0);
return 0;
SPOT_UNREACHABLE();
}
std::string

View file

@ -100,9 +100,7 @@ namespace spot
case EmptyWord:
return "constant(e)";
}
// Unreachable code.
assert(0);
return "BUG";
SPOT_UNREACHABLE();
}
void
@ -123,9 +121,7 @@ namespace spot
case EmptyWord:
return "[*0]";
}
// Unreachable code.
assert(0);
return 0;
SPOT_UNREACHABLE();
}
}
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012, 2013 Laboratoire de Recherche et
// Copyright (C) 2009, 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -53,10 +53,7 @@ namespace spot
return multop::instance(n->op,
instanciate(n->lhs, v),
instanciate(n->rhs, v));
/* Unreachable code. */
assert(0);
return 0;
SPOT_UNREACHABLE();
}
size_t
@ -78,10 +75,7 @@ namespace spot
return std::max(arity(n->lhs), arity(n->rhs));
if (node_multop* n = dynamic_cast<node_multop*>(np.get()))
return std::max(arity(n->lhs), arity(n->rhs));
/* Unreachable code. */
assert(0);
return 0;
SPOT_UNREACHABLE();
}
}
}

View file

@ -185,9 +185,7 @@ namespace spot
case Fusion:
return "Fusion";
}
// Unreachable code.
assert(0);
return 0;
SPOT_UNREACHABLE();
}
namespace

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2013 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
// Copyright (C) 2008, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -106,8 +106,7 @@ namespace spot
const nfa::state*
nfa::get_init_state()
{
if (!init_)
assert(0);
assert(init_);
return init_;
}

View file

@ -189,9 +189,7 @@ namespace spot
case NegClosureMarked:
return "NegClosureMarked";
}
// Unreachable code.
assert(0);
return 0;
SPOT_UNREACHABLE();
}
unop::map unop::instances;