/home/andy/git/oilshell/oil/mycpp/examples/varargs_preamble.h
Line | Count | Source (jump to first uncovered line) |
1 | | // examples/varargs_preamble.h |
2 | | |
3 | | #include <exception> |
4 | | |
5 | | #include "mycpp/runtime.h" |
6 | | |
7 | | // |
8 | | // Copied from cpp/core_error.h |
9 | | // |
10 | | |
11 | | namespace error { |
12 | | |
13 | | class _ErrorWithLocation : public std::exception { |
14 | | public: |
15 | | _ErrorWithLocation(Str* user_str, int span_id) { |
16 | | } |
17 | | }; |
18 | | |
19 | | class Parse : public _ErrorWithLocation { |
20 | | public: |
21 | 0 | Parse(Str* user_str, int span_id) : _ErrorWithLocation(user_str, span_id) { |
22 | 0 | } |
23 | | }; |
24 | | |
25 | | class FatalRuntime : public _ErrorWithLocation { |
26 | | public: |
27 | | FatalRuntime(Str* user_str) : _ErrorWithLocation(user_str, -1) { |
28 | | } |
29 | | }; |
30 | | |
31 | | }; |
32 | | |
33 | | // |
34 | | // Copied from cpp/core_pyerror.h |
35 | | // |
36 | | |
37 | 0 | [[noreturn]] inline void p_die(Str* s, int span_id) { |
38 | 0 | throw new error::Parse(s, span_id); |
39 | 0 | } |
40 | | |
41 | 0 | [[noreturn]] inline void e_die(Str* s) { |
42 | 0 | throw new error::FatalRuntime(s); |
43 | 0 | } |
44 | | |
45 | 0 | [[noreturn]] inline void e_die(Str* s, int span_id) { |
46 | 0 | throw new error::FatalRuntime(s); |
47 | 0 | } |