build: fix multiple GCC warnings

These occur when Spot is compiled with --enable-optimizations and
--disable-assert.

* spot/mc/unionfind.cc, spot/twaalgos/mealy_machine.cc,
spot/twaalgos/aiger.cc: Work around warnings about variables that are
only used in assert.
* spot/misc/common.hh [NDEBUG] (SPOT_ASSUME): Do not define
as assert() when it is disabled.
* spot/twaalgos/alternation.cc: Use insert instead of emplace
to work around a spurious possible nullptr dereference.
* spot/twaalgos/ltl2taa.cc, spot/twaalgos/ndfs_result.hxx,
spot/twaalgos/tau03.cc, spot/twaalgos/tau03opt.cc:
Work around spurious possible nullptr dereference.
* spot/twaalgos/sbacc.cc: Work around spurious "maybe uninitialized"
warning.
This commit is contained in:
Alexandre Duret-Lutz 2021-09-16 22:52:43 +02:00
parent c973fcdf2d
commit 4710577dfe
10 changed files with 55 additions and 32 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013-2020 Laboratoire de Recherche et Développement
// Copyright (C) 2013-2021 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -71,6 +71,8 @@
#if defined(SPOT_BUILD) or defined(SPOT_DEBUG)
#define SPOT_ASSERT(x) spot_assert__(x)
#else
// Do not replace by SPOT_ASSUME(x), as x can have some costly
// side-effects we do not want to pay outside of debug mode.
#define SPOT_ASSERT(x) while (0)
#endif
@ -117,7 +119,7 @@
#define SPOT_UNIMPLEMENTED() throw std::runtime_error("unimplemented");
#if SPOT_DEBUG
#if SPOT_DEBUG && !defined(NDEBUG)
#define SPOT_ASSUME(cond) assert(cond)
#else
#define SPOT_ASSUME(cond) \