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

View file

@ -769,7 +769,7 @@ parse_opt(int key, char* arg, struct argp_state*)
{ {
std::cerr << ", '" << acc_is_args[i] << '\''; std::cerr << ", '" << acc_is_args[i] << '\'';
} }
std::cerr << std::endl; std::cerr << '\n';
exit(2); exit(2);
} }
} }

View file

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

View file

@ -290,7 +290,7 @@ namespace
auto aut = trans_.run(&f); auto aut = trans_.run(&f);
if (verbose) if (verbose)
std::cerr << "translating formula done" << std::endl; std::cerr << "translating formula done\n";
bdd all_inputs = bddtrue; bdd all_inputs = bddtrue;
bdd all_outputs = bddtrue; bdd all_outputs = bddtrue;
for (unsigned i = 0; i < input_aps_.size(); ++i) for (unsigned i = 0; i < input_aps_.size(); ++i)
@ -369,7 +369,7 @@ namespace
auto owner = complete_env(dpa); auto owner = complete_env(dpa);
auto pg = spot::parity_game(dpa, owner); auto pg = spot::parity_game(dpa, owner);
if (verbose) if (verbose)
std::cerr << "parity game built" << std::endl; std::cerr << "parity game built\n";
timer.stop(); timer.stop();
if (opt_print_pg) if (opt_print_pg)

View file

