Add -foreign-error-procedures

This commit is contained in:
gingerBill
2022-02-20 14:27:44 +00:00
parent 1bec9e5331
commit 0fa487f468
4 changed files with 34 additions and 1 deletions
+19 -1
View File
@@ -17,6 +17,24 @@ type_assertion_trap :: proc "contextless" () -> ! {
}
when ODIN_FOREIGN_ERROR_PROCEDURES {
foreign {
bounds_check_error :: proc "contextless" (file: string, line, column: i32, index, count: int) ---
slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int, len: int) -> ! ---
multi_pointer_slice_handle_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int) -> ! ---
multi_pointer_slice_expr_error :: proc "contextless" (file: string, line, column: i32, lo, hi: int) ---
slice_expr_error_hi :: proc "contextless" (file: string, line, column: i32, hi: int, len: int) ---
slice_expr_error_lo_hi :: proc "contextless" (file: string, line, column: i32, lo, hi: int, len: int) ---
dynamic_array_expr_error :: proc "contextless" (file: string, line, column: i32, low, high, max: int) ---
matrix_bounds_check_error :: proc "contextless" (file: string, line, column: i32, row_index, column_index, row_count, column_count: int) ---
type_assertion_check :: proc "contextless" (ok: bool, file: string, line, column: i32, from, to: typeid) ---
type_assertion_check2 :: proc "contextless" (ok: bool, file: string, line, column: i32, from, to: typeid, from_data: rawptr) ---
make_slice_error_loc :: proc "contextless" (loc := #caller_location, len: int) ---
make_dynamic_array_error_loc :: proc "contextless" (using loc := #caller_location, len, cap: int) ---
make_map_expr_error_loc :: proc "contextless" (loc := #caller_location, cap: int) ---
}
} else {
bounds_check_error :: proc "contextless" (file: string, line, column: i32, index, count: int) {
if 0 <= index && index < count {
return
@@ -231,7 +249,7 @@ make_map_expr_error_loc :: #force_inline proc "contextless" (loc := #caller_loca
handle_error(loc, cap)
}
}