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

@ -571,8 +571,7 @@ namespace
format(command, tools[translator_num].cmd);
std::string cmd = command.str();
std::cerr << "Running [" << l << translator_num << "]: "
<< cmd << std::endl;
std::cerr << "Running [" << l << translator_num << "]: " << cmd << '\n';
spot::process_timer timer;
timer.start();
int es = exec_with_timeout(cmd.c_str());
@ -1031,8 +1030,7 @@ namespace
std::cerr
<< ("warning: This formula or its negation has already"
" been checked.\n Use --allow-dups if it "
"should not be ignored.\n")
<< std::endl;
"should not be ignored.\n\n");
return 0;
}
}
@ -1136,8 +1134,7 @@ namespace
if (!no_checks)
{
std::cerr << "Performing sanity checks and gathering statistics..."
<< std::endl;
std::cerr << "Performing sanity checks and gathering statistics...\n";
// If we have reference tools, pick the smallest of their
// automata for positive and negative references.
@ -1391,7 +1388,7 @@ namespace
}
else
{
std::cerr << "Gathering statistics..." << std::endl;
std::cerr << "Gathering statistics...\n";
}
spot::atomic_prop_set* ap = spot::atomic_prop_collect(f);
@ -1567,7 +1564,7 @@ namespace
delete pos_map[i];
++seed;
}
std::cerr << std::endl;
std::cerr << '\n';
delete ap;
// Shall we stop processing formulas now?
@ -1702,17 +1699,17 @@ main(int argc, char** argv)
err << ("error: some error was detected during the above "
"runs,\n please search for 'error:' messages"
" in the above trace.");
err << std::endl;
err << '\n';
end_error();
}
else if (timeout_count == 0
&& ignored_exec_fail == 0 && oom_count == 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;
@ -1755,7 +1752,7 @@ main(int argc, char** argv)
}
if (additional_errors == 1)
std::cerr << '.';
std::cerr << std::endl;
std::cerr << '\n';
}
}