always capture exceptions by const references
For #199. * tests/sanity/style.test: Test this. * bin/ltlcross.cc, spot/parseaut/parseaut.yy, tests/ltsmin/modelcheck.cc: Fix it.
This commit is contained in:
parent
2a308182db
commit
2d18ac22fb
4 changed files with 10 additions and 6 deletions
|
|
@ -1403,7 +1403,7 @@ namespace
|
||||||
sm = new
|
sm = new
|
||||||
spot::scc_info(p, spot::scc_info_options::TRACK_STATES);
|
spot::scc_info(p, spot::scc_info_options::TRACK_STATES);
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc&)
|
catch (const std::bad_alloc&)
|
||||||
{
|
{
|
||||||
std::cerr << ("warning: not enough memory to build "
|
std::cerr << ("warning: not enough memory to build "
|
||||||
"product of P") << i << " with state-space";
|
"product of P") << i << " with state-space";
|
||||||
|
|
@ -1440,7 +1440,7 @@ namespace
|
||||||
spot::scc_info(p,
|
spot::scc_info(p,
|
||||||
spot::scc_info_options::TRACK_STATES);
|
spot::scc_info_options::TRACK_STATES);
|
||||||
}
|
}
|
||||||
catch (std::bad_alloc&)
|
catch (const std::bad_alloc&)
|
||||||
{
|
{
|
||||||
std::cerr << ("warning: not enough memory to build "
|
std::cerr << ("warning: not enough memory to build "
|
||||||
"product of N")
|
"product of N")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* -*- coding: utf-8 -*-
|
/* -*- coding: utf-8 -*-
|
||||||
** Copyright (C) 2014, 2015, 2016, 2017 Laboratoire de Recherche et
|
** Copyright (C) 2014-2018 Laboratoire de Recherche et Développement
|
||||||
** Développement de l'Epita (LRDE).
|
** de l'Epita (LRDE).
|
||||||
**
|
**
|
||||||
** This file is part of Spot, a model checking library.
|
** This file is part of Spot, a model checking library.
|
||||||
**
|
**
|
||||||
|
|
@ -2576,7 +2576,7 @@ namespace spot
|
||||||
automaton_stream_parser p(filename, localopts);
|
automaton_stream_parser p(filename, localopts);
|
||||||
pa = p.parse(dict, env);
|
pa = p.parse(dict, env);
|
||||||
}
|
}
|
||||||
catch (std::runtime_error& e)
|
catch (const std::runtime_error& e)
|
||||||
{
|
{
|
||||||
if (opts.raise_errors)
|
if (opts.raise_errors)
|
||||||
throw;
|
throw;
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ checked_main(int argc, char **argv)
|
||||||
model = spot::ltsmin_model::load(argv[1]).kripke(&ap, dict, deadf,
|
model = spot::ltsmin_model::load(argv[1]).kripke(&ap, dict, deadf,
|
||||||
compress_states);
|
compress_states);
|
||||||
}
|
}
|
||||||
catch (std::runtime_error& e)
|
catch (const std::runtime_error& e)
|
||||||
{
|
{
|
||||||
std::cerr << e.what() << '\n';
|
std::cerr << e.what() << '\n';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,10 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
|
||||||
diag 'No "if (x)" required before "delete x;".'
|
diag 'No "if (x)" required before "delete x;".'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# we want catch (const reftype&) or catch (...)
|
||||||
|
$GREP 'catch *([^.]' $tmp | $GREP -v 'const.*\&' &&
|
||||||
|
diag 'Always capture exceptions by const reference.'
|
||||||
|
|
||||||
case $file in
|
case $file in
|
||||||
*.hh | *.hxx)
|
*.hh | *.hxx)
|
||||||
if e$GREP '(<<|>>)' $tmp >/dev/null; then
|
if e$GREP '(<<|>>)' $tmp >/dev/null; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue