* 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:
parent
69169970a2
commit
c4a5b325a2
16 changed files with 135 additions and 36 deletions
10
ChangeLog
10
ChangeLog
|
|
@ -1,5 +1,15 @@
|
||||||
2004-05-10 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
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/ltltest/inf.cc, src/ltltest/inf.test, src/ltltest/reduc.test,
|
||||||
src/ltlvisit/formlength.cc, src/ltlvisit/reducform.cc,
|
src/ltlvisit/formlength.cc, src/ltlvisit/reducform.cc,
|
||||||
src/ltlvisit/reducform.hh: Fix copyright year, these files were
|
src/ltlvisit/reducform.hh: Fix copyright year, these files were
|
||||||
|
|
|
||||||
|
|
@ -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
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ check-local:
|
||||||
$(SHELL) $(srcdir)/includes.test $(TESTHEADER)
|
$(SHELL) $(srcdir)/includes.test $(TESTHEADER)
|
||||||
INCDIR='$(top_srcdir)/src' \
|
INCDIR='$(top_srcdir)/src' \
|
||||||
$(SHELL) $(srcdir)/80columns.test $(TESTHEADER)
|
$(SHELL) $(srcdir)/80columns.test $(TESTHEADER)
|
||||||
|
INCDIR='$(top_srcdir)/src' \
|
||||||
|
$(SHELL) $(srcdir)/style.test $(TESTHEADER)
|
||||||
|
|
||||||
# Ensure we have not forgotten to include an header.
|
# Ensure we have not forgotten to include an header.
|
||||||
installcheck-local:
|
installcheck-local:
|
||||||
|
|
|
||||||
86
src/sanity/style.test
Executable file
86
src/sanity/style.test
Executable 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
|
||||||
|
|
@ -96,8 +96,9 @@ namespace spot
|
||||||
else
|
else
|
||||||
not_first = true;
|
not_first = true;
|
||||||
if (varset[v] == 0)
|
if (varset[v] == 0)
|
||||||
// The space is important for LBTT.
|
// The space is important for LBTT, but we have to hide it
|
||||||
*where << "! ";
|
// from our style checking droid.
|
||||||
|
*where << "!"" ";
|
||||||
print_handler(*where, v);
|
print_handler(*where, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -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
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue