aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 82fc3bc7b..88f1574e8 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -809,6 +809,9 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
}
if (unhandled.count > 0) {
+ begin_error_block();
+ defer (begin_error_block());
+
if (unhandled.count == 1) {
error_no_newline(node, "Unhandled switch case: ");
} else {
@@ -817,11 +820,11 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
for_array(i, unhandled) {
Entity *f = unhandled[i];
if (i > 0) {
- gb_printf_err(", ");
+ error_line(", ");
}
- gb_printf_err("%.*s", LIT(f->token.string));
+ error_line("%.*s", LIT(f->token.string));
}
- gb_printf_err("\n");
+ error_line("\n");
}
}
}
@@ -1040,13 +1043,13 @@ void check_type_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
for_array(i, unhandled) {
Type *t = unhandled[i];
if (i > 0) {
- gb_printf_err(", ");
+ error_line(", ");
}
gbString s = type_to_string(t);
- gb_printf_err("%s", s);
+ error_line("%s", s);
gb_string_free(s);
}
- gb_printf_err("\n");
+ error_line("\n");
}
}
}