aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/diagnostics.ixx
blob: 273dfade1de0811665a9caf08fd68eedca6f9492 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// file      : libbuild2/diagnostics.ixx -*- C++ -*-
// license   : MIT; see accompanying LICENSE file

namespace build2
{
  // print_diag()
  //
  LIBBUILD2_SYMEXPORT void
  print_diag_impl (const char*, target_key*, target_key&&, const char*);

  LIBBUILD2_SYMEXPORT void
  print_diag_impl (const char*,
                   target_key*, vector<target_key>&& r,
                   const char*);

  inline void
  print_diag (const char* p, target_key&& l, target_key&& r, const char* c)
  {
    print_diag_impl (p, &l, move (r), c);
  }

  inline void
  print_diag (const char* p,
              target_key&& l, vector<target_key>&& r,
              const char* c)
  {
    print_diag_impl (p, &l, move (r), c);
  }

  inline void
  print_diag (const char* p, target_key& r)
  {
    print_diag_impl (p, nullptr, move (r), nullptr);
  }

  inline void
  print_diag (const char* p, vector<target_key>&& r)
  {
    print_diag_impl (p, nullptr, move (r), nullptr);
  }

  inline void
  print_diag (const char* p, const path& r)
  {
    print_diag (p, path_name (&r));
  }

  inline void
  print_diag (const char* p, const target& l, const path& r, const char* c)
  {
    print_diag (p, l, path_name (&r), c);
  }

  inline void
  print_diag (const char* p, const path& l, const path& r, const char* c)
  {
    print_diag (p, l, path_name (&r), c);
  }

  inline void
  print_diag (const char* p, const string& l, const path& r, const char* c)
  {
    print_diag (p, l, path_name (&r), c);
  }

  // diag_buffer
  //
  inline diag_buffer::
  diag_buffer (context& ctx)
      : is (ifdstream::badbit), ctx_ (ctx)
  {
  }

  inline diag_buffer::
  diag_buffer (context& ctx, vector<char>&& b)
      : is (ifdstream::badbit), buf (move (b)), ctx_ (ctx)
  {
    buf.clear ();
  }

  inline diag_buffer::
  diag_buffer (context& ctx, const char* args0, auto_fd&& fd, fdstream_mode m)
      : diag_buffer (ctx)
  {
    open (args0, move (fd), m);
  }

  inline diag_buffer::
  diag_buffer (context& ctx, const char* args0, process& pr, fdstream_mode m)
      : diag_buffer (ctx)
  {
    open (args0, move (pr.in_efd), m);
  }

  inline diag_buffer::
  diag_buffer (context& ctx,
               vector<char>&& b,
               const char* args0,
               auto_fd&& fd,
               fdstream_mode m)
      : diag_buffer (ctx, move (b))
  {
    open (args0, move (fd), m);
  }

  inline diag_buffer::
  diag_buffer (context& ctx,
               vector<char>&& b,
               const char* args0,
               process& pr,
               fdstream_mode m)
      : diag_buffer (ctx, move (b))
  {
    open (args0, move (pr.in_efd), m);
  }

  inline void diag_buffer::
  close (const cstrings& args,
         const process_exit& pe,
         uint16_t verbosity,
         bool omit_normal,
         const location& loc)
  {
    close (args.data (), pe, verbosity, omit_normal, loc);
  }
}