commit e5dd5c2e03e7fd51b32ee0cf02ca97c1133834c6
parent 42588b9900ea944a0f4fc51c370f951afb682038
Author: Drew DeVault <sir@cmpwn.com>
Date: Fri, 13 Aug 2021 14:53:25 +0200
rt: add support for unreachable abort
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/format/xml/parser.ha b/format/xml/parser.ha
@@ -230,6 +230,7 @@ fn scan_content(par: *parser) (text | error) = {
bufio::unreadrune(par.in, rn);
scan_entity(par)?;
},
+ * => rn,
};
strio::appendrune(par.textbuf, rn)?;
},
diff --git a/rt/abort+test.ha b/rt/abort+test.ha
@@ -5,9 +5,11 @@ export @noreturn @symbol("rt.abort") fn _abort(msg: str) void = {
// See harec:include/gen.h
const reasons: [_]str = [
- "slice or array access out of bounds", // 0
- "type assertion failed", // 1
- "out of memory", // 2
+ "slice or array access out of bounds", // 0
+ "type assertion failed", // 1
+ "out of memory", // 2
+ "static insert/append exceeds slice capacity", // 3
+ "execution reached unreachable code (compiler bug)", // 4
];
export @noreturn fn abort_fixed(loc: str, i: int) void = {
diff --git a/rt/abort.ha b/rt/abort.ha
@@ -4,10 +4,11 @@ export @noreturn @symbol("rt.abort") fn _abort(msg: str) void = {
// See harec:include/gen.h
const reasons: [_]str = [
- "slice or array access out of bounds", // 0
- "type assertion failed", // 1
- "out of memory", // 2
- "static insert/append exceeds slice capacity", // 3
+ "slice or array access out of bounds", // 0
+ "type assertion failed", // 1
+ "out of memory", // 2
+ "static insert/append exceeds slice capacity", // 3
+ "execution reached unreachable code (compiler bug)", // 4
];
export @noreturn fn abort_fixed(loc: str, i: int) void = {