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
This commit is contained in:
Maximilien Colange 2018-05-25 14:09:47 +02:00
parent e886609269
commit a9293f329e
7 changed files with 34 additions and 31 deletions

View file

@ -234,7 +234,7 @@ namespace spot
fixed_size_pool* p = static_cast<fixed_size_pool*>(ctx->pool); fixed_size_pool* p = static_cast<fixed_size_pool*>(ctx->pool);
spins_state* out = spins_state* out =
new(p->allocate()) spins_state(ctx->state_size, p); 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)); memcpy(out->vars, dst, ctx->state_size * sizeof(int));
out->compute_hash(); out->compute_hash();
ctx->transitions.emplace_back(out); ctx->transitions.emplace_back(out);
@ -252,7 +252,7 @@ namespace spot
- sizeof(spins_compressed_state::vars) - sizeof(spins_compressed_state::vars)
+ sizeof(int) * csize); + sizeof(int) * csize);
spins_compressed_state* out = new(mem) spins_compressed_state(csize, p); 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)); memcpy(out->vars, ctx->compressed, csize * sizeof(int));
out->compute_hash(); out->compute_hash();
ctx->transitions.emplace_back(out); ctx->transitions.emplace_back(out);
@ -713,7 +713,7 @@ namespace spot
+ sizeof(int) * csize); + sizeof(int) * csize);
spins_compressed_state* res = new(mem) spins_compressed_state* res = new(mem)
spins_compressed_state(csize, p); spins_compressed_state(csize, p);
assert(res != nullptr); SPOT_ASSUME(res != nullptr);
memcpy(res->vars, compressed_, csize * sizeof(int)); memcpy(res->vars, compressed_, csize * sizeof(int));
res->compute_hash(); res->compute_hash();
return res; return res;
@ -722,7 +722,7 @@ namespace spot
{ {
fixed_size_pool* p = const_cast<fixed_size_pool*>(&statepool_); fixed_size_pool* p = const_cast<fixed_size_pool*>(&statepool_);
spins_state* res = new(p->allocate()) spins_state(state_size_, p); spins_state* res = new(p->allocate()) spins_state(state_size_, p);
assert(res != nullptr); SPOT_ASSUME(res != nullptr);
d_->get_initial_state(res->vars); d_->get_initial_state(res->vars);
res->compute_hash(); res->compute_hash();
return res; return res;

View file

@ -109,6 +109,7 @@ namespace spot
bool operator==(unsigned o) const bool operator==(unsigned o) const
{ {
SPOT_ASSERT(o == 0U); SPOT_ASSERT(o == 0U);
(void)o;
return !id; return !id;
} }
@ -116,6 +117,7 @@ namespace spot
bool operator!=(unsigned o) const bool operator!=(unsigned o) const
{ {
SPOT_ASSERT(o == 0U); SPOT_ASSERT(o == 0U);
(void)o;
return !!id; return !!id;
} }

View file

@ -158,8 +158,7 @@ namespace spot
assert(si_.is_accepting_scc(n)); assert(si_.is_accepting_scc(n));
// Catch unsupported types of automata // Catch unsupported types of automata
bool rej = ensure_weak_scc(n); assert(!ensure_weak_scc(n));
assert(rej == false);
// Detect if it is a "true state" // Detect if it is a "true state"
unsigned s = si_.states_of(n).front(); unsigned s = si_.states_of(n).front();
auto& ss = g.state_storage(s); auto& ss = g.state_storage(s);

View file

@ -360,7 +360,7 @@ namespace spot
{ {
path.emplace_back(std::move(ss)); path.emplace_back(std::move(ss));
auto i = states.insert(path.back()); auto i = states.insert(path.back());
assert(i.second); SPOT_ASSUME(i.second);
ss = path.back().compute_succ(cs_, ap, color_); ss = path.back().compute_succ(cs_, ap, color_);
mincolor = std::min(color_, mincolor); mincolor = std::min(color_, mincolor);
stop = states.find(ss) != states.end(); stop = states.find(ss) != states.end();

View file

@ -649,7 +649,7 @@ namespace spot
// This initial state is outside the cycle. Compute the prefix. // This initial state is outside the cycle. Compute the prefix.
min_path<false> s(this, a_, target, h_); min_path<false> s(this, a_, target, h_);
cycle_entry_point = s.search(prefix_start, run->prefix); 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(); cycle_entry_point = cycle_entry_point->clone();
} }

View file

@ -299,7 +299,7 @@ namespace spot
} }
acc_cond::mark_t get_acc() const acc_cond::mark_t get_acc() const
{ {
assert(!is_white()); SPOT_ASSUME(!is_white());
return *acc; return *acc;
} }
void cumulate_acc(acc_cond::mark_t a) void cumulate_acc(acc_cond::mark_t a)

