never iterate on the edge_vector()

This fixes #552, reported by Rüdiger and Ayrat.

* tests/sanity/style.test: Warn aginst iterations on edge_vector.
* spot/parseaut/parseaut.yy, spot/twaalgos/complete.cc,
spot/twaalgos/parity.cc: Iterate over edges(), not edge_vector().
* tests/core/ltlcross.test: Add a test case for #552.
* NEWS: Mention the bug.
This commit is contained in:
Alexandre Duret-Lutz 2023-11-17 22:07:40 +01:00
parent 313e43c84b
commit 205df01390
6 changed files with 27 additions and 7 deletions

View file

@ -69,7 +69,12 @@ ltlcross --verbose ltl2tgba ltl2tgba \
# Issue #524.
ltlcross ltl2tgba -f '!(X(v3 | G!v5) | ((Xv5 & !(v5 & !X!v3)) U !v5))'
# Issue #546.
ltlcross 'ltl2tgba --medium -p' 'ltl2tgba -p' 'ltl2tgba --medium -D -p' \
# Issue #546, Issue #552.
ltlcross 'ltl2tgba --medium -p' \
'ltl2tgba -p' \
'ltl2tgba --medium -D -p' \
'ltl2tgba --medium --colored-parity="min even" -C -D' \
'ltl2tgba --colored-parity="min even" -C -D' \
-f 'a | FGa | GF(!b | Gb)' \
-f '(~ v1 U ~ v5) | G(F v9 & F G v1) | G F(~ v7 | G v7 | G v3)'
-f '(~ v1 U ~ v5) | G(F v9 & F G v1) | G F(~ v7 | G v7 | G v3)' \
-f 'FG((a | Fb | FG!b) & !G(c & d))'

View file

@ -298,6 +298,11 @@ for dir in "$TOP/spot" "$TOP/bin" "$TOP/tests"; do
$GREP 'catch *([^.]' $tmp | $GREP -v 'const.*&' &&
diag 'Always capture exceptions by const reference.'
# iterating over edge_vector() is suspicious, because the
# first edge should not be used.
$GREP 'for (.*:.*edge_vector()' $tmp &&
diag 'Did you mean to iterate over edges()?'
case $file in
*.hh | *.hxx)
if $GREP -E '(<<|>>)' $tmp >/dev/null; then