From 22ee058d65ff5120a35c483cb414923c647a124c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 19 Sep 2011 09:45:53 +0200 Subject: Rename error.?xx to diagnostics.?xx --- odb/diagnostics.cxx | 105 ++++++++++++++++++++++++++++++++++++++ odb/diagnostics.hxx | 56 ++++++++++++++++++++ odb/error.cxx | 105 -------------------------------------- odb/error.hxx | 56 -------------------- odb/makefile | 2 +- odb/parser.cxx | 2 +- odb/pragma.cxx | 2 +- odb/relational/source.hxx | 2 +- odb/relational/type-processor.cxx | 2 +- 9 files changed, 166 insertions(+), 166 deletions(-) create mode 100644 odb/diagnostics.cxx create mode 100644 odb/diagnostics.hxx delete mode 100644 odb/error.cxx delete mode 100644 odb/error.hxx diff --git a/odb/diagnostics.cxx b/odb/diagnostics.cxx new file mode 100644 index 0000000..2b61370 --- /dev/null +++ b/odb/diagnostics.cxx @@ -0,0 +1,105 @@ +// file : odb/diagnostics.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v3; see accompanying LICENSE file + +#include +#include + +using namespace std; + +std::ostream& +error (cutl::fs::path const& p, size_t line, size_t clmn) +{ + //@@ We only need to do this if we are still parsing (i.e., + // pragma parsing). Is there a way to detect this? + // + errorcount++; + + cerr << p << ':' << line << ':' << clmn << ": error: "; + return cerr; +} + +std::ostream& +warn (cutl::fs::path const& p, size_t line, size_t clmn) +{ + warningcount++; + + cerr << p << ':' << line << ':' << clmn << ": warning: "; + return cerr; +} + +std::ostream& +info (cutl::fs::path const& p, size_t line, size_t clmn) +{ + cerr << p << ':' << line << ':' << clmn << ": info: "; + return cerr; +} + +std::ostream& +error (location_t loc) +{ + errorcount++; + cerr << LOCATION_FILE (loc) << ':' + << LOCATION_LINE (loc) << ':' + << LOCATION_COLUMN (loc) << ':' + << " error: "; + return cerr; +} + +std::ostream& +warn (location_t loc) +{ + warningcount++; + cerr << LOCATION_FILE (loc) << ':' + << LOCATION_LINE (loc) << ':' + << LOCATION_COLUMN (loc) << ':' + << " warning: "; + return cerr; +} + +std::ostream& +info (location_t loc) +{ + cerr << LOCATION_FILE (loc) << ':' + << LOCATION_LINE (loc) << ':' + << LOCATION_COLUMN (loc) << ':' + << " info: "; + return cerr; +} + +std::ostream& +error () +{ + return error (input_location); +} + +std::ostream& +warn () +{ + return warn (input_location); +} + +std::ostream& +info () +{ + return info (input_location); +} + +cutl::fs::path +location_file (location_t loc) +{ + return cutl::fs::path (LOCATION_FILE (loc)); +} + +size_t +location_line (location_t loc) +{ + return LOCATION_LINE (loc); +} + +size_t +location_column (location_t loc) +{ + return LOCATION_COLUMN (loc); +} diff --git a/odb/diagnostics.hxx b/odb/diagnostics.hxx new file mode 100644 index 0000000..6f417cb --- /dev/null +++ b/odb/diagnostics.hxx @@ -0,0 +1,56 @@ +// file : odb/diagnostics.hxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v3; see accompanying LICENSE file + +#ifndef ODB_DIAGNOSTICS_HXX +#define ODB_DIAGNOSTICS_HXX + +#include + +#include +#include + +#include + +using std::endl; + +std::ostream& +error (cutl::fs::path const&, std::size_t line, std::size_t clmn); + +std::ostream& +warn (cutl::fs::path const&, std::size_t line, std::size_t clmn); + +std::ostream& +info (cutl::fs::path const&, std::size_t line, std::size_t clmn); + +std::ostream& +error (location_t); + +std::ostream& +warn (location_t); + +std::ostream& +info (location_t); + +std::ostream& +error (); + +std::ostream& +warn (); + +std::ostream& +info (); + +// location_t macro wrappers. +// +cutl::fs::path +location_file (location_t); + +std::size_t +location_line (location_t); + +std::size_t +location_column (location_t); + +#endif // ODB_DIAGNOSTICS_HXX diff --git a/odb/error.cxx b/odb/error.cxx deleted file mode 100644 index 05a30ca..0000000 --- a/odb/error.cxx +++ /dev/null @@ -1,105 +0,0 @@ -// file : odb/error.cxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -// license : GNU GPL v3; see accompanying LICENSE file - -#include -#include - -using namespace std; - -std::ostream& -error (cutl::fs::path const& p, size_t line, size_t clmn) -{ - //@@ We only need to do this if we are still parsing (i.e., - // pragma parsing). Is there a way to detect this? - // - errorcount++; - - cerr << p << ':' << line << ':' << clmn << ": error: "; - return cerr; -} - -std::ostream& -warn (cutl::fs::path const& p, size_t line, size_t clmn) -{ - warningcount++; - - cerr << p << ':' << line << ':' << clmn << ": warning: "; - return cerr; -} - -std::ostream& -info (cutl::fs::path const& p, size_t line, size_t clmn) -{ - cerr << p << ':' << line << ':' << clmn << ": info: "; - return cerr; -} - -std::ostream& -error (location_t loc) -{ - errorcount++; - cerr << LOCATION_FILE (loc) << ':' - << LOCATION_LINE (loc) << ':' - << LOCATION_COLUMN (loc) << ':' - << " error: "; - return cerr; -} - -std::ostream& -warn (location_t loc) -{ - warningcount++; - cerr << LOCATION_FILE (loc) << ':' - << LOCATION_LINE (loc) << ':' - << LOCATION_COLUMN (loc) << ':' - << " warning: "; - return cerr; -} - -std::ostream& -info (location_t loc) -{ - cerr << LOCATION_FILE (loc) << ':' - << LOCATION_LINE (loc) << ':' - << LOCATION_COLUMN (loc) << ':' - << " info: "; - return cerr; -} - -std::ostream& -error () -{ - return error (input_location); -} - -std::ostream& -warn () -{ - return warn (input_location); -} - -std::ostream& -info () -{ - return info (input_location); -} - -cutl::fs::path -location_file (location_t loc) -{ - return cutl::fs::path (LOCATION_FILE (loc)); -} - -size_t -location_line (location_t loc) -{ - return LOCATION_LINE (loc); -} - -size_t -location_column (location_t loc) -{ - return LOCATION_COLUMN (loc); -} diff --git a/odb/error.hxx b/odb/error.hxx deleted file mode 100644 index 781cbc8..0000000 --- a/odb/error.hxx +++ /dev/null @@ -1,56 +0,0 @@ -// file : odb/error.hxx -// author : Boris Kolpackov -// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC -// license : GNU GPL v3; see accompanying LICENSE file - -#ifndef ODB_ERROR_HXX -#define ODB_ERROR_HXX - -#include - -#include -#include - -#include - -using std::endl; - -std::ostream& -error (cutl::fs::path const&, std::size_t line, std::size_t clmn); - -std::ostream& -warn (cutl::fs::path const&, std::size_t line, std::size_t clmn); - -std::ostream& -info (cutl::fs::path const&, std::size_t line, std::size_t clmn); - -std::ostream& -error (location_t); - -std::ostream& -warn (location_t); - -std::ostream& -info (location_t); - -std::ostream& -error (); - -std::ostream& -warn (); - -std::ostream& -info (); - -// location_t macro wrappers. -// -cutl::fs::path -location_file (location_t); - -std::size_t -location_line (location_t); - -std::size_t -location_column (location_t); - -#endif // ODB_ERROR_HXX diff --git a/odb/makefile b/odb/makefile index 1665faf..493eca7 100644 --- a/odb/makefile +++ b/odb/makefile @@ -13,8 +13,8 @@ sql-token.cxx \ sql-lexer.cxx \ context.cxx \ common.cxx \ +diagnostics.cxx \ emitter.cxx \ -error.cxx \ lookup.cxx \ include.cxx \ header.cxx \ diff --git a/odb/parser.cxx b/odb/parser.cxx index b8ea160..134aef1 100644 --- a/odb/parser.cxx +++ b/odb/parser.cxx @@ -13,7 +13,7 @@ #include #include -#include +#include #include #include diff --git a/odb/pragma.cxx b/odb/pragma.cxx index 17eaa42..66c026a 100644 --- a/odb/pragma.cxx +++ b/odb/pragma.cxx @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index 86d60c7..8512c2d 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/odb/relational/type-processor.cxx b/odb/relational/type-processor.cxx index 650294d..9996196 100644 --- a/odb/relational/type-processor.cxx +++ b/odb/relational/type-processor.cxx @@ -7,7 +7,7 @@ #include -#include +#include #include #include #include -- cgit v1.1