aboutsummaryrefslogtreecommitdiff
path: root/odb/diagnostics.hxx
blob: b15b7b4b1373e148971bd39b5d91fad06183407d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// file      : odb/diagnostics.hxx
// copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
// license   : GNU GPL v3; see accompanying LICENSE file

#ifndef ODB_DIAGNOSTICS_HXX
#define ODB_DIAGNOSTICS_HXX

#include <odb/gcc-fwd.hxx>

#include <string>
#include <cstddef>
#include <iostream>

#include <cutl/fs/path.hxx>

#include <odb/location.hxx>

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);

inline std::ostream&
error (location const& l)
{
  return error (l.file, l.line, l.column);
}

inline std::ostream&
warn (location const&l)
{
  return warn (l.file, l.line, l.column);
}

inline std::ostream&
info (location const&l)
{
  return info (l.file, l.line, l.column);
}

std::ostream&
error (location_t);

std::ostream&
warn (location_t);

std::ostream&
info (location_t);

//
//
class cxx_lexer;

std::ostream&
error (cxx_lexer&);

std::ostream&
warn (cxx_lexer&);

std::ostream&
info (cxx_lexer&);

// Location as a string in the "<file>:<line>:<column>" format.
//
std::string
location_string (cutl::fs::path const&,
                 std::size_t line,
                 std::size_t clmn,
                 bool leaf = false);

inline std::string
location_string (location const& l, bool leaf = false)
{
  return location_string (l.file, l.line, l.column, leaf);
}

std::string
location_string (location_t, bool leaf = false);

// 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