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

* iface/gspn/common.cc, iface/gspn/common.hh,

src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh,
src/ltlparse/fmterror.cc, src/ltlparse/public.hh,
src/ltlvisit/dotty.cc, src/ltlvisit/dotty.hh,
src/ltlvisit/dump.cc, src/ltlvisit/dump.hh,
src/ltlvisit/tostring.cc, src/ltlvisit/tostring.hh,
src/misc/escape.cc, src/misc/escape.hh, src/tgba/bdddict.cc,
src/tgba/bdddict.hh, src/tgba/bddprint.cc, src/tgba/bddprint.hh,
src/tgbaalgos/dotty.cc, src/tgbaalgos/dotty.hh,
src/tgbaalgos/lbtt.cc, src/tgbaalgos/lbtt.hh,
src/tgbaalgos/neverclaim.cc, src/tgbaalgos/neverclaim.hh,
src/tgbaalgos/save.cc, src/tgbaalgos/save.hh,
src/tgbaalgos/gtec/status.cc, src/tgbaalgos/gtec/status.hh,
src/tgbaparse/fmterror.cc, src/tgbaparse/public.hh: Include <iosfwd>
in headers, and prefer <ostream> in the body whenever possible.
* src/sanity/style.test, HACKING: Check and document this.
parent 6853977b
2004-08-09 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-08-09 Alexandre Duret-Lutz <adl@src.lip6.fr>
* iface/gspn/common.cc, iface/gspn/common.hh,
src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh,
src/ltlparse/fmterror.cc, src/ltlparse/public.hh,
src/ltlvisit/dotty.cc, src/ltlvisit/dotty.hh,
src/ltlvisit/dump.cc, src/ltlvisit/dump.hh,
src/ltlvisit/tostring.cc, src/ltlvisit/tostring.hh,
src/misc/escape.cc, src/misc/escape.hh, src/tgba/bdddict.cc,
src/tgba/bdddict.hh, src/tgba/bddprint.cc, src/tgba/bddprint.hh,
src/tgbaalgos/dotty.cc, src/tgbaalgos/dotty.hh,
src/tgbaalgos/lbtt.cc, src/tgbaalgos/lbtt.hh,
src/tgbaalgos/neverclaim.cc, src/tgbaalgos/neverclaim.hh,
src/tgbaalgos/save.cc, src/tgbaalgos/save.hh,
src/tgbaalgos/gtec/status.cc, src/tgbaalgos/gtec/status.hh,
src/tgbaparse/fmterror.cc, src/tgbaparse/public.hh: Include <iosfwd>
in headers, and prefer <ostream> in the body whenever possible.
* src/sanity/style.test, HACKING: Check and document this.
* src/ltlast/allnodes.hh, src/ltlast/atomic_prop.hh, * src/ltlast/allnodes.hh, src/ltlast/atomic_prop.hh,
src/ltlast/binop.hh, src/ltlast/constant.hh, src/ltlast/binop.hh, src/ltlast/constant.hh,
src/ltlast/formula.hh, src/ltlast/multop.hh, src/ltlast/formula.hh, src/ltlast/multop.hh,
......
...@@ -243,3 +243,8 @@ Other style recommandations ...@@ -243,3 +243,8 @@ Other style recommandations
* Do not systematically initialise local variables with 0 or other * Do not systematically initialise local variables with 0 or other
meaningless values. This hides errors to valgrind. meaningless values. This hides errors to valgrind.
* Avoid <iostream>, <ostream>, etc. in headers whenever possible.
Prefer <iosfwd> when predeclarations are sufficient, and then
use for instance use just <ostream> in the corresponding .cc file.
(A plain <iostream> is needed when using std::cout, std::cerr, etc.)
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// 02111-1307, USA. // 02111-1307, USA.
#include "common.hh" #include "common.hh"
#include "ltlvisit/destroy.hh" #include <ostream>
namespace spot namespace spot
{ {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# define SPOT_IFACE_GSPN_COMMON_HH # define SPOT_IFACE_GSPN_COMMON_HH
# include <string> # include <string>
# include <iostream> # include <iosfwd>
// Do not include gspnlib.h here, or it will polute the user's // Do not include gspnlib.h here, or it will polute the user's
// namespace with internal C symbols. // namespace with internal C symbols.
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "atomic_prop.hh" #include "atomic_prop.hh"
#include "visitor.hh" #include "visitor.hh"
#include <cassert> #include <cassert>
#include <ostream>
namespace spot namespace spot
{ {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# define SPOT_LTLAST_ATOMIC_PROP_HH # define SPOT_LTLAST_ATOMIC_PROP_HH
#include <string> #include <string>
#include <iostream> #include <iosfwd>
#include <map> #include <map>
#include "refformula.hh" #include "refformula.hh"
#include "ltlenv/environment.hh" #include "ltlenv/environment.hh"
......
// 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.
// //
...@@ -20,13 +20,14 @@ ...@@ -20,13 +20,14 @@
// 02111-1307, USA. // 02111-1307, USA.
#include "public.hh" #include "public.hh"
#include <ostream>
namespace spot namespace spot
{ {
namespace ltl namespace ltl
{ {
bool bool
format_parse_errors(std::ostream& os, format_parse_errors(std::ostream& os,
const std::string& ltl_string, const std::string& ltl_string,
parse_error_list& error_list) parse_error_list& error_list)
......
// 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.
// //
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
# include <string> # include <string>
# include <list> # include <list>
# include <utility> # include <utility>
# include <iostream> # include <iosfwd>
namespace spot namespace spot
{ {
...@@ -39,6 +39,7 @@ namespace spot ...@@ -39,6 +39,7 @@ namespace spot
/// \brief A list of parser diagnostics, as filled by parse. /// \brief A list of parser diagnostics, as filled by parse.
typedef std::list<parse_error> parse_error_list; typedef std::list<parse_error> parse_error_list;
/// \brief Build a formula from an LTL string. /// \brief Build a formula from an LTL string.
/// \param ltl_string The string to parse. /// \param ltl_string The string to parse.
/// \param error_list A list that will be filled with /// \param error_list A list that will be filled with
...@@ -59,7 +60,6 @@ namespace spot ...@@ -59,7 +60,6 @@ namespace spot
environment& env = default_environment::instance(), environment& env = default_environment::instance(),
bool debug = false); bool debug = false);
/// \brief Format diagnostics produced by spot::ltl::parse. /// \brief Format diagnostics produced by spot::ltl::parse.
/// \param os Where diagnostics should be output. /// \param os Where diagnostics should be output.
/// \param ltl_string The string that were parsed. /// \param ltl_string The string that were parsed.
......
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre // dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
// et Marie Curie. // et Marie Curie.
// //
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "dotty.hh" #include "dotty.hh"
#include "ltlast/visitor.hh" #include "ltlast/visitor.hh"
#include "ltlast/allnodes.hh" #include "ltlast/allnodes.hh"
#include <ostream>
namespace spot namespace spot
{ {
......
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre // dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
// et Marie Curie. // et Marie Curie.
// //
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# define SPOT_LTLVISIT_DOTTY_HH # define SPOT_LTLVISIT_DOTTY_HH
#include <ltlast/formula.hh> #include <ltlast/formula.hh>
#include <iostream> #include <iosfwd>
namespace spot namespace spot
{ {
......
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre // dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
// et Marie Curie. // et Marie Curie.
// //
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "dump.hh" #include "dump.hh"
#include "ltlast/visitor.hh" #include "ltlast/visitor.hh"
#include "ltlast/allnodes.hh" #include "ltlast/allnodes.hh"
#include <ostream>
namespace spot namespace spot
{ {
...@@ -32,7 +32,7 @@ namespace spot ...@@ -32,7 +32,7 @@ namespace spot
class dump_visitor : public const_visitor class dump_visitor : public const_visitor
{ {
public: public:
dump_visitor(std::ostream& os = std::cout) dump_visitor(std::ostream& os)
: os_(os) : os_(os)
{ {
} }
...@@ -80,7 +80,7 @@ namespace spot ...@@ -80,7 +80,7 @@ namespace spot
mo->nth(0)->accept(*this); mo->nth(0)->accept(*this);
for (unsigned n = 1; n < max; ++n) for (unsigned n = 1; n < max; ++n)
{ {
std::cout << ", "; os_ << ", ";
mo->nth(n)->accept(*this); mo->nth(n)->accept(*this);
} }
os_ << ")"; os_ << ")";
......
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre // dpartement Systmes Rpartis Coopratifs (SRC), Universit Pierre
// et Marie Curie. // et Marie Curie.
// //
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# define SPOT_LTLVISIT_DUMP_HH # define SPOT_LTLVISIT_DUMP_HH
#include "ltlast/formula.hh" #include "ltlast/formula.hh"
#include <iostream> #include <iosfwd>
namespace spot namespace spot
{ {
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <cassert> #include <cassert>
#include <sstream> #include <sstream>
#include <ctype.h> #include <ctype.h>
#include <ostream>
#include "tostring.hh" #include "tostring.hh"
#include "ltlast/visitor.hh" #include "ltlast/visitor.hh"
#include "ltlast/allnodes.hh" #include "ltlast/allnodes.hh"
...@@ -56,7 +57,7 @@ namespace spot ...@@ -56,7 +57,7 @@ namespace spot
class to_string_visitor : public const_visitor class to_string_visitor : public const_visitor
{ {
public: public:
to_string_visitor(std::ostream& os = std::cout) to_string_visitor(std::ostream& os)
: os_(os), top_level_(true) : os_(os), top_level_(true)
{ {
} }
...@@ -203,7 +204,7 @@ namespace spot ...@@ -203,7 +204,7 @@ namespace spot
class to_spin_string_visitor : public to_string_visitor class to_spin_string_visitor : public to_string_visitor
{ {
public: public:
to_spin_string_visitor(std::ostream& os = std::cout) to_spin_string_visitor(std::ostream& os)
: to_string_visitor(os) : to_string_visitor(os)
{ {
} }
......
// 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.
// //
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
# define SPOT_LTLVISIT_TOSTRING_HH # define SPOT_LTLVISIT_TOSTRING_HH
#include <ltlast/formula.hh> #include <ltlast/formula.hh>
#include <iostream> #include <iosfwd>
namespace spot namespace spot
{ {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
// 02111-1307, USA. // 02111-1307, USA.
#include <sstream> #include <sstream>
#include <ostream>
#include "escape.hh" #include "escape.hh"
namespace spot namespace spot
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#ifndef SPOT_MISC_ESCAPE_HH #ifndef SPOT_MISC_ESCAPE_HH
# define SPOT_MISC_ESCAPE_HH # define SPOT_MISC_ESCAPE_HH
# include <iostream> # include <iosfwd>
# include <string> # include <string>
namespace spot namespace spot
......
#! /bin/sh #! /bin/sh
# Ensure consistent style by catching common improper constructs. # Ensure consistent style by catching common improper constructs.
...@@ -113,9 +114,21 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do ...@@ -113,9 +114,21 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
grep -e 'return[ ]*[(][^(]*[)];' $tmp && grep -e 'return[ ]*[(][^(]*[)];' $tmp &&
diag 'No useless parentheses after return.' diag 'No useless parentheses after return.'
grep 'NULL' $tmp && grep 'NULL' $tmp &&
diag 'Use 0 instead of NULL. NULL is not portable.' diag 'Use 0 instead of NULL. NULL is not portable.'
case $file in
*.hh | *.hxx)
if grep -e '(cout|cerr|clog)' $tmp >/dev/null; then
:
else
grep '#.*include.*<iostream>' $tmp &&
diag 'Avoid <iostream> in headers, better use <iosfwd>.'
fi
;;
esac
$fail && echo "$file" >>failures $fail && echo "$file" >>failures
done done
done done
......
...@@ -19,10 +19,11 @@ ...@@ -19,10 +19,11 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA. // 02111-1307, USA.
#include <ostream>
#include <cassert>
#include <ltlvisit/clone.hh> #include <ltlvisit/clone.hh>
#include <ltlvisit/destroy.hh> #include <ltlvisit/destroy.hh>
#include <ltlvisit/tostring.hh> #include <ltlvisit/tostring.hh>
#include <cassert>
#include "bdddict.hh" #include "bdddict.hh"
namespace spot namespace spot
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "misc/hash.hh" #include "misc/hash.hh"
#include <list> #include <list>
#include <set> #include <set>
#include <iostream> #include <iosfwd>
#include <bdd.h> #include <bdd.h>
#include "ltlast/formula.hh" #include "ltlast/formula.hh"
#include "misc/bddalloc.hh" #include "misc/bddalloc.hh"
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <sstream> #include <sstream>
#include <cassert> #include <cassert>
#include <ostream>
#include "bddprint.hh" #include "bddprint.hh"
#include "ltlvisit/tostring.hh" #include "ltlvisit/tostring.hh"
#include "formula2bdd.hh" #include "formula2bdd.hh"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment