Commit 70c70a63 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

do not use non-standard anonymous structs

For #214, as observed by Thibaud Michaud.

* spot/twa/acc.hh: Name the anonymous struct.
* spot/twa/acc.hh, spot/twa/acc.cc, spot/parseaut/parseaut.yy,
spot/twaalgos/dtwasat.cc, spot/twaalgos/remfin.cc,
spot/twaalgos/sepsets.cc, spot/twaalgos/totgba.cc: Adjust all usages.
* NEWS: Mention the renaming.
parent 954b9d20
...@@ -14,6 +14,12 @@ New in spot 2.3.0.dev (not yet released) ...@@ -14,6 +14,12 @@ New in spot 2.3.0.dev (not yet released)
- spot::ltsmin_model::kripke() forgot to register the "dead" - spot::ltsmin_model::kripke() forgot to register the "dead"
proposition. proposition.
- The spot::acc_word type (used to construct acceptance condition)
was using some non-standard anonymous struct. It is unlikely that
this type was actually used outside Spot, but if you do use it,
spot::acc_word::op and spot::acc_word::type had to be renamed as
spot::acc_word::sub.op and spot::acc_word::sub.type.
New in spot 2.3 (2017-01-19) New in spot 2.3 (2017-01-19)
Build: Build:
......
/* -*- coding: utf-8 -*- /* -*- coding: utf-8 -*-
** Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et ** Copyright (C) 2014, 2015, 2016, 2017 Laboratoire de Recherche et
** Développement de l'Epita (LRDE). ** Développement de l'Epita (LRDE).
** **
** This file is part of Spot, a model checking library. ** This file is part of Spot, a model checking library.
...@@ -2048,33 +2048,33 @@ fix_acceptance_aux(spot::acc_cond& acc, ...@@ -2048,33 +2048,33 @@ fix_acceptance_aux(spot::acc_cond& acc,
unsigned base) unsigned base)
{ {
auto& w = in[pos]; auto& w = in[pos];
switch (w.op) switch (w.sub.op)
{ {
case spot::acc_cond::acc_op::And: case spot::acc_cond::acc_op::And:
{ {
unsigned sub = pos - w.size; unsigned sub = pos - w.sub.size;
--pos; --pos;
auto c = fix_acceptance_aux(acc, in, pos, onlyneg, both, base); auto c = fix_acceptance_aux(acc, in, pos, onlyneg, both, base);
pos -= in[pos].size; pos -= in[pos].sub.size;
while (sub < pos) while (sub < pos)
{ {
--pos; --pos;
c &= fix_acceptance_aux(acc, in, pos, onlyneg, both, base); c &= fix_acceptance_aux(acc, in, pos, onlyneg, both, base);
pos -= in[pos].size; pos -= in[pos].sub.size;
} }
return c; return c;
} }
case spot::acc_cond::acc_op::Or: case spot::acc_cond::acc_op::Or:
{ {
unsigned sub = pos - w.size; unsigned sub = pos - w.sub.size;
--pos; --pos;
auto c = fix_acceptance_aux(acc, in, pos, onlyneg, both, base); auto c = fix_acceptance_aux(acc, in, pos, onlyneg, both, base);
pos -= in[pos].size; pos -= in[pos].sub.size;
while (sub < pos) while (sub < pos)
{ {
--pos; --pos;
c |= fix_acceptance_aux(acc, in, pos, onlyneg, both, base); c |= fix_acceptance_aux(acc, in, pos, onlyneg, both, base);
pos -= in[pos].size; pos -= in[pos].sub.size;
} }
return c; return c;
} }
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2015, 2016 Laboratoire de Recherche et Développement // Copyright (C) 2015, 2016, 2017 Laboratoire de Recherche et
// de l'Epita. // Développement de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
// //
...@@ -73,14 +73,14 @@ namespace spot ...@@ -73,14 +73,14 @@ namespace spot
auto& w = code[pos]; auto& w = code[pos];
const char* negated = ""; const char* negated = "";
bool top = pos == code.size() - 1; bool top = pos == code.size() - 1;
switch (w.op) switch (w.sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
op = html ? " &amp; " : " & "; op = html ? " &amp; " : " & ";
SPOT_FALLTHROUGH; SPOT_FALLTHROUGH;
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
{ {
unsigned sub = pos - w.size; unsigned sub = pos - w.sub.size;
if (!top) if (!top)
os << '('; os << '(';
bool first = true; bool first = true;
...@@ -92,7 +92,7 @@ namespace spot ...@@ -92,7 +92,7 @@ namespace spot
else else
os << op; os << op;
print_code<html>(os, code, pos, set_printer); print_code<html>(os, code, pos, set_printer);
pos -= code[pos].size; pos -= code[pos].sub.size;
} }
if (!top) if (!top)
os << ')'; os << ')';
...@@ -177,29 +177,29 @@ namespace spot ...@@ -177,29 +177,29 @@ namespace spot
static bool static bool
eval(acc_cond::mark_t inf, const acc_cond::acc_word* pos) eval(acc_cond::mark_t inf, const acc_cond::acc_word* pos)
{ {
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
{ {
auto sub = pos - pos->size; auto sub = pos - pos->sub.size;
while (sub < pos) while (sub < pos)
{ {
--pos; --pos;
if (!eval(inf, pos)) if (!eval(inf, pos))
return false; return false;
pos -= pos->size; pos -= pos->sub.size;
} }
return true; return true;
} }
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
{ {
auto sub = pos - pos->size; auto sub = pos - pos->sub.size;
while (sub < pos) while (sub < pos)
{ {
--pos; --pos;
if (eval(inf, pos)) if (eval(inf, pos))
return true; return true;
pos -= pos->size; pos -= pos->sub.size;
} }
return false; return false;
} }
...@@ -218,29 +218,29 @@ namespace spot ...@@ -218,29 +218,29 @@ namespace spot
static bool static bool
inf_eval(acc_cond::mark_t inf, const acc_cond::acc_word* pos) inf_eval(acc_cond::mark_t inf, const acc_cond::acc_word* pos)
{ {
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
{ {
auto sub = pos - pos->size; auto sub = pos - pos->sub.size;
while (sub < pos) while (sub < pos)
{ {
--pos; --pos;
if (!inf_eval(inf, pos)) if (!inf_eval(inf, pos))
return false; return false;
pos -= pos->size; pos -= pos->sub.size;
} }
return true; return true;
} }
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
{ {
auto sub = pos - pos->size; auto sub = pos - pos->sub.size;
while (sub < pos) while (sub < pos)
{ {
--pos; --pos;
if (inf_eval(inf, pos)) if (inf_eval(inf, pos))
return true; return true;
pos -= pos->size; pos -= pos->sub.size;
} }
return false; return false;
} }
...@@ -259,11 +259,11 @@ namespace spot ...@@ -259,11 +259,11 @@ namespace spot
static acc_cond::mark_t static acc_cond::mark_t
eval_sets(acc_cond::mark_t inf, const acc_cond::acc_word* pos) eval_sets(acc_cond::mark_t inf, const acc_cond::acc_word* pos)
{ {
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
{ {
auto sub = pos - pos->size; auto sub = pos - pos->sub.size;
acc_cond::mark_t m = 0U; acc_cond::mark_t m = 0U;
while (sub < pos) while (sub < pos)
{ {
...@@ -272,19 +272,19 @@ namespace spot ...@@ -272,19 +272,19 @@ namespace spot
m |= s; m |= s;
else else
return 0U; return 0U;
pos -= pos->size; pos -= pos->sub.size;
} }
return m; return m;
} }
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
{ {
auto sub = pos - pos->size; auto sub = pos - pos->sub.size;
while (sub < pos) while (sub < pos)
{ {
--pos; --pos;
if (auto s = eval_sets(inf, pos)) if (auto s = eval_sets(inf, pos))
return s; return s;
pos -= pos->size; pos -= pos->sub.size;
} }
return 0U; return 0U;
} }
...@@ -334,7 +334,7 @@ namespace spot ...@@ -334,7 +334,7 @@ namespace spot
unsigned pos = code_.size(); unsigned pos = code_.size();
do do
{ {
switch (code_[pos - 1].op) switch (code_[pos - 1].sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
...@@ -369,8 +369,8 @@ namespace spot ...@@ -369,8 +369,8 @@ namespace spot
acc_cond::acc_op lowop, acc_cond::acc_op lowop,
acc_cond::mark_t all_sets) acc_cond::mark_t all_sets)
{ {
unsigned s = code.back().size; unsigned s = code.back().sub.size;
auto mainop = code.back().op; auto mainop = code.back().sub.op;
if (mainop == highop) if (mainop == highop)
{ {
// The size must be a multiple of 5. // The size must be a multiple of 5.
...@@ -388,11 +388,11 @@ namespace spot ...@@ -388,11 +388,11 @@ namespace spot
acc_cond::mark_t seen_inf = 0U; acc_cond::mark_t seen_inf = 0U;
while (s) while (s)
{ {
if (code[--s].op != lowop) if (code[--s].sub.op != lowop)
return false; return false;
auto o1 = code[--s].op; auto o1 = code[--s].sub.op;
auto m1 = code[--s].mark; auto m1 = code[--s].mark;
auto o2 = code[--s].op; auto o2 = code[--s].sub.op;
auto m2 = code[--s].mark; auto m2 = code[--s].mark;
// We assume // We assume
...@@ -454,10 +454,10 @@ namespace spot ...@@ -454,10 +454,10 @@ namespace spot
return true; return true;
} }
if (code_.is_t() if (code_.is_t()
|| code_.back().op != acc_op::Or) || code_.back().sub.op != acc_op::Or)
return false; return false;
auto s = code_.back().size; auto s = code_.back().sub.size;
acc_cond::mark_t seen_fin = 0U; acc_cond::mark_t seen_fin = 0U;
acc_cond::mark_t seen_inf = 0U; acc_cond::mark_t seen_inf = 0U;
// Each pairs is the position of a Fin followed // Each pairs is the position of a Fin followed
...@@ -466,11 +466,11 @@ namespace spot ...@@ -466,11 +466,11 @@ namespace spot
while (s) while (s)
{ {
--s; --s;
if (code_[s].op == acc_op::And) if (code_[s].sub.op == acc_op::And)
{ {
auto o1 = code_[--s].op; auto o1 = code_[--s].sub.op;
auto m1 = code_[--s].mark; auto m1 = code_[--s].mark;
auto o2 = code_[--s].op; auto o2 = code_[--s].sub.op;
auto m2 = code_[--s].mark; auto m2 = code_[--s].mark;
// We assume // We assume
...@@ -503,7 +503,7 @@ namespace spot ...@@ -503,7 +503,7 @@ namespace spot
seen_fin |= m1; seen_fin |= m1;
seen_inf |= m2; seen_inf |= m2;
} }
else if (code_[s].op == acc_op::Fin) else if (code_[s].sub.op == acc_op::Fin)
{ {
auto m1 = code_[--s].mark; auto m1 = code_[--s].mark;
for (auto s: m1.sets()) for (auto s: m1.sets())
...@@ -597,9 +597,9 @@ namespace spot ...@@ -597,9 +597,9 @@ namespace spot
{ {
bdd to_bdd_rec(const acc_cond::acc_word* c, const bdd* map) bdd to_bdd_rec(const acc_cond::acc_word* c, const bdd* map)
{ {
auto sz = c->size; auto sz = c->sub.size;
auto start = c - sz - 1; auto start = c - sz - 1;
auto op = c->op; auto op = c->sub.op;
switch (op) switch (op)
{ {
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
...@@ -609,7 +609,7 @@ namespace spot ...@@ -609,7 +609,7 @@ namespace spot
do do
{ {
res |= to_bdd_rec(c, map); res |= to_bdd_rec(c, map);
c -= c->size + 1; c -= c->sub.size + 1;
} }
while (c > start); while (c > start);
return res; return res;
...@@ -621,7 +621,7 @@ namespace spot ...@@ -621,7 +621,7 @@ namespace spot
do do
{ {
res &= to_bdd_rec(c, map); res &= to_bdd_rec(c, map);
c -= c->size + 1; c -= c->sub.size + 1;
} }
while (c > start); while (c > start);
return res; return res;
...@@ -1005,16 +1005,16 @@ namespace spot ...@@ -1005,16 +1005,16 @@ namespace spot
auto pos = &back(); auto pos = &back();
auto start = &front(); auto start = &front();
auto and_scope = pos + 1; auto and_scope = pos + 1;
if (pos->op == acc_cond::acc_op::Or) if (pos->sub.op == acc_cond::acc_op::Or)
--pos; --pos;
while (pos > start) while (pos > start)
{ {
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
return false; return false;
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
and_scope = std::min(and_scope, pos - pos->size); and_scope = std::min(and_scope, pos - pos->sub.size);
--pos; --pos;
break; break;
case acc_cond::acc_op::Fin: case acc_cond::acc_op::Fin:
...@@ -1038,16 +1038,16 @@ namespace spot ...@@ -1038,16 +1038,16 @@ namespace spot
auto pos = &back(); auto pos = &back();
auto start = &front(); auto start = &front();
auto or_scope = pos + 1; auto or_scope = pos + 1;
if (pos->op == acc_cond::acc_op::And) if (pos->sub.op == acc_cond::acc_op::And)
--pos; --pos;
while (pos > start) while (pos > start)
{ {
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
return false; return false;
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
or_scope = std::min(or_scope, pos - pos->size); or_scope = std::min(or_scope, pos - pos->sub.size);
--pos; --pos;
break; break;
case acc_cond::acc_op::Inf: case acc_cond::acc_op::Inf:
...@@ -1068,8 +1068,8 @@ namespace spot ...@@ -1068,8 +1068,8 @@ namespace spot
{ {
acc_cond::acc_code complement_rec(const acc_cond::acc_word* pos) acc_cond::acc_code complement_rec(const acc_cond::acc_word* pos)
{ {
auto start = pos - pos->size; auto start = pos - pos->sub.size;
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
{ {
...@@ -1079,7 +1079,7 @@ namespace spot ...@@ -1079,7 +1079,7 @@ namespace spot
{ {
auto tmp = complement_rec(pos) | std::move(res); auto tmp = complement_rec(pos) | std::move(res);
std::swap(tmp, res); std::swap(tmp, res);
pos -= pos->size + 1; pos -= pos->sub.size + 1;
} }
while (pos > start); while (pos > start);
return res; return res;
...@@ -1092,7 +1092,7 @@ namespace spot ...@@ -1092,7 +1092,7 @@ namespace spot
{ {
auto tmp = complement_rec(pos) & std::move(res); auto tmp = complement_rec(pos) & std::move(res);
std::swap(tmp, res); std::swap(tmp, res);
pos -= pos->size + 1; pos -= pos->sub.size + 1;
} }
while (pos > start); while (pos > start);
return res; return res;
...@@ -1125,8 +1125,8 @@ namespace spot ...@@ -1125,8 +1125,8 @@ namespace spot
static acc_cond::acc_code static acc_cond::acc_code
strip_rec(const acc_cond::acc_word* pos, acc_cond::mark_t rem, bool missing) strip_rec(const acc_cond::acc_word* pos, acc_cond::mark_t rem, bool missing)
{ {
auto start = pos - pos->size; auto start = pos - pos->sub.size;
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
{ {
...@@ -1136,7 +1136,7 @@ namespace spot ...@@ -1136,7 +1136,7 @@ namespace spot
{ {
auto tmp = strip_rec(pos, rem, missing) & std::move(res); auto tmp = strip_rec(pos, rem, missing) & std::move(res);
std::swap(tmp, res); std::swap(tmp, res);
pos -= pos->size + 1; pos -= pos->sub.size + 1;
} }
while (pos > start); while (pos > start);
return res; return res;
...@@ -1149,7 +1149,7 @@ namespace spot ...@@ -1149,7 +1149,7 @@ namespace spot
{ {
auto tmp = strip_rec(pos, rem, missing) | std::move(res); auto tmp = strip_rec(pos, rem, missing) | std::move(res);
std::swap(tmp, res); std::swap(tmp, res);
pos -= pos->size + 1; pos -= pos->sub.size + 1;
} }
while (pos > start); while (pos > start);
return res; return res;
...@@ -1190,7 +1190,7 @@ namespace spot ...@@ -1190,7 +1190,7 @@ namespace spot
auto end = &front(); auto end = &front();
while (pos > end) while (pos > end)
{ {
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
...@@ -1220,7 +1220,7 @@ namespace spot ...@@ -1220,7 +1220,7 @@ namespace spot
auto end = &front(); auto end = &front();
while (pos > end) while (pos > end)
{ {
switch (pos->op) switch (pos->sub.op)
{ {
case acc_cond::acc_op::And: case acc_cond::acc_op::And:
case acc_cond::acc_op::Or: case acc_cond::acc_op::Or:
......
// -*- coding: utf-8 -*- // -*- coding: utf-8 -*-
// Copyright (C) 2014, 2015, 2016 Laboratoire de Recherche et // Copyright (C) 2014, 2015, 2016, 2017 Laboratoire de Recherche et
// Développement de l'Epita. // Développement de l'Epita.
// //
// This file is part of Spot, a model checking library. // This file is part of Spot, a model checking library.
...@@ -294,7 +294,7 @@ namespace spot ...@@ -294,7 +294,7 @@ namespace spot
acc_op op; // Operator acc_op op; // Operator