diff --git a/ChangeLog b/ChangeLog index eba43afef..7fd048901 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-01-30 Alexandre Duret-Lutz + + Check for missing Copyright blurbs, and add them. + + * src/sanity/style.test: Check for missing Copyrights blurbs. + * src/sanity/Makefile.am: Run style.test before includes.test. + * iface/gspn/dcswave.test, iface/gspn/dcswaveeltl.test, + iface/gspn/dcswavefm.test, iface/gspn/dcswaveltl.test, + iface/gspn/simple.test, iface/gspn/udcsefm.test, + iface/gspn/udcseltl.test, iface/gspn/udcsfm.test, + iface/gspn/udcsltl.test, iface/nips/nipstest/dotty.test, + iface/nips/nipstest/emptiness.test, src/eltltest/acc.test, + src/eltltest/nfa.test, src/saba/sabacomplementtgba.cc, + src/sabatest/sabacomplementtgba.cc, src/tgbatest/eltl2tgba.test, + src/tgbatest/taatgba.test: Add missing Copyright blurb. + 2010-01-30 Alexandre Duret-Lutz * NEWS: More text. diff --git a/iface/gspn/dcswave.test b/iface/gspn/dcswave.test index ca225ac76..ee679172d 100755 --- a/iface/gspn/dcswave.test +++ b/iface/gspn/dcswave.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/dcswaveeltl.test b/iface/gspn/dcswaveeltl.test index cbeaca397..d61ad5643 100755 --- a/iface/gspn/dcswaveeltl.test +++ b/iface/gspn/dcswaveeltl.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/dcswavefm.test b/iface/gspn/dcswavefm.test index 30ca752a0..d1bf9419a 100755 --- a/iface/gspn/dcswavefm.test +++ b/iface/gspn/dcswavefm.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/dcswaveltl.test b/iface/gspn/dcswaveltl.test index b0ebb23ea..97f5ab912 100755 --- a/iface/gspn/dcswaveltl.test +++ b/iface/gspn/dcswaveltl.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/simple.test b/iface/gspn/simple.test index c433981eb..8b0682e72 100755 --- a/iface/gspn/simple.test +++ b/iface/gspn/simple.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/udcsefm.test b/iface/gspn/udcsefm.test index 53d0ab17c..8d1bf4b5e 100755 --- a/iface/gspn/udcsefm.test +++ b/iface/gspn/udcsefm.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/udcseltl.test b/iface/gspn/udcseltl.test index 606fbd7c0..f0947dcaa 100755 --- a/iface/gspn/udcseltl.test +++ b/iface/gspn/udcseltl.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/udcsfm.test b/iface/gspn/udcsfm.test index caa48e446..c4cfbce51 100755 --- a/iface/gspn/udcsfm.test +++ b/iface/gspn/udcsfm.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/gspn/udcsltl.test b/iface/gspn/udcsltl.test index 388936c67..a394b4fa5 100755 --- a/iface/gspn/udcsltl.test +++ b/iface/gspn/udcsltl.test @@ -1,4 +1,24 @@ #! /bin/sh +# Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), +# département Systèmes Répartis Coopératifs (SRC), Université Pierre +# et Marie Curie. +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/nips/nipstest/dotty.test b/iface/nips/nipstest/dotty.test index 201d10d8b..a42cabcde 100755 --- a/iface/nips/nipstest/dotty.test +++ b/iface/nips/nipstest/dotty.test @@ -1,4 +1,23 @@ #!/bin/sh +# Copyright (C) 2008 Laboratoire de Recherche et Développement de +# l'Epita (LRDE) +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/iface/nips/nipstest/emptiness.test b/iface/nips/nipstest/emptiness.test index fb93ac2f5..14c8a93fa 100755 --- a/iface/nips/nipstest/emptiness.test +++ b/iface/nips/nipstest/emptiness.test @@ -1,4 +1,23 @@ #!/bin/sh +# Copyright (C) 2008 Laboratoire de Recherche et Développement de +# l'Epita (LRDE) +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/src/eltltest/acc.test b/src/eltltest/acc.test index 9ca5e40cb..491e3815f 100755 --- a/src/eltltest/acc.test +++ b/src/eltltest/acc.test @@ -1,4 +1,23 @@ #!/bin/sh +# Copyright (C) 2009 Laboratoire de Recherche et Développement +# de l'Epita (LRDE). +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/src/eltltest/nfa.test b/src/eltltest/nfa.test index 607d125e6..30187fa07 100755 --- a/src/eltltest/nfa.test +++ b/src/eltltest/nfa.test @@ -1,4 +1,23 @@ #!/bin/sh +# Copyright (C) 2009 Laboratoire de Recherche et Développement +# de l'Epita (LRDE). +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit 1 diff --git a/src/saba/sabacomplementtgba.cc b/src/saba/sabacomplementtgba.cc index 907347f23..201facc66 100644 --- a/src/saba/sabacomplementtgba.cc +++ b/src/saba/sabacomplementtgba.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement +// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. diff --git a/src/sabatest/sabacomplementtgba.cc b/src/sabatest/sabacomplementtgba.cc index e04f15a0c..e9d50ee3c 100644 --- a/src/sabatest/sabacomplementtgba.cc +++ b/src/sabatest/sabacomplementtgba.cc @@ -1,3 +1,23 @@ +// Copyright (C) 2009 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). +// +// This file is part of Spot, a model checking library. +// +// Spot is free software; you can redistribute it and/or modify it +// under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Spot is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +// License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Spot; see the file COPYING. If not, write to the Free +// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. + #include #include diff --git a/src/sanity/Makefile.am b/src/sanity/Makefile.am index 88aa5e3e7..30e077978 100644 --- a/src/sanity/Makefile.am +++ b/src/sanity/Makefile.am @@ -27,17 +27,17 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS) # Run `make TESTHEADER=foo.hh check' if you want to check only one # header. check-local: - CXX='$(CXX)' \ - CPPFLAGS='$(AM_CPPFLAGS) $(CPPFLAGS)' \ - CXXFLAGS='$(AM_CXXFLAGS) $(CXXFLAGS)' \ - INCDIR='$(top_srcdir)/src' \ - $(SHELL) $(srcdir)/includes.test $(TESTHEADER) INCDIR='$(top_srcdir)/src' \ $(SHELL) $(srcdir)/80columns.test $(TESTHEADER) INCDIR='$(top_srcdir)/src' \ $(SHELL) $(srcdir)/style.test $(TESTHEADER) top_srcdir='$(top_srcdir)' \ $(PERL) $(srcdir)/readme.test + CXX='$(CXX)' \ + CPPFLAGS='$(AM_CPPFLAGS) $(CPPFLAGS)' \ + CXXFLAGS='$(AM_CXXFLAGS) $(CXXFLAGS)' \ + INCDIR='$(top_srcdir)/src' \ + $(SHELL) $(srcdir)/includes.test $(TESTHEADER) # Ensure we have not forgotten to include an header. installcheck-local: diff --git a/src/sanity/style.test b/src/sanity/style.test index 39cf264f5..4842dcb14 100755 --- a/src/sanity/style.test +++ b/src/sanity/style.test @@ -27,158 +27,174 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do find "$dir" \( -name "${1-*}.hh" \ -o -name "${1-*}.hxx" \ - -o -name "${1-*}.cc" \) \ + -o -name "${1-*}.cc" \ + -o -name "${1-*}.test" \) \ -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 + # Skip the files used by sanity. + case $file in + *incltest.cc) continue;; + esac + fail=false # Check this before stripping comments and strings. grep -i 'accepting cond' $file && diag 'accepting -> acceptance' + grep Copyright $file >/dev/null || + diag "missing copyright" + # Strip comments and strings. sed 's,[ ]*//.*,,;s,"[^"]*","",g' < $file > $tmp grep '[ ]$' $tmp && diag 'Trailing whitespace.' - grep '[ ]if(' $tmp && - diag 'Missing space after "if"' - - grep '[ ]if (.*).*{' $tmp && - diag 'Opening { should be on its own line.' - - grep '[ ]if (.*).*;' $tmp && - diag 'if body should be on another line.' - - grep '[ ]else.*;' $tmp && - diag 'else body should be on another line.' - - grep '[ ]while(' $tmp && - diag 'Missing space after "while"' - - grep '[ ]while (.*).*{' $tmp && - diag 'Opening { should be on its own line.' - - grep '[ ]while (.*).*[^)];' $tmp && - diag 'while body should be on another line.' - - grep '[ ]for(' $tmp && - diag 'Missing space after "for"' - - grep '[ ]for (.*).*{' $tmp && - diag 'Opening { should be on its own line.' - - grep '[ ]for (.*;.*;.*).*;' $tmp && - diag 'for body should be on another line.' - - grep '[ ]switch(' $tmp && - diag 'Missing space after "switch"' - - grep '[ ]switch (.*).*{' $tmp && - diag 'Opening { should be on its own line.' - - grep 'namespace .*{' $tmp && - diag 'Opening { should be on its own line.' - - grep 'class .*{' $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 ",[^ \t\"%']" $tmp && - diag 'Space after coma.' - - grep '[^ ]&&[^ ]' $tmp && - diag 'Space arround binary operators.' - - grep '[^ ]||[^ ]' $tmp && - diag 'Space arround binary operators.' - - grep '[ ]default:[^:].*;' $tmp && - diag 'Label should be on their own line.' - - grep '[ ]case.*:[^:].*;' $tmp && - diag 'Label should be on their own line.' - - grep '[ ];' $tmp && - diag 'No space before semicolon.' - - grep -v 'for (.*;;)' $tmp | grep ';[^ ")]' && - diag 'Must have space or newline after semicolon.' - - grep '}.*}' $tmp && - diag 'No two } on the same line.' - - grep '{.*{' $tmp && - diag 'No two { on the same line.' - - grep 'delete[ ]*[(][^(]*[)];' $tmp && - diag 'No useless parentheses after delete.' - - grep 'return[ ]*[(][^(]*[)];' $tmp && - diag 'No useless parentheses after return.' - - grep 'NULL' $tmp && - diag 'Use 0 instead of NULL. NULL is not portable.' - - # std::list::size() can be O(n). Better use empty() whenever - # possible, even for other containers. - egrep '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp && - diag 'Prefer empty() to check emptiness.' - - egrep '^[^=]*([+][+]|--);' $tmp && - diag 'Take good habits: use ++i instead of i++ when you have the choice.' - - grep '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp && - diag 'Use "x->y", not "(*x).y"' - - grep 'std::hash' $tmp && - diag 'use Sgi:: for hash and hash_map' - - grep 'Sgi::[^h]' $tmp && - diag 'Sgi:: is for hash and hash_map only' - - res=`perl -ne '$/ = undef; - print "$&\n" - while /if \((.*)(\s*==\s*0)?\)\s*delete(\[\])?\s+\1;(?!\s+else)/g' $tmp` - if test -n "$res"; then - echo "$res" - diag 'No "if (x)" required before "delete x;".' - fi - case $file in - *.hh | *.hxx) - if egrep '(cout|cerr|clog)' $tmp >/dev/null; then - : - else - grep '#.*include.*' $tmp && - diag 'Avoid in headers, better use .' - fi - ;; - *.cc) - if grep 'namespace$' $tmp >/dev/null; then - : - else - # We only check classes, but the rule should apply to functions too - grep '^[ ]*class[ ]' $tmp && - diag 'Private definitions must be in anonymous namespace.' - fi - ;; + *.test);; + *) + grep '[ ]if(' $tmp && + diag 'Missing space after "if"' + + grep '[ ]if (.*).*{' $tmp && + diag 'Opening { should be on its own line.' + + grep '[ ]if (.*).*;' $tmp && + diag 'if body should be on another line.' + + grep '[ ]else.*;' $tmp && + diag 'else body should be on another line.' + + grep '[ ]while(' $tmp && + diag 'Missing space after "while"' + + grep '[ ]while (.*).*{' $tmp && + diag 'Opening { should be on its own line.' + + grep '[ ]while (.*).*[^)];' $tmp && + diag 'while body should be on another line.' + + grep '[ ]for(' $tmp && + diag 'Missing space after "for"' + + grep '[ ]for (.*).*{' $tmp && + diag 'Opening { should be on its own line.' + + grep '[ ]for (.*;.*;.*).*;' $tmp && + diag 'for body should be on another line.' + + grep '[ ]switch(' $tmp && + diag 'Missing space after "switch"' + + grep '[ ]switch (.*).*{' $tmp && + diag 'Opening { should be on its own line.' + + grep 'namespace .*{' $tmp && + diag 'Opening { should be on its own line.' + + grep 'class .*{' $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 ",[^ \t\"%']" $tmp && + diag 'Space after coma.' + + grep '[^ ]&&[^ ]' $tmp && + diag 'Space arround binary operators.' + + grep '[^ ]||[^ ]' $tmp && + diag 'Space arround binary operators.' + + grep '[ ]default:[^:].*;' $tmp && + diag 'Label should be on their own line.' + + grep '[ ]case.*:[^:].*;' $tmp && + diag 'Label should be on their own line.' + + grep '[ ];' $tmp && + diag 'No space before semicolon.' + + grep -v 'for (.*;;)' $tmp | grep ';[^ ")]' && + diag 'Must have space or newline after semicolon.' + + grep '}.*}' $tmp && + diag 'No two } on the same line.' + + grep '{.*{' $tmp && + diag 'No two { on the same line.' + + grep 'delete[ ]*[(][^(]*[)];' $tmp && + diag 'No useless parentheses after delete.' + + grep 'return[ ]*[(][^(]*[)];' $tmp && + diag 'No useless parentheses after return.' + + grep 'NULL' $tmp && + diag 'Use 0 instead of NULL. NULL is not portable.' + + # std::list::size() can be O(n). Better use empty() whenever + # possible, even for other containers. + egrep '(->|[.])size\(\) [=!]= 0|![a-zA-Z0-9_]*(->|[.])size\(\)|(if |while |assert)\([a-zA-Z0-9_]*(->|[.])size\(\)\)' $tmp && + diag 'Prefer empty() to check emptiness.' + + egrep '^[^=]*([+][+]|--);' $tmp && + diag 'Take good habits: use ++i instead of i++ when you have the choice.' + + grep '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp && + diag 'Use "x->y", not "(*x).y"' + + grep 'std::hash' $tmp && + diag 'use Sgi:: for hash and hash_map' + + grep 'Sgi::[^h]' $tmp && + diag 'Sgi:: is for hash and hash_map only' + + res=`perl -ne '$/ = undef; + print "$&\n" + while /if \((.*)(\s*==\s*0)?\)\s*delete(\[\])?\s+\1;(?!\s+else)/g' $tmp` + if test -n "$res"; then + echo "$res" + diag 'No "if (x)" required before "delete x;".' + fi + + case $file in + *.hh | *.hxx) + if egrep '(cout|cerr|clog)' $tmp >/dev/null; then + : + else + grep '#.*include.*' $tmp && + diag 'Avoid in headers, better use .' + fi + ;; + *.cc) + if grep 'namespace$' $tmp >/dev/null; then + : + else + # We only check classes, but the rule should apply to functions too + grep '^[ ]*class[ ]' $tmp && + diag 'Private definitions must be in anonymous namespace.' + fi + ;; + esac + ;; esac + $fail && echo "$file" >>failures done || : # Make sure sh does not abort when read exits with false. diff --git a/src/tgbatest/eltl2tgba.test b/src/tgbatest/eltl2tgba.test index 4ec40ab0c..76671557d 100755 --- a/src/tgbatest/eltl2tgba.test +++ b/src/tgbatest/eltl2tgba.test @@ -1,4 +1,23 @@ #!/bin/sh +# Copyright (C) 2009 Laboratoire de Recherche et Développement +# de l'Epita (LRDE). +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit -1 set -e diff --git a/src/tgbatest/taatgba.test b/src/tgbatest/taatgba.test index 5dc1ecbd8..a7ae86cf3 100755 --- a/src/tgbatest/taatgba.test +++ b/src/tgbatest/taatgba.test @@ -1,4 +1,23 @@ #!/bin/sh +# Copyright (C) 2009 Laboratoire de Recherche et Développement +# de l'Epita (LRDE). +# +# This file is part of Spot, a model checking library. +# +# Spot is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# Spot is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +# License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Spot; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. . ./defs || exit -1 set -e