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

@ -385,8 +385,7 @@ namespace
format(command, tools[tool_num].cmd);
std::string cmd = command.str();
std::cerr << "Running [" << l << tool_num << "]: "
<< cmd << std::endl;
std::cerr << "Running [" << l << tool_num << "]: " << cmd << '\n';
spot::process_timer timer;
timer.start();
int es = exec_with_timeout(cmd.c_str());
@ -623,9 +622,7 @@ namespace
if (!no_checks)
{
std::cerr << "Performing sanity checks and gathering statistics..."
<< std::endl;
std::cerr << "Performing sanity checks and gathering statistics...\n";
{
bool print_first = true;
for (unsigned i = 0; i < mi; ++i)
@ -712,14 +709,14 @@ namespace
}
else
{
std::cerr << "Gathering statistics..." << std::endl;
std::cerr << "Gathering statistics...\n";
}
if (problems && bogus_output)
print_hoa(bogus_output->ostream(), input) << std::endl;
std::cerr << std::endl;
std::cerr << '\n';
// Shall we stop processing now?
abort_run = global_error_flag && stop_on_error;
@ -806,21 +803,20 @@ main(int argc, char** argv)
err << ("error: some error was detected during the above "
"runs.\n Check file ")
<< bogus_output_filename
<< " for problematic automata.";
<< " for problematic automata.\n";
else
err << ("error: some error was detected during the above "
"runs,\n please search for 'error:' messages"
" in the above trace.");
err << std::endl;
" in the above trace.\n");
end_error();
}
else if (timeout_count == 0 && ignored_exec_fail == 0)
{
std::cerr << "No problem detected." << std::endl;
std::cerr << "No problem detected.\n";
}
else
{
std::cerr << "No major problem detected." << std::endl;
std::cerr << "No major problem detected.\n";
}
unsigned additional_errors = 0U;
@ -851,7 +847,7 @@ main(int argc, char** argv)
}
if (additional_errors == 1)
std::cerr << '.';
std::cerr << std::endl;
std::cerr << '\n';
}
}