From 2a68c0c2cd4136435036019da94d3bf9cb7d2f11 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sat, 22 May 2021 23:06:28 -0400 Subject: [PATCH] Revert "Add __cxa_throw to utils" This reverts commit 23f4802b8773043bd0bb32cdf2f235d023a38050. --- compiler/builtins/bitcode/src/utils.zig | 9 --------- 1 file changed, 9 deletions(-) diff --git a/compiler/builtins/bitcode/src/utils.zig b/compiler/builtins/bitcode/src/utils.zig index d180dd492e..24bdf36e4e 100644 --- a/compiler/builtins/bitcode/src/utils.zig +++ b/compiler/builtins/bitcode/src/utils.zig @@ -1,10 +1,6 @@ const std = @import("std"); const always_inline = std.builtin.CallOptions.Modifier.always_inline; -// Throwing an exception, from libc++ -// https://github.com/llvm-mirror/libcxxabi/blob/ce3db128f9e4d6d19d1cdbe39bb45fcc64a5adb0/src/cxa_exception.cpp#L230 -extern fn __cxa_throw(thrown_exception: *c_void, type_info: *c_void, dest: *c_void) callconv(.C) void; - // If allocation fails, this must cxa_throw - it must not return a null pointer! extern fn roc_alloc(alignment: usize, size: usize) callconv(.C) *c_void; @@ -17,17 +13,12 @@ extern fn roc_dealloc(alignment: usize, c_ptr: *c_void) callconv(.C) void; comptime { if (std.builtin.is_test) { - @export(testing_cxa_throw, .{ .name = "__cxa_throw", .linkage = .Strong }); @export(testing_roc_alloc, .{ .name = "roc_alloc", .linkage = .Strong }); @export(testing_roc_realloc, .{ .name = "roc_realloc", .linkage = .Strong }); @export(testing_roc_dealloc, .{ .name = "roc_dealloc", .linkage = .Strong }); } } -fn testing_cxa_throw(thrown_exception: *c_void, type_info: *c_void, dest: *c_void) callconv(.C) void { - std.debug.panic("An exception was thrown during this test!"); -} - fn testing_roc_alloc(alignment: usize, size: usize) callconv(.C) *c_void { return @ptrCast(*c_void, std.testing.allocator.alloc(u8, size) catch unreachable); }