/home/uke/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/gc_heap.h" |
6 | | |
7 | | using gc_heap::Str; |
8 | | |
9 | | // |
10 | | // Copied from cpp/core_error.h |
11 | | // |
12 | | |
13 | | namespace error { |
14 | | |
15 | | class _ErrorWithLocation : public std::exception { |
16 | | public: |
17 | 0 | _ErrorWithLocation(Str* user_str, int span_id) { |
18 | 0 | } |
19 | | }; |
20 | | |
21 | | class Parse : public _ErrorWithLocation { |
22 | | public: |
23 | 0 | Parse(Str* user_str, int span_id) : _ErrorWithLocation(user_str, span_id) { |
24 | 0 | } |
25 | | }; |
26 | | |
27 | | class FatalRuntime : public _ErrorWithLocation { |
28 | | public: |
29 | 0 | FatalRuntime(Str* user_str) : _ErrorWithLocation(user_str, -1) { |
30 | 0 | } |
31 | | }; |
32 | | |
33 | | }; |
34 | | |
35 | | // |
36 | | // Copied from cpp/core_pyerror.h |
37 | | // |
38 | | |
39 | 0 | [[noreturn]] inline void p_die(Str* s, int span_id) { |
40 | 0 | throw new error::Parse(s, span_id); |
41 | 0 | } |
42 | | |
43 | 0 | [[noreturn]] inline void e_die(Str* s) { |
44 | 0 | throw new error::FatalRuntime(s); |
45 | 0 | } |
46 | | |
47 | 0 | [[noreturn]] inline void e_die(Str* s, int span_id) { |
48 | 0 | throw new error::FatalRuntime(s); |
49 | 0 | } |