From 06b1ecb50ba85cdf48f70f0bf407234beb5a2e3a Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 26 Jul 2023 16:17:31 +0200 Subject: [PATCH] work around spurious GCC 13 warnings * spot/graph/graph.hh (new_univ_dests): Add an overload taking a temporary vector. * spot/twa/twagraph.cc (defrag_states): Use it. * tests/core/parity.cc: Remove some temporary variables. --- spot/graph/graph.hh | 11 ++++++++++- spot/twa/twagraph.cc | 5 ++--- tests/core/parity.cc | 16 +++++++--------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/spot/graph/graph.hh b/spot/graph/graph.hh index 04c21fec9..d2a97d1c5 100644 --- a/spot/graph/graph.hh +++ b/spot/graph/graph.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2014-2018, 2020-2022 Laboratoire de Recherche et +// Copyright (C) 2014-2018, 2020-2023 Laboratoire de Recherche et // Développement de l'Epita. // // This file is part of Spot, a model checking library. @@ -576,6 +576,15 @@ namespace spot return p.first->second; } + unsigned new_univ_dests(std::vector&& tmp) + { + std::sort(tmp.begin(), tmp.end()); + tmp.erase(std::unique(tmp.begin(), tmp.end()), tmp.end()); + auto p = uniq_.emplace(tmp, 0); + if (p.second) + p.first->second = g_.new_univ_dests(tmp.begin(), tmp.end()); + return p.first->second; + } }; } // namespace internal diff --git a/spot/twa/twagraph.cc b/spot/twa/twagraph.cc index 2a72702f3..055d6ca11 100644 --- a/spot/twa/twagraph.cc +++ b/spot/twa/twagraph.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2014-2022 Laboratoire de Recherche et Développement +// Copyright (C) 2014-2023 Laboratoire de Recherche et Développement // de l'Epita. // // This file is part of Spot, a model checking library. @@ -1243,8 +1243,7 @@ namespace spot // the state so that graph::degrag_states() will // eventually update it to the correct value. nd = newst.size(); - newst.emplace_back(uniq.new_univ_dests(tmp.begin(), - tmp.end())); + newst.emplace_back(uniq.new_univ_dests(std::move(tmp))); } } in_dst = nd; diff --git a/tests/core/parity.cc b/tests/core/parity.cc index 4cb8256ef..7ff391745 100644 --- a/tests/core/parity.cc +++ b/tests/core/parity.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2016, 2018-2019 Laboratoire de Recherche et +// Copyright (C) 2016, 2018-2019, 2023 Laboratoire de Recherche et // Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -320,16 +320,14 @@ int main() for (auto acc_tuple: acceptance_sets) for (auto& aut_tuple: automata_tuples) { - auto& aut = aut_tuple.first; - auto aut_num_sets = aut_tuple.second; - - auto acc = std::get<0>(acc_tuple); - auto is_max = std::get<1>(acc_tuple); - auto is_odd = std::get<2>(acc_tuple); - auto acc_num_sets = std::get<3>(acc_tuple); + spot::twa_graph_ptr& aut = aut_tuple.first; + unsigned aut_num_sets = aut_tuple.second; + unsigned acc_num_sets = std::get<3>(acc_tuple); if (aut_num_sets <= acc_num_sets) { - aut->set_acceptance(acc_num_sets, acc); + bool is_max = std::get<1>(acc_tuple); + bool is_odd = std::get<2>(acc_tuple); + aut->set_acceptance(acc_num_sets, std::get<0>(acc_tuple)); // Check change_parity for (auto kind: parity_kinds) for (auto style: parity_styles)