* src/sanity/style.test: New file.

* src/sanity/Makefile.am (check-local): Run it.
* src/ltlvisit/nenoform.cc, src/ltlvisit/tostring.cc,
src/tgba/bdddict.cc, src/tgba/bddprint.cc, src/tgba/tgba.cc,
src/tgba/tgbaproduct.cc, src/tgbaalgos/lbtt.cc,
src/tgbaalgos/magic.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/reachiter.cc, src/tgbaalgos/gtec/ce.cc,
src/tgbaalgos/gtec/gtec.cc, src/tgbatest/ltl2tgba.cc: Fix style
issues reported by style.test.
This commit is contained in:
Alexandre Duret-Lutz 2004-05-10 18:38:20 +00:00
parent 69169970a2
commit c4a5b325a2
16 changed files with 135 additions and 36 deletions

View file

@ -1,5 +1,15 @@
2004-05-10 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/sanity/style.test: New file.
* src/sanity/Makefile.am (check-local): Run it.
* src/ltlvisit/nenoform.cc, src/ltlvisit/tostring.cc,
src/tgba/bdddict.cc, src/tgba/bddprint.cc, src/tgba/tgba.cc,
src/tgba/tgbaproduct.cc, src/tgbaalgos/lbtt.cc,
src/tgbaalgos/magic.cc, src/tgbaalgos/powerset.cc,
src/tgbaalgos/reachiter.cc, src/tgbaalgos/gtec/ce.cc,
src/tgbaalgos/gtec/gtec.cc, src/tgbatest/ltl2tgba.cc: Fix style
issues reported by style.test.
* src/ltltest/inf.cc, src/ltltest/inf.test, src/ltltest/reduc.test,
src/ltlvisit/formlength.cc, src/ltlvisit/reducform.cc,
src/ltlvisit/reducform.hh: Fix copyright year, these files were

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//

View file

@ -32,6 +32,8 @@ check-local:
$(SHELL) $(srcdir)/includes.test $(TESTHEADER)
INCDIR='$(top_srcdir)/src' \
$(SHELL) $(srcdir)/80columns.test $(TESTHEADER)
INCDIR='$(top_srcdir)/src' \
$(SHELL) $(srcdir)/style.test $(TESTHEADER)
# Ensure we have not forgotten to include an header.
installcheck-local:

86
src/sanity/style.test Executable file
View file

@ -0,0 +1,86 @@
#! /bin/sh
# Ensure consistent style by catching common improper constructs.
set -e
diag()
{
fail=:
echo "$file:" "$@"
echo ============================================================
}
rm -f failures
# Get some help from GNU grep.
GREP_OPTIONS='--color=auto -n'
GREP_COLOR='1;31'
export GREP_OPTIONS
export GREP_COLOR
tmp=incltest.tmp
find "${INCDIR-..}" \( -name "${1-*}.hh" -o -name "${1-*}.cc" \) \
-a -type f -a -print |
while read file; do
if grep 'GNU Bison' "$file" >/dev/null ||
grep 'generated by flex' "$file" >/dev/null ; then
continue
fi
fail=false
sed 's,//.*,,' < $file > $tmp
grep ' if(' $tmp &&
diag 'Missing space after "if"'
grep ' if (.*).*{' $tmp &&
diag 'Opening { should be on its own line.'
grep ' while(' $tmp &&
diag 'Missing space after "while"'
grep ' while (.*).*{' $tmp &&
diag 'Opening { should be on its own line.'
grep ' for(' $tmp &&
diag 'Missing space after "for"'
grep ' for (.*).*{' $tmp &&
diag 'Opening { should be on its own line.'
grep ' switch(' $tmp &&
diag 'Missing space after "for"'
grep ' switch (.*).*{' $tmp &&
diag 'Opening { should be on its own line.'
grep '( ' $tmp &&
diag 'No space after opening (.'
grep ' )' $tmp &&
diag 'No space before closing ).'
grep '! ' $tmp &&
diag 'No space after unary operators (!).'
grep ',[(a-zA-Z+=_!]' $tmp &&
diag 'Space after coma.'
grep '[^ \t\n]&&[^ \t\n]' $tmp &&
diag 'Space arround binary operators.'
grep '[^ \t\n]||[^ \t\n]' $tmp &&
diag 'Space arround binary operators.'
$fail && echo "$file" >>failures
done
if test -f failures; then
echo "The following files contain style errors:"
cat failures
rm failures
exit 1;
fi

View file

@ -96,8 +96,9 @@ namespace spot
else
not_first = true;
if (varset[v] == 0)
// The space is important for LBTT.
*where << "! ";
// The space is important for LBTT, but we have to hide it
// from our style checking droid.
*where << "!"" ";
print_handler(*where, v);
}
}

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//