cpp

Coverage Report

Created: 2022-07-20 01:16

/home/uke/oil/cpp/leaky_core_pyerror.h
Line
Count
Source (jump to first uncovered line)
1
// leaky_core_pyerror.h
2
3
#ifndef CORE_PYERROR_H
4
#define CORE_PYERROR_H
5
6
// STUBS for varargs functions like p_die()
7
// [[noreturn]] avoids warnings
8
9
0
[[noreturn]] inline void p_die(Str* s, int span_id) {
10
0
  throw new error::Parse(s, span_id);
11
0
}
12
13
0
[[noreturn]] inline void p_die(Str* s, syntax_asdl::Token* token) {
14
0
  throw new error::Parse(s, token);
15
0
}
16
17
0
[[noreturn]] inline void p_die(Str* s, syntax_asdl::word_part_t* part) {
18
0
  throw new error::Parse(s, part);
19
0
}
20
21
0
[[noreturn]] inline void p_die(Str* s, syntax_asdl::word_t* w) {
22
0
  throw new error::Parse(s, w);
23
0
}
24
25
0
[[noreturn]] inline void e_die(Str* s) {
26
0
  throw new error::FatalRuntime(s);
27
0
}
28
29
// TODO: respect more arguments
30
31
0
[[noreturn]] inline void e_die(Str* s, int span_id) {
32
0
  throw new error::FatalRuntime(s);
33
0
}
34
35
0
[[noreturn]] inline void e_die(Str* s, syntax_asdl::Token* token) {
36
0
  throw new error::FatalRuntime(s);
37
0
}
38
39
0
[[noreturn]] inline void e_die(Str* s, syntax_asdl::word_part_t* part) {
40
0
  throw new error::FatalRuntime(s);
41
0
}
42
43
1
[[noreturn]] inline void e_die(Str* s, syntax_asdl::word_t* w) {
44
1
  throw new error::FatalRuntime(s);
45
1
}
46
47
0
[[noreturn]] inline void e_die_status(int status, Str* s) {
48
0
  throw new error::FatalRuntime(status, s);
49
0
}
50
51
0
[[noreturn]] inline void e_die_status(int status, Str* s, int span_id) {
52
0
  throw new error::FatalRuntime(status, s);
53
0
}
54
55
[[noreturn]] inline void e_die_status(int status, Str* s,
56
0
                                      syntax_asdl::word_t* w) {
57
0
  throw new error::FatalRuntime(status, s);
58
0
}
59
60
0
[[noreturn]] inline void e_strict(Str* s, int span_id) {
61
0
  throw new error::Strict(s);
62
0
}
63
64
0
[[noreturn]] inline void e_strict(Str* s, syntax_asdl::Token* token) {
65
0
  throw new error::Strict(s);
66
0
}
67
68
0
[[noreturn]] inline void e_strict(Str* s, syntax_asdl::word_part_t* part) {
69
0
  throw new error::Strict(s);
70
0
}
71
72
0
[[noreturn]] inline void e_strict(Str* s, syntax_asdl::word_t* w) {
73
0
  throw new error::Strict(s);
74
0
}
75
76
// Used without args in osh/string_ops.py
77
1
[[noreturn]] inline void e_strict(Str* s) {
78
1
  throw new error::Strict(s);
79
1
}
80
81
// e.g. used in core/state.py
82
0
[[noreturn]] inline void e_usage(Str* s) {
83
0
  throw new error::Usage(s, -1);  // NO_SPID
84
0
}
85
86
0
[[noreturn]] inline void e_usage(Str* s, int span_id) {
87
0
  throw new error::Usage(s, span_id);
88
0
}
89
90
#endif  // CORE_PYERROR_H