forbid the use of std::endl on std::cerr

std::cerr will flush after each operator<< by default, so it's simpler
to use \n instead of std::endl, especially if we can merge \n into the
previous string.  Ideally we should prefer \n for std::cout as well,
but there are reasonable cases where we want to call std::endl there,
so it's hard to enforce.

* tests/sanity/style.test: Diagnose occurrences of cerr.*<<.*endl.
* bin/autcross.cc, bin/autfilt.cc, bin/ltlcross.cc, bin/ltlsynt.cc,
spot/tl/formula.cc, spot/twa/bdddict.cc, tests/core/checkpsl.cc,
tests/core/checkta.cc, tests/core/consterm.cc, tests/core/emptchk.cc,
tests/core/equalsf.cc, tests/core/ikwiad.cc, tests/core/kind.cc,
tests/core/length.cc, tests/core/ltlrel.cc, tests/core/parity.cc,
tests/core/randtgba.cc, tests/core/reduc.cc, tests/core/syntimpl.cc,
tests/ltsmin/modelcheck.cc: Fix them.
This commit is contained in:
Alexandre Duret-Lutz 2019-07-15 02:31:13 +02:00
parent b4cced9ba8
commit 09c93a3a3d
21 changed files with 148 additions and 170 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011-2018 Laboratoire de Recherche et Developpement
// Copyright (C) 2011-2019 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -136,7 +136,7 @@ checked_main(int argc, char **argv)
break;
default:
error:
std::cerr << "Unknown option `" << argv[i] << "'." << std::endl;
std::cerr << "Unknown option `" << argv[i] << "'.\n";
exit(1);
}
--argc;
@ -285,10 +285,9 @@ checked_main(int argc, char **argv)
}
catch (const std::bad_alloc&)
{
std::cerr << "Out of memory during emptiness check."
<< std::endl;
std::cerr << "Out of memory during emptiness check.\n";
if (!compress_states)
std::cerr << "Try option -z for state compression." << std::endl;
std::cerr << "Try option -z for state compression.\n";
exit_code = 2;
exit(exit_code);
}
@ -329,8 +328,8 @@ checked_main(int argc, char **argv)
}
catch (const std::bad_alloc&)
{
std::cerr << "Out of memory while looking for counterexample."
<< std::endl;
std::cerr
<< "Out of memory while looking for counterexample.\n";
exit_code = 2;
exit(exit_code);
}