more code smells

* bin/common_file.cc, bin/common_file.hh, bin/common_finput.cc,
bin/common_finput.hh, bin/common_output.cc, bin/common_setup.cc,
bin/common_setup.hh, bin/common_trans.cc, bin/common_trans.hh,
bin/dstar2tgba.cc, bin/genaut.cc, bin/genltl.cc, bin/ltl2tgba.cc,
bin/ltl2tgta.cc, bin/ltlcross.cc, bin/ltldo.cc, bin/ltlfilt.cc,
bin/ltlsynt.cc, bin/randltl.cc: Fix minor code issues reported by
sonarcloud.
This commit is contained in:
Alexandre Duret-Lutz 2023-01-06 11:55:34 +01:00
parent 96c3972c5c
commit 09bbaa1e41
19 changed files with 133 additions and 178 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012-2022 Laboratoire de Recherche et Développement
// Copyright (C) 2012-2023 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -586,7 +586,7 @@ namespace
fset_t unique_set;
spot::relabeling_map relmap;
ltl_processor(spot::tl_simplifier& simpl)
explicit ltl_processor(spot::tl_simplifier& simpl)
: simpl(simpl)
{
}
@ -722,7 +722,7 @@ namespace
matched &= !syntactic_si || f.is_syntactic_stutter_invariant();
if (matched && (ap_n.min > 0 || ap_n.max >= 0))
{
auto s = atomic_prop_collect(f);
spot::atomic_prop_set* s = atomic_prop_collect(f);
int n = s->size();
delete s;
matched &= (ap_n.min <= 0) || (n >= ap_n.min);
@ -761,7 +761,7 @@ namespace
aut = ltl_to_tgba_fm(f, simpl.get_dict(), true);
if (matched && !opt->acc_words.empty())
for (auto& word_aut: opt->acc_words)
for (const spot::twa_graph_ptr& word_aut: opt->acc_words)
if (spot::product(aut, word_aut)->is_empty())
{
matched = false;
@ -769,7 +769,7 @@ namespace
}
if (matched && !opt->rej_words.empty())
for (auto& word_aut: opt->rej_words)
for (const spot::twa_graph_ptr& word_aut: opt->rej_words)
if (!spot::product(aut, word_aut)->is_empty())
{
matched = false;
@ -843,12 +843,12 @@ namespace
{
// Sort the formulas alphabetically.
std::map<std::string, spot::formula> m;
for (auto& p: relmap)
m.emplace(str_psl(p.first), p.second);
for (auto& p: m)
for (const auto& [newformula, oldname]: relmap)
m.emplace(str_psl(newformula), oldname);
for (const auto& [newname, oldname]: m)
stream_formula(opt->output_define->ostream()
<< "#define " << p.first << " (",
p.second, filename,
<< "#define " << newname << " (",
oldname, filename,
std::to_string(linenum).c_str()) << ")\n";
}
one_match = true;