View file

@ -18,7 +18,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "config.h" #include "config.h"
#include <cassert>
#include <ctime> #include <ctime>
#include <vector> #include <vector>
#include <spot/twaalgos/dualize.hh> #include <spot/twaalgos/dualize.hh>
@ -344,43 +343,46 @@ int main()
for (auto style: parity_styles) for (auto style: parity_styles)
{ {
auto output = spot::change_parity(aut, kind, style); auto output = spot::change_parity(aut, kind, style);
assert(is_right_parity(output, kind, style,
is_max, is_odd, acc_num_sets) if (!is_right_parity(output, kind, style,
&& "change_parity: wrong acceptance."); is_max, is_odd, acc_num_sets))
assert(are_equiv(aut, output) throw std::runtime_error("change parity: wrong acceptance");
&& "change_parity: not equivalent."); if (!are_equiv(aut, output))
assert(is_almost_colored(output) throw std::runtime_error("change_parity: not equivalent.");
&& "change_parity: too many acc on a transition"); if (!is_almost_colored(output))
throw std::runtime_error(
"change_parity: too many acc on a transition");
} }
// Check colorize_parity // Check colorize_parity
for (auto keep_style: { true, false }) for (auto keep_style: { true, false })
{ {
auto output = spot::colorize_parity(aut, keep_style); auto output = spot::colorize_parity(aut, keep_style);
assert(is_colored_printerr(output) if (!is_colored_printerr(output))
&& "colorize_parity: not colored."); throw std::runtime_error("colorize_parity: not colored.");
assert(are_equiv(aut, output) if (!are_equiv(aut, output))
&& "colorize_parity: not equivalent."); throw std::runtime_error("colorize_parity: not equivalent.");
auto target_kind = to_parity_kind(is_max); auto target_kind = to_parity_kind(is_max);
auto target_style = keep_style ? to_parity_style(is_odd) auto target_style = keep_style ? to_parity_style(is_odd)
: spot::parity_style_any; : spot::parity_style_any;
assert(is_right_parity(output, target_kind, target_style, if (!is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets) is_max, is_odd, acc_num_sets))
&& "change_parity: wrong acceptance."); throw std::runtime_error("change_parity: wrong acceptance.");
} }
// Check cleanup_parity // Check cleanup_parity
for (auto keep_style: { true, false }) for (auto keep_style: { true, false })
{ {
auto output = spot::cleanup_parity(aut, keep_style); auto output = spot::cleanup_parity(aut, keep_style);
assert(is_almost_colored(output) if (!is_almost_colored(output))
&& "cleanup_parity: too many acc on a transition."); throw std::runtime_error(
assert(are_equiv(aut, output) "cleanup_parity: too many acc on a transition.");
&& "cleanup_parity: not equivalent."); if (!are_equiv(aut, output))
throw std::runtime_error("cleanup_parity: not equivalent.");
auto target_kind = to_parity_kind(is_max); auto target_kind = to_parity_kind(is_max);
auto target_style = keep_style ? to_parity_style(is_odd) auto target_style = keep_style ? to_parity_style(is_odd)
: spot::parity_style_any; : spot::parity_style_any;
assert(is_right_parity(output, target_kind, target_style, if (!is_right_parity(output, target_kind, target_style,
is_max, is_odd, acc_num_sets) is_max, is_odd, acc_num_sets))
&& "cleanup_parity: wrong acceptance."); throw std::runtime_error("cleanup_parity: wrong acceptance.");
} }
} }
} }