Commit a9293f32 authored by Maximilien Colange's avatar Maximilien Colange
Browse files

fix warnings when compiling without assertions

* spot/twa/acc.hh, spot/twaalgos/alternation.cc,
  spot/twaalgos/determinize.cc, spot/twaalgos/ndfs_result.hxx,
  spot/twaalgos/tau03.cc, spot/ltsmin/ltsmin.cc, tests/core/parity.cc:
  here
parent e8866092
Pipeline #1869 canceled with stages
in 19 minutes and 59 seconds
......@@ -234,7 +234,7 @@ namespace spot
fixed_size_pool* p = static_cast<fixed_size_pool*>(ctx->pool);
spins_state* out =
new(p->allocate()) spins_state(ctx->state_size, p);
assert(out != nullptr);
SPOT_ASSUME(out != nullptr);
memcpy(out->vars, dst, ctx->state_size * sizeof(int));
out->compute_hash();
ctx->transitions.emplace_back(out);
......@@ -252,7 +252,7 @@ namespace spot
- sizeof(spins_compressed_state::vars)
+ sizeof(int) * csize);
spins_compressed_state* out = new(mem) spins_compressed_state(csize, p);
assert(out != nullptr);
SPOT_ASSUME(out != nullptr);
memcpy(out->vars, ctx->compressed, csize * sizeof(int));
out->compute_hash();
ctx->transitions.emplace_back(out);
......@@ -713,7 +713,7 @@ namespace spot
+ sizeof(int) * csize);
spins_compressed_state* res = new(mem)
spins_compressed_state(csize, p);
assert(res != nullptr);
SPOT_ASSUME(res != nullptr);
memcpy(res->vars, compressed_, csize * sizeof(int));
res->compute_hash();
return res;
......@@ -722,7 +722,7 @@ namespace spot
{
fixed_size_pool* p = const_cast<fixed_size_pool*>(&statepool_);
spins_state* res = new(p->allocate()) spins_state(state_size_, p);
assert(res != nullptr);
SPOT_ASSUME(res != nullptr);
d_->get_initial_state(res->vars);
res->compute_hash();
return res;
......
......@@ -109,6 +109,7 @@ namespace spot
bool operator==(unsigned o) const
{
SPOT_ASSERT(o == 0U);
(void)o;
return !id;
}
......@@ -116,6 +117,7 @@ namespace spot
bool operator!=(unsigned o) const
{
SPOT_ASSERT(o == 0U);
(void)o;
return !!id;
}
......
......@@ -158,8 +158,7 @@ namespace spot
assert(si_.is_accepting_scc(n));
// Catch unsupported types of automata
bool rej = ensure_weak_scc(n);
assert(rej == false);
assert(!ensure_weak_scc(n));
// Detect if it is a "true state"
unsigned s = si_.states_of(n).front();
auto& ss = g.state_storage(s);
......
......@@ -360,7 +360,7 @@ namespace spot
{
path.emplace_back(std::move(ss));
auto i = states.insert(path.back());
assert(i.second);
SPOT_ASSUME(i.second);
ss = path.back().compute_succ(cs_, ap, color_);
mincolor = std::min(color_, mincolor);
stop = states.find(ss) != states.end();
......
......@@ -649,7 +649,7 @@ namespace spot
// This initial state is outside the cycle. Compute the prefix.
min_path<false> s(this, a_, target, h_);
cycle_entry_point = s.search(prefix_start, run->prefix);
SPOT_ASSERT(cycle_entry_point);
SPOT_ASSUME(cycle_entry_point);
cycle_entry_point = cycle_entry_point->clone();
}
......
......@@ -299,7 +299,7 @@ namespace spot
}
acc_cond::mark_t get_acc() const
{
assert(!is_white());
SPOT_ASSUME(!is_white());
return *acc;
}
void cumulate_acc(acc_cond::mark_t a)
......
......@@ -18,7 +18,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config.h"
#include <cassert>
#include <ctime>
#include <vector>
#include <spot/twaalgos/dualize.hh>
......@@ -344,43 +343,46 @@ int main()
for (auto style: parity_styles)
{
auto output = spot::change_parity(aut, kind, style);
assert(is_right_parity(output, kind, style,
is_max, is_odd, acc_num_sets)
&& "change_parity: wrong acceptance.");
assert(are_equiv(aut, output)
&& "change_parity: not equivalent.");
assert(is_almost_colored(output)
&& "change_parity: too many acc on a transition");
if (!is_right_parity(output, kind, style,
is_max, is_odd, acc_num_sets))
throw std::runtime_error("change parity: wrong acceptance");
if (!are_equiv(aut, output))
throw std::runtime_error("change_parity: not equivalent.");
if (!is_almost_colored(output))
throw std::runtime_error(
"change_parity: too many acc on a transition");
}
// Check colorize_parity
for (auto keep_style: { true, false })
{
auto output = spot::colorize_parity(aut, keep_style);
assert(is_colored_printerr(output)
&& "colorize_parity: not colored.");
assert(are_equiv(aut, output)
&& "colorize_parity: not equivalent.");
if (!is_colored_printerr(output))
throw std::runtime_error("colorize_parity: not colored.");
if (!are_equiv(aut, output))
throw std::runtime_error("colorize_parity: not equivalent.");
auto target_kind = to_parity_kind(is_max);
auto target_style = keep_style ? to_parity_style(is_odd)
: spot::parity_style_any;
assert(is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets)
&& "change_parity: wrong acceptance.");
if (!is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets))
throw std::runtime_error("change_parity: wrong acceptance.");
}
// Check cleanup_parity
for (auto keep_style: { true, false })
{
auto output = spot::cleanup_parity(aut, keep_style);
assert(is_almost_colored(output)
&& "cleanup_parity: too many acc on a transition.");
assert(are_equiv(aut, output)
&& "cleanup_parity: not equivalent.");
if (!is_almost_colored(output))
throw std::runtime_error(
"cleanup_parity: too many acc on a transition.");
if (!are_equiv(aut, output))
throw std::runtime_error("cleanup_parity: not equivalent.");
auto target_kind = to_parity_kind(is_max);
auto target_style = keep_style ? to_parity_style(is_odd)
: spot::parity_style_any;
assert(is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets)
&& "cleanup_parity: wrong acceptance.");
if (!is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets))
throw std::runtime_error("cleanup_parity: wrong acceptance.");
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment