mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
commit
ac1b0e832b
@ -9403,7 +9403,7 @@ fn List(comptime T: type) type {
|
||||
Unlike for {#syntax#}@breakpoint(){#endsyntax#}, execution does not continue after this point.
|
||||
</p>
|
||||
<p>
|
||||
This function is only valid within function scope.
|
||||
Outside function scope, this builtin causes a compile error.
|
||||
</p>
|
||||
{#see_also|@breakpoint#}
|
||||
{#header_close#}
|
||||
|
||||
@ -575,22 +575,12 @@ pub fn abort() noreturn {
|
||||
raise(SIG.KILL) catch {};
|
||||
exit(127); // Pid 1 might not be signalled in some containers.
|
||||
}
|
||||
if (builtin.os.tag == .uefi) {
|
||||
exit(0); // TODO choose appropriate exit code
|
||||
switch (builtin.os.tag) {
|
||||
.uefi, .wasi, .cuda => @trap(),
|
||||
else => system.abort(),
|
||||
}
|
||||
if (builtin.os.tag == .wasi) {
|
||||
exit(1);
|
||||
}
|
||||
if (builtin.os.tag == .cuda) {
|
||||
// TODO: introduce `@trap` instead of abusing https://github.com/ziglang/zig/issues/2291
|
||||
@"llvm.trap"();
|
||||
}
|
||||
|
||||
system.abort();
|
||||
}
|
||||
|
||||
extern fn @"llvm.trap"() noreturn;
|
||||
|
||||
pub const RaiseError = UnexpectedError;
|
||||
|
||||
pub fn raise(sig: u8) RaiseError!void {
|
||||
|
||||
@ -193,7 +193,7 @@ typedef char bool;
|
||||
#elif defined(__i386__) || defined(__x86_64__)
|
||||
#define zig_trap() __asm__ volatile("ud2");
|
||||
#else
|
||||
#define zig_trap() raise(SIGILL)
|
||||
#define zig_trap() raise(SIGTRAP)
|
||||
#endif
|
||||
|
||||
#if zig_has_builtin(debugtrap)
|
||||
|
||||
@ -3528,6 +3528,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
|
||||
const digest = hash: {
|
||||
var path_hash: Cache.HashHelper = .{};
|
||||
path_hash.addBytes(build_options.version);
|
||||
path_hash.add(builtin.zig_backend);
|
||||
if (!want_local_cache) {
|
||||
path_hash.addOptionalBytes(file.pkg.root_src_directory.path);
|
||||
}
|
||||
|
||||
@ -8261,6 +8261,7 @@ pub const FuncGen = struct {
|
||||
_ = inst;
|
||||
const llvm_fn = self.getIntrinsic("llvm.trap", &.{});
|
||||
_ = self.builder.buildCall(llvm_fn.globalGetValueType(), llvm_fn, undefined, 0, .Cold, .Auto, "");
|
||||
_ = self.builder.buildUnreachable();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
2759
stage1/zig.h
2759
stage1/zig.h
File diff suppressed because it is too large
Load Diff
BIN
stage1/zig1.wasm
BIN
stage1/zig1.wasm
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user