From 368acaad2808cfb21477f9e716df06d9b75993d6 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 16 Jul 2020 16:45:28 +0200 Subject: [PATCH] C++20: fix warnings reported by g++ 10.1 * spot/tl/formula.hh (formula::operator bool): Mark as noexcept. * bin/common_trans.hh, bin/common_trans.cc: Use std::atomic instead of volatile. --- bin/common_trans.cc | 6 +++--- bin/common_trans.hh | 7 ++++--- spot/tl/formula.hh | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/common_trans.cc b/bin/common_trans.cc index e3df2316b..cd1c192df 100644 --- a/bin/common_trans.cc +++ b/bin/common_trans.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2015-2019 Laboratoire de Recherche et Développement +// Copyright (C) 2015-2020 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -457,12 +457,12 @@ autproc_runner::round_automaton(spot::const_twa_graph_ptr aut, unsigned serial) filename_automaton.new_round(aut, serial); } -volatile bool timed_out = false; +std::atomic timed_out = false; unsigned timeout_count = 0; static unsigned timeout = 0; #if ENABLE_TIMEOUT -static volatile int alarm_on = 0; +static std::atomic alarm_on = 0; static int child_pid = -1; static void diff --git a/bin/common_trans.hh b/bin/common_trans.hh index d95350abc..e01131350 100644 --- a/bin/common_trans.hh +++ b/bin/common_trans.hh @@ -1,6 +1,6 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2015-2018 Laboratoire de Recherche et Développement -// de l'Epita (LRDE). +// Copyright (C) 2015-2018, 2020 Laboratoire de Recherche et +// Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -21,6 +21,7 @@ #include "common_sys.hh" #include +#include #include #include @@ -165,7 +166,7 @@ public: # define ENABLE_TIMEOUT 0 #endif -extern volatile bool timed_out; +extern std::atomic timed_out; extern unsigned timeout_count; #if ENABLE_TIMEOUT void setup_sig_handler(); diff --git a/spot/tl/formula.hh b/spot/tl/formula.hh index 8b1340aaa..57cc8f91c 100644 --- a/spot/tl/formula.hh +++ b/spot/tl/formula.hh @@ -842,7 +842,7 @@ namespace spot return ptr_ != nullptr; } - operator bool() const + operator bool() const noexcept { return ptr_ != nullptr; }