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

@ -615,8 +615,7 @@ namespace spot
res_ = now_to_concat();
return;
}
/* Unreachable code. */
assert(0);
SPOT_UNREACHABLE();
}
void
@ -631,8 +630,7 @@ namespace spot
case unop::Closure:
case unop::NegClosure:
case unop::NegClosureMarked:
assert(!"not a rational operator");
return;
SPOT_UNREACHABLE(); // Because not rational operator
case unop::Not:
{
// Not can only appear in front of Boolean
@ -644,8 +642,7 @@ namespace spot
return;
}
}
/* Unreachable code. */
assert(0);
SPOT_UNREACHABLE();
}
void
@ -726,20 +723,19 @@ namespace spot
}
return;
}
/* Unreachable code. */
assert(0);
SPOT_UNREACHABLE();
}
void
visit(const binop*)
{
assert(!"not a rational operator");
SPOT_UNREACHABLE(); // Not a rational operator
}
void
visit(const automatop*)
{
assert(!"not a rational operator");
SPOT_UNREACHABLE(); // Not a rational operator
}
void
@ -938,7 +934,7 @@ namespace spot
}
case multop::And:
case multop::Or:
assert(!"not a rational operator");
SPOT_UNREACHABLE(); // Not a rational operator
}
}
@ -1238,11 +1234,9 @@ namespace spot
res_ = bddfalse;
return;
case constant::EmptyWord:
assert(!"Not an LTL operator");
return;
SPOT_UNIMPLEMENTED();
}
/* Unreachable code. */
assert(0);
SPOT_UNREACHABLE();
}
void
@ -1443,15 +1437,14 @@ namespace spot
break;
case unop::Finish:
assert(!"unsupported operator");
break;
SPOT_UNIMPLEMENTED();
}
}
void
visit(const bunop*)
{
assert(!"Not an LTL operator");
SPOT_UNREACHABLE(); // Not an LTL operator
}
void
@ -1468,8 +1461,7 @@ namespace spot
// These operators should only appear in Boolean formulas,
// which must have been dealt with earlier (in
// translate_dict::ltl_to_bdd()).
assert(!"unexpected operator");
break;
SPOT_UNREACHABLE();
case binop::U:
{
bdd f1 = recurse(node->first());
@ -1651,7 +1643,7 @@ namespace spot
void
visit(const automatop*)
{
assert(!"unsupported operator");
SPOT_UNIMPLEMENTED();
}
void
@ -1712,8 +1704,7 @@ namespace spot
case multop::AndNLM:
case multop::AndRat:
case multop::OrRat:
assert(!"Not an LTL operator");
break;
SPOT_UNREACHABLE(); // Not an LTL operator
}
}
@ -1839,20 +1830,19 @@ namespace spot
// FIXME: we might need to add Acc[1]
return;
}
/* Unreachable code. */
assert(0);
SPOT_UNREACHABLE();
}
void
visit(const automatop*)
{
assert(!"unsupported operator");
SPOT_UNIMPLEMENTED();
}
void
visit(const bunop*)
{
assert(!"unsupported operator");
SPOT_UNIMPLEMENTED();
}
void