@ -1736,7 +1736,7 @@ namespace spot
{ {
if (!cnt++) if (!cnt++)
std::cerr << "*** m.uniq is not empty ***\n"; std::cerr << "*** m.uniq is not empty ***\n";
i->dump(std::cerr) << std::endl; i->dump(std::cerr) << '\n';
} }
return cnt == 0; return cnt == 0;
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012-2018 Laboratoire de Recherche et // Copyright (C) 2009, 2012-2019 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2003-2006 Laboratoire d'Informatique de Paris 6 // Copyright (C) 2003-2006 Laboratoire d'Informatique de Paris 6
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -346,17 +346,17 @@ namespace spot
{ {
if (var_seen) if (var_seen)
{ {
std::cerr << "var_map is empty but Var in map" << std::endl; std::cerr << "var_map is empty but Var in map\n";
fail = true; fail = true;
} }
if (acc_seen) if (acc_seen)
{ {
std::cerr << "acc_map is empty but Acc in map" << std::endl; std::cerr << "acc_map is empty but Acc in map\n";
fail = true; fail = true;
} }
if (refs_seen) if (refs_seen)
{ {
std::cerr << "maps are empty but var_refs is not" << std::endl; std::cerr << "maps are empty but var_refs is not\n";
fail = true; fail = true;
} }
if (!fail) if (!fail)
@ -364,7 +364,7 @@ namespace spot
} }
else else
{ {
std::cerr << "some maps are not empty" << std::endl; std::cerr << "some maps are not empty\n";
} }
dump(std::cerr); dump(std::cerr);
abort(); abort();

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2014-2016, 2018 Laboratoire de Recherche et // Copyright (C) 2014-2016, 2018-2019 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -33,7 +33,7 @@
static void static void
syntax(char* prog) syntax(char* prog)
{ {
std::cerr << prog << " file" << std::endl; std::cerr << prog << " file\n";
exit(2); exit(2);
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2014-2016, 2018 Laboratoire de Recherche et // Copyright (C) 2014-2016, 2018, 2019 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -37,7 +37,7 @@
static void static void
syntax(char* prog) syntax(char* prog)
{ {
std::cerr << prog << " file" << std::endl; std::cerr << prog << " file\n";
exit(2); exit(2);
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2010-2012, 2015-2016, 2018 Laboratoire de Recherche // Copyright (C) 2010-2012, 2015-2016, 2018-2019 Laboratoire de Recherche
// et Dévelopement de l'Epita (LRDE). // et Dévelopement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -28,7 +28,7 @@
static void static void
syntax(char *prog) syntax(char *prog)
{ {
std::cerr << prog << " formula" << std::endl; std::cerr << prog << " formula\n";
exit(2); exit(2);
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2014-2016, 2018 Laboratoire de Recherche et // Copyright (C) 2014-2016, 2018-2019 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -36,7 +36,7 @@
static void static void
syntax(char* prog) syntax(char* prog)
{ {
std::cerr << prog << " file" << std::endl; std::cerr << prog << " file\n";
exit(2); exit(2);
} }
@ -124,7 +124,7 @@ main(int argc, char** argv)
auto i = spot::make_emptiness_check_instantiator(algo, &err); auto i = spot::make_emptiness_check_instantiator(algo, &err);
if (!i) if (!i)
{ {
std::cerr << "Failed to parse `" << err << '\'' << std::endl; std::cerr << "Failed to parse `" << err << "'\n";
exit(2); exit(2);
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008-2012, 2014-2016, 2018 Laboratoire de // Copyright (C) 2008-2012, 2014-2016, 2018-2019 Laboratoire de
// Recherche et Développement de l'Epita (LRDE). // Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de // Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -36,7 +36,7 @@
static void static void
syntax(char* prog) syntax(char* prog)
{ {
std::cerr << prog << " [-E] file" << std::endl; std::cerr << prog << " [-E] file\n";
exit(2); exit(2);
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2007-2018 Laboratoire de Recherche et Développement // Copyright (C) 2007-2019 Laboratoire de Recherche et Développement
// de l'Epita (LRDE). // de l'Epita (LRDE).
// Copyright (C) 2003-2007 Laboratoire d'Informatique de Paris 6 // Copyright (C) 2003-2007 Laboratoire d'Informatique de Paris 6
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -396,7 +396,7 @@ checked_main(int argc, char** argv)
if (!echeck_inst) if (!echeck_inst)
{ {
std::cerr << "Failed to parse argument of -e near `" std::cerr << "Failed to parse argument of -e near `"
<< err << '\'' << std::endl; << err << "'\n";
exit(2); exit(2);
} }
expect_counter_example = true; expect_counter_example = true;
@ -414,7 +414,7 @@ checked_main(int argc, char** argv)
if (!echeck_inst) if (!echeck_inst)
{ {
std::cerr << "Failed to parse argument of -e near `" std::cerr << "Failed to parse argument of -e near `"
<< err << '\'' << std::endl; << err << "'\n";
exit(2); exit(2);
} }
expect_counter_example = false; expect_counter_example = false;
@ -820,13 +820,13 @@ checked_main(int argc, char** argv)
std::ifstream fin(argv[formula_index]); std::ifstream fin(argv[formula_index]);
if (!fin) if (!fin)
{ {
std::cerr << "Cannot open " << argv[formula_index] << std::endl; std::cerr << "Cannot open " << argv[formula_index] << '\n';
exit(2); exit(2);
} }
if (!std::getline(fin, input, '\0')) if (!std::getline(fin, input, '\0'))
{ {
std::cerr << "Cannot read " << argv[formula_index] << std::endl; std::cerr << "Cannot read " << argv[formula_index] << '\n';
exit(2); exit(2);
} }
} }
@ -952,7 +952,7 @@ checked_main(int argc, char** argv)
<< "\n varnum: " << s.varnum << "\n varnum: " << s.varnum
<< "\n cachesize: " << s.cachesize << "\n cachesize: " << s.cachesize
<< "\n gbcnum: " << s.gbcnum << "\n gbcnum: " << s.gbcnum
<< std::endl; << '\n';
bdd_fprintstat(stderr); bdd_fprintstat(stderr);
dict->dump(std::cerr); dict->dump(std::cerr);
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2010, 2012, 2015, 2016, 2018 Laboratoire de Recherche // Copyright (C) 2010, 2012, 2015, 2016, 2018, 2019 Laboratoire de
// et Developement de l'Epita (LRDE). // Recherche et Developement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -28,7 +28,7 @@
static void static void
syntax(char *prog) syntax(char *prog)
{ {
std::cerr << prog << " formula" << std::endl; std::cerr << prog << " formula\n";
exit(2); exit(2);
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2012, 2015, 2016, 2018 Laboratoire de Recherche et // Copyright (C) 2012, 2015-2016, 2018-2019 Laboratoire de Recherche
// Developement de l'Epita (LRDE). // et Developement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -28,7 +28,7 @@
static void static void
syntax(char *prog) syntax(char *prog)
{ {
std::cerr << prog << " formula" << std::endl; std::cerr << prog << " formula\n";
exit(2); exit(2);
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2013-2016, 2018 Laboratoire de Recherche et // Copyright (C) 2013-2016, 2018-2019 Laboratoire de Recherche et
// Developement de l'Epita (LRDE). // Developement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
@ -28,7 +28,7 @@
static void static void
syntax(char *prog) syntax(char *prog)
{ {
std::cerr << prog << " formula" << std::endl; std::cerr << prog << " formula\n";
exit(2); exit(2);
} }

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2016, 2018 Laboratoire de Recherche et Développement // Copyright (C) 2016, 2018-2019 Laboratoire de Recherche et
// de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
@ -174,31 +174,27 @@ static bool is_included(spot::const_twa_graph_ptr left,
auto product = spot::product(left, tmp); auto product = spot::product(left, tmp);
if (!product->is_empty()) if (!product->is_empty())
{ {
std::cerr << "======Not included======" << std::endl; std::cerr << "======Not included======\n";
if (first_left) if (first_left)
std::cerr << "======First automaton======" << std::endl; std::cerr << "======First automaton======\n";
else else
std::cerr << "======Second automaton======" << std::endl; std::cerr << "======Second automaton======\n";
spot::print_hoa(std::cerr, left); spot::print_hoa(std::cerr, left) << '\n';
std::cerr << std::endl;
if (first_left) if (first_left)
std::cerr << "======Second automaton======" << std::endl; std::cerr << "======Second automaton======\n";
else else
std::cerr << "======First automaton======" << std::endl; std::cerr << "======First automaton======\n";
spot::print_hoa(std::cerr, right); spot::print_hoa(std::cerr, right) << '\n';
std::cerr << std::endl;
if (first_left) if (first_left)
std::cerr << "======!Second automaton======" << std::endl; std::cerr << "======!Second automaton======\n";
else else
std::cerr << "======!First automaton======" << std::endl; std::cerr << "======!First automaton======\n";
spot::print_hoa(std::cerr, tmp); spot::print_hoa(std::cerr, tmp) << '\n';
std::cerr << std::endl;
if (first_left) if (first_left)
std::cerr << "======First X !Second======" <<std::endl; std::cerr << "======First X !Second======\n";
else else
std::cerr << "======Second X !First======" <<std::endl; std::cerr << "======Second X !First======\n";
spot::print_hoa(std::cerr, product); spot::print_hoa(std::cerr, product) << '\n';
std::cerr << std::endl;
return false; return false;
} }
return true; return true;
@ -241,18 +237,16 @@ static bool is_right_parity(spot::const_twa_graph_ptr aut,
target_odd = origin_odd; target_odd = origin_odd;
if (!(is_max == target_max && is_odd == target_odd)) if (!(is_max == target_max && is_odd == target_odd))
{ {
std::cerr << "======Wrong accceptance======" << std::endl; std::cerr << "======Wrong accceptance======\n";
std::string kind[] = { "max", "min", "same", "any" }; std::string kind[] = { "max", "min", "same", "any" };
std::string style[] = { "odd", "even", "same", "any" }; std::string style[] = { "odd", "even", "same", "any" };
std::cerr << "target: " << kind[target_kind] << ' ' std::cerr << "target: " << kind[target_kind] << ' '
<< style[target_style] << std::endl; << style[target_style]
std::cerr << "origin: " << kind[origin_max ? 0 : 1] << ' ' << "\norigin: " << kind[origin_max ? 0 : 1] << ' '
<< style[origin_odd ? 0 : 1] << ' ' << style[origin_odd ? 0 : 1] << ' ' << num_sets
<< num_sets << std::endl; << "\nactually: " << kind[is_max ? 0 : 1] << ' '
std::cerr << "actually: " << kind[is_max ? 0 : 1] << ' ' << style[is_odd ? 0 : 1] << ' ' << aut->num_sets()
<< style[is_odd ? 0 : 1] << ' ' << "\n\n";
<< aut->num_sets() << std::endl;
std::cerr << std::endl;
return false; return false;
} }
return true; return true;
@ -263,9 +257,8 @@ static bool is_almost_colored(spot::const_twa_graph_ptr aut)
for (auto t: aut->edges()) for (auto t: aut->edges())
if (t.acc.count() > 1) if (t.acc.count() > 1)
{ {
std::cerr << "======Not colored======" << std::endl; std::cerr << "======Not colored======\n";
spot::print_hoa(std::cerr, aut); spot::print_hoa(std::cerr, aut) << '\n';
std::cerr << std::endl;
return false; return false;
} }
return true; return true;
@ -276,9 +269,8 @@ static bool is_colored_printerr(spot::const_twa_graph_ptr aut)
bool result = is_colored(aut); bool result = is_colored(aut);
if (!result) if (!result)
{ {
std::cerr << "======Not colored======" << std::endl; std::cerr << "======Not colored======\n";
spot::print_hoa(std::cerr, aut); spot::print_hoa(std::cerr, aut) << '\n';
std::cerr << std::endl;
} }
return result; return result;
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008-2012, 2014-2018 Laboratoire de Recherche et // Copyright (C) 2008-2012, 2014-2019 Laboratoire de Recherche et
// Développement de l'Epita (LRDE). // Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris // Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -98,58 +98,50 @@ cons_emptiness_check(int num, spot::const_twa_graph_ptr a,
static void static void
syntax(char* prog) syntax(char* prog)
{ {
std::cerr << "Usage: "<< prog << " [OPTIONS...] PROPS..." << std::endl std::cerr
<< std::endl << "Usage: " << prog
<< "General Options:" << std::endl << (" [OPTIONS...] PROPS...\n\n"
<< " -0 suppress default output, just generate the graph" "General Options:\n"
<< " in memory" << std::endl " -0 suppress default output, just generate the graph"
<< " -1 produce minimal output (for our paper)" << std::endl " in memory\n"
<< " -g output graph in dot format" << std::endl " -1 produce minimal output (for our paper)\n"
<< " -s N seed for the random number generator" << std::endl " -g output graph in dot format\n"
<< " -z display statistics about emptiness-check algorithms" " -s N seed for the random number generator\n"
<< std::endl " -z display statistics about emptiness-check algorithms\n"
<< " -Z like -z, but print extra statistics after the run" " -Z like -z, but print extra statistics after the run"
<< " of each algorithm" << std::endl " of each algorithm\n\n"
<< std::endl "Graph Generation Options:\n"
<< "Graph Generation Options:" << std::endl " -a N F number of acceptance conditions and probability that"
<< " -a N F number of acceptance conditions and probability that" " one is true\n"
<< " one is true" << std::endl " [0 0.0]\n"
<< " [0 0.0]" << std::endl " -d F density of the graph [0.2]\n"
<< " -d F density of the graph [0.2]" << std::endl " -n N number of nodes of the graph [20]\n"
<< " -n N number of nodes of the graph [20]" << std::endl " -t F probability of the atomic propositions to be true"
<< " -t F probability of the atomic propositions to be true" " [0.5]\n"
<< " [0.5]" << std::endl " -det generate a deterministic and complete graph [false]\n\n"
<< " -det generate a deterministic and complete graph [false]" "Emptiness-Check Options:\n"
<< std::endl " -A FILE use all algorithms listed in FILE\n"
<< std::endl " -D degeneralize TGBA for emptiness-check algorithms that"
<< "Emptiness-Check Options:" << std::endl " would\n"
<< " -A FILE use all algorithms listed in FILE" << std::endl " otherwise be skipped (implies -e)\n"
<< " -D degeneralize TGBA for emptiness-check algorithms that" " -e N compare result of all "
<< " would" << std::endl "emptiness checks on N randomly generated graphs\n"
<< " otherwise be skipped (implies -e)" << std::endl " -m try to reduce runs, in a second pass (implies -r)\n"
<< " -e N compare result of all " " -R N repeat each emptiness-check and accepting run "
<< "emptiness checks on N randomly generated graphs" << std::endl "computation N times\n"
<< " -m try to reduce runs, in a second pass (implies -r)" " -r compute and replay accepting runs (implies -e)\n"
<< std::endl " ar:MODE select the mode MODE for accepting runs computation "
<< " -R N repeat each emptiness-check and accepting run " "(implies -r)\n\n"
<< "computation N times" << std::endl "Where:\n"
<< " -r compute and replay accepting runs (implies -e)" " F are floats between 0.0 and 1.0 inclusive\n"
<< std::endl " E are floating values\n"
<< " ar:MODE select the mode MODE for accepting runs computation " " S are `KEY=E, KEY=E, ...' strings\n"
<< "(implies -r)" << std::endl " N are positive integers\n"
<< std::endl " PROPS are the atomic properties to use on transitions\n"
<< "Where:" << std::endl "Use -dp to see the list of KEYs.\n\n"
<< " F are floats between 0.0 and 1.0 inclusive" << std::endl "When -i is used, a random graph a synchronized with"
<< " E are floating values" << std::endl " each formula.\nIf -e N is additionally used"
<< " S are `KEY=E, KEY=E, ...' strings" << std::endl " N random graphs are generated for each formula.\n");
<< " N are positive integers" << std::endl
<< " PROPS are the atomic properties to use on transitions"
<< std::endl
<< "Use -dp to see the list of KEYs." << std::endl
<< std::endl
<< "When -i is used, a random graph a synchronized with"
<< " each formula." << std::endl << "If -e N is additionally used"
<< " N random graphs are generated for each formula." << std::endl;
exit(2); exit(2);
} }
@ -161,7 +153,7 @@ to_int(const char* s)
int res = strtol(s, &endptr, 10); int res = strtol(s, &endptr, 10);
if (*endptr) if (*endptr)
{ {
std::cerr << "Failed to parse `" << s << "' as an integer." << std::endl; std::cerr << "Failed to parse `" << s << "' as an integer.\n";
exit(1); exit(1);
} }
return res; return res;
@ -174,7 +166,7 @@ to_int_pos(const char* s, const char* arg)
if (res <= 0) if (res <= 0)
{ {
std::cerr << "argument of " << arg std::cerr << "argument of " << arg
<< " (" << res << ") must be positive" << std::endl; << " (" << res << ") must be positive\n";
exit(1); exit(1);
} }
return res; return res;
@ -187,7 +179,7 @@ to_int_nonneg(const char* s, const char* arg)
if (res < 0) if (res < 0)
{ {
std::cerr << "argument of " << arg std::cerr << "argument of " << arg
<< " (" << res << ") must be nonnegative" << std::endl; << " (" << res << ") must be nonnegative\n";
exit(1); exit(1);
} }
return res; return res;
@ -201,7 +193,7 @@ to_float(const char* s)
float res = strtod(s, &endptr); float res = strtod(s, &endptr);
if (*endptr) if (*endptr)
{ {
std::cerr << "Failed to parse `" << s << "' as a float." << std::endl; std::cerr << "Failed to parse `" << s << "' as a float.\n";
exit(1); exit(1);
} }
return res; return res;
@ -214,7 +206,7 @@ to_float_nonneg(const char* s, const char* arg)
if (res < 0) if (res < 0)
{ {
std::cerr << "argument of " << arg std::cerr << "argument of " << arg
<< " (" << res << ") must be nonnegative" << std::endl; << " (" << res << ") must be nonnegative\n";
exit(1); exit(1);
} }
return res; return res;
@ -544,7 +536,7 @@ main(int argc, char** argv)
if (!*in) if (!*in)
{ {
delete in; delete in;
std::cerr << "Failed to open " << argv[argn] << std::endl; std::cerr << "Failed to open " << argv[argn] << '\n';
exit(2); exit(2);
} }
} }
@ -571,7 +563,7 @@ main(int argc, char** argv)
{ {
if (options.parse_options(argv[argn])) if (options.parse_options(argv[argn]))
{ {
std::cerr << "Failed to parse " << argv[argn] << std::endl; std::cerr << "Failed to parse " << argv[argn] << '\n';
exit(2); exit(2);
} }
} }
@ -680,7 +672,7 @@ main(int argc, char** argv)
&err); &err);
if (!ec_algos[i].inst) if (!ec_algos[i].inst)
{ {
std::cerr << "Parse error after `" << err << '\'' << std::endl; std::cerr << "Parse error after `" << err << "'\n";
exit(1); exit(1);
} }
ec_algos[i].inst->options().set(options); ec_algos[i].inst->options().set(options);

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*_ // -*- coding: utf-8 -*_
// Copyright (C) 2008-2012, 2014-2016, 2018 Laboratoire // Copyright (C) 2008-2012, 2014-2016, 2018-2019 Laboratoire
// de Recherche et Développement de l'Epita (LRDE). // de Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2006, 2007 Laboratoire d'Informatique de Paris // Copyright (C) 2004, 2006, 2007 Laboratoire d'Informatique de Paris
// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -35,7 +35,7 @@
static void static void
syntax(char* prog) syntax(char* prog)
{ {
std::cerr << prog << " option formula1 (formula2)?" << std::endl; std::cerr << prog << " option formula1 (formula2)?\n";
exit(2); exit(2);
} }
@ -162,7 +162,7 @@ main(int argc, char** argv)
fin = new std::ifstream(argv[2]); fin = new std::ifstream(argv[2]);
if (!*fin) if (!*fin)
{ {
std::cerr << "Cannot open " << argv[2] << std::endl; std::cerr << "Cannot open " << argv[2] << '\n';
exit(2); exit(2);
} }
} }
@ -196,7 +196,7 @@ main(int argc, char** argv)
{ {
if (readfile) if (readfile)
{ {
std::cerr << "Cannot read from file and check result." << std::endl; std::cerr << "Cannot read from file and check result.\n";
exit(2); exit(2);
} }
@ -232,7 +232,7 @@ main(int argc, char** argv)
if (!simp->are_equivalent(input_f, maybe_larger)) if (!simp->are_equivalent(input_f, maybe_larger))
{ {
std::cerr << "Incorrect reduction (reduce_size_strictly=0) from `" std::cerr << "Incorrect reduction (reduce_size_strictly=0) from `"
<< f1s_before << "' to `" << f1l << "'." << std::endl; << f1s_before << "' to `" << f1l << "'.\n";
exit_code = 3; exit_code = 3;
} }
} }

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2008-2012, 2014-2016, 2018 Laboratoire de Recherche // Copyright (C) 2008-2012, 2014-2016, 2018-2019 Laboratoire de Recherche
// et Développement de l'Epita (LRDE). // et Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 // Copyright (C) 2004 Laboratoire d'Informatique de Paris 6
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université // (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -32,7 +32,7 @@
static void static void
syntax(char* prog) syntax(char* prog)
{ {
std::cerr << prog << " formula1 formula2?" << std::endl; std::cerr << prog << " formula1 formula2?\n";
exit(2); exit(2);
} }

View file

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

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2009-2018 Laboratoire de Recherche et Développement de # Copyright (C) 2009-2019 Laboratoire de Recherche et Développement de
# l'Epita (LRDE). # l'Epita (LRDE).
# Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 # Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6
# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université # (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -67,7 +67,6 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
-a -not -path '*.dir/*' \ -a -not -path '*.dir/*' \
-a -type f -a -print | -a -type f -a -print |
while read file; do while read file; do
if $GREP 'GNU Bison' "$file" >/dev/null || if $GREP 'GNU Bison' "$file" >/dev/null ||
$GREP 'generated by flex' "$file" >/dev/null ; then $GREP 'generated by flex' "$file" >/dev/null ; then
continue continue
@ -266,6 +265,9 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
e$GREP '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp && e$GREP '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp &&
diag 'Prefer empty() to check emptiness.' diag 'Prefer empty() to check emptiness.'
$GREP -E 'std::cerr.*<<.*endl' $tmp &&
diag 'std::cerr has unitbuf set; use \\n instead of endl'
e$GREP 'assert\((0|!".*")\)' $tmp && e$GREP 'assert\((0|!".*")\)' $tmp &&
diag 'Prefer SPOT_UNREACHABLE or SPOT_UNIMPLEMENTED.' diag 'Prefer SPOT_UNREACHABLE or SPOT_UNIMPLEMENTED.'