mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
remove most conditional compilation based on stage1
There are still a few occurrences of "stage1" in the standard library and self-hosted compiler source, however, these instances need a bit more careful inspection to ensure no breakage.
This commit is contained in:
parent
c8aba15c22
commit
50eb7983cd
@ -214,8 +214,8 @@ pub fn Atomic(comptime T: type) type {
|
||||
inline fn bitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 {
|
||||
// x86 supports dedicated bitwise instructions
|
||||
if (comptime builtin.target.cpu.arch.isX86() and @sizeOf(T) >= 2 and @sizeOf(T) <= 8) {
|
||||
// TODO: stage2 currently doesn't like the inline asm this function emits.
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// TODO: this causes std lib test failures when enabled
|
||||
if (false) {
|
||||
return x86BitRmw(self, op, bit, ordering);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ pub const Error = error{
|
||||
NoSpaceLeft,
|
||||
};
|
||||
|
||||
const decoderWithIgnoreProto = std.meta.FnPtr(fn (ignore: []const u8) Base64DecoderWithIgnore);
|
||||
const decoderWithIgnoreProto = *const fn (ignore: []const u8) Base64DecoderWithIgnore;
|
||||
|
||||
/// Base64 codecs
|
||||
pub const Codecs = struct {
|
||||
|
||||
@ -3293,8 +3293,7 @@ pub const LibExeObjStep = struct {
|
||||
while (try it.next()) |entry| {
|
||||
// The compiler can put these files into the same directory, but we don't
|
||||
// want to copy them over.
|
||||
if (mem.eql(u8, entry.name, "stage1.id") or
|
||||
mem.eql(u8, entry.name, "llvm-ar.id") or
|
||||
if (mem.eql(u8, entry.name, "llvm-ar.id") or
|
||||
mem.eql(u8, entry.name, "libs.txt") or
|
||||
mem.eql(u8, entry.name, "builtin.zig") or
|
||||
mem.eql(u8, entry.name, "zld.id") or
|
||||
@ -3607,7 +3606,7 @@ pub const Step = struct {
|
||||
loop_flag: bool,
|
||||
done_flag: bool,
|
||||
|
||||
const MakeFn = std.meta.FnPtr(fn (self: *Step) anyerror!void);
|
||||
const MakeFn = *const fn (self: *Step) anyerror!void;
|
||||
|
||||
pub const Id = enum {
|
||||
top_level,
|
||||
|
||||
@ -62,9 +62,9 @@ fn make(step: *Step) !void {
|
||||
// If, for example, a hard-coded path was used as the location to put WriteFileStep
|
||||
// files, then two WriteFileSteps executing in parallel might clobber each other.
|
||||
|
||||
// TODO port the cache system from stage1 to zig std lib. Until then we use blake2b
|
||||
// directly and construct the path, and no "cache hit" detection happens; the files
|
||||
// are always written.
|
||||
// TODO port the cache system from the compiler to zig std lib. Until then
|
||||
// we use blake2b directly and construct the path, and no "cache hit"
|
||||
// detection happens; the files are always written.
|
||||
var hash = std.crypto.hash.blake2.Blake2b384.init(.{});
|
||||
|
||||
// Random bytes to make WriteFileStep unique. Refresh this with
|
||||
|
||||
@ -698,8 +698,9 @@ pub const CompilerBackend = enum(u64) {
|
||||
/// in which case this value is appropriate. Be cool and make sure your
|
||||
/// code supports `other` Zig compilers!
|
||||
other = 0,
|
||||
/// The original Zig compiler created in 2015 by Andrew Kelley.
|
||||
/// Implemented in C++. Uses LLVM.
|
||||
/// The original Zig compiler created in 2015 by Andrew Kelley. Implemented
|
||||
/// in C++. Used LLVM. Deleted from the ZSF ziglang/zig codebase on
|
||||
/// December 6th, 2022.
|
||||
stage1 = 1,
|
||||
/// The reference implementation self-hosted compiler of Zig, using the
|
||||
/// LLVM backend.
|
||||
@ -738,7 +739,7 @@ pub const CompilerBackend = enum(u64) {
|
||||
/// therefore must be kept in sync with the compiler implementation.
|
||||
pub const TestFn = struct {
|
||||
name: []const u8,
|
||||
func: std.meta.FnPtr(fn () anyerror!void),
|
||||
func: *const fn () anyerror!void,
|
||||
async_frame_size: ?usize,
|
||||
};
|
||||
|
||||
@ -760,8 +761,8 @@ else
|
||||
pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn {
|
||||
@setCold(true);
|
||||
|
||||
// Until self-hosted catches up with stage1 language features, we have a simpler
|
||||
// default panic function:
|
||||
// For backends that cannot handle the language features depended on by the
|
||||
// default panic handler, we have a simpler panic handler:
|
||||
if (builtin.zig_backend == .stage2_c or
|
||||
builtin.zig_backend == .stage2_wasm or
|
||||
builtin.zig_backend == .stage2_arm or
|
||||
|
||||
@ -241,8 +241,12 @@ pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]c.timeval) c_int;
|
||||
pub extern "c" fn utimensat(dirfd: c.fd_t, pathname: [*:0]const u8, times: *[2]c.timespec, flags: u32) c_int;
|
||||
pub extern "c" fn futimens(fd: c.fd_t, times: *const [2]c.timespec) c_int;
|
||||
|
||||
const PThreadStartFn = std.meta.FnPtr(fn (?*anyopaque) callconv(.C) ?*anyopaque);
|
||||
pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const c.pthread_attr_t, start_routine: PThreadStartFn, noalias arg: ?*anyopaque) c.E;
|
||||
pub extern "c" fn pthread_create(
|
||||
noalias newthread: *pthread_t,
|
||||
noalias attr: ?*const c.pthread_attr_t,
|
||||
start_routine: *const fn (?*anyopaque) callconv(.C) ?*anyopaque,
|
||||
noalias arg: ?*anyopaque,
|
||||
) c.E;
|
||||
pub extern "c" fn pthread_attr_init(attr: *c.pthread_attr_t) c.E;
|
||||
pub extern "c" fn pthread_attr_setstack(attr: *c.pthread_attr_t, stackaddr: *anyopaque, stacksize: usize) c.E;
|
||||
pub extern "c" fn pthread_attr_setstacksize(attr: *c.pthread_attr_t, stacksize: usize) c.E;
|
||||
@ -251,14 +255,15 @@ pub extern "c" fn pthread_attr_destroy(attr: *c.pthread_attr_t) c.E;
|
||||
pub extern "c" fn pthread_self() pthread_t;
|
||||
pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*anyopaque) c.E;
|
||||
pub extern "c" fn pthread_detach(thread: pthread_t) c.E;
|
||||
const PThreadForkFn = std.meta.FnPtr(fn () callconv(.C) void);
|
||||
pub extern "c" fn pthread_atfork(
|
||||
prepare: ?PThreadForkFn,
|
||||
parent: ?PThreadForkFn,
|
||||
child: ?PThreadForkFn,
|
||||
prepare: ?*const fn () callconv(.C) void,
|
||||
parent: ?*const fn () callconv(.C) void,
|
||||
child: ?*const fn () callconv(.C) void,
|
||||
) c_int;
|
||||
const PThreadKeyCreateFn = std.meta.FnPtr(fn (value: *anyopaque) callconv(.C) void);
|
||||
pub extern "c" fn pthread_key_create(key: *c.pthread_key_t, destructor: ?PThreadKeyCreateFn) c.E;
|
||||
pub extern "c" fn pthread_key_create(
|
||||
key: *c.pthread_key_t,
|
||||
destructor: ?*const fn (value: *anyopaque) callconv(.C) void,
|
||||
) c.E;
|
||||
pub extern "c" fn pthread_key_delete(key: c.pthread_key_t) c.E;
|
||||
pub extern "c" fn pthread_getspecific(key: c.pthread_key_t) ?*anyopaque;
|
||||
pub extern "c" fn pthread_setspecific(key: c.pthread_key_t, value: ?*anyopaque) c_int;
|
||||
|
||||
@ -918,8 +918,8 @@ pub const siginfo_t = extern struct {
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
|
||||
pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
|
||||
|
||||
handler: extern union {
|
||||
handler: ?handler_fn,
|
||||
|
||||
@ -13,7 +13,7 @@ pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
|
||||
pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
|
||||
pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;
|
||||
|
||||
pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);
|
||||
pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
|
||||
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
|
||||
|
||||
pub extern "c" fn lwp_gettid() c_int;
|
||||
@ -681,8 +681,8 @@ pub const empty_sigset = sigset_t{ .__bits = [_]c_uint{0} ** _SIG_WORDS };
|
||||
pub const sig_atomic_t = c_int;
|
||||
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
|
||||
pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
|
||||
|
||||
/// signal handler
|
||||
handler: extern union {
|
||||
|
||||
@ -37,7 +37,7 @@ pub extern "c" fn sendfile(
|
||||
flags: u32,
|
||||
) c_int;
|
||||
|
||||
pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);
|
||||
pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
|
||||
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
|
||||
|
||||
pub const pthread_mutex_t = extern struct {
|
||||
@ -1197,8 +1197,8 @@ const NSIG = 32;
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
|
||||
pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
|
||||
|
||||
/// signal handler
|
||||
handler: extern union {
|
||||
|
||||
@ -742,7 +742,7 @@ const NSIG = 32;
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (i32) align(1) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (i32) align(1) callconv(.C) void;
|
||||
|
||||
/// signal handler
|
||||
__sigaction_u: extern union {
|
||||
|
||||
@ -263,7 +263,7 @@ pub extern "c" fn inotify_rm_watch(fd: fd_t, wd: c_int) c_int;
|
||||
/// See std.elf for constants for this
|
||||
pub extern "c" fn getauxval(__type: c_ulong) c_ulong;
|
||||
|
||||
pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);
|
||||
pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
|
||||
|
||||
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ const rusage = std.c.rusage;
|
||||
extern "c" fn __errno() *c_int;
|
||||
pub const _errno = __errno;
|
||||
|
||||
pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);
|
||||
pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
|
||||
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
|
||||
|
||||
pub extern "c" fn _lwp_self() lwpid_t;
|
||||
@ -971,8 +971,8 @@ pub const SIG = struct {
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
|
||||
pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
|
||||
|
||||
/// signal handler
|
||||
handler: extern union {
|
||||
|
||||
@ -7,7 +7,7 @@ const iovec_const = std.os.iovec_const;
|
||||
extern "c" fn __errno() *c_int;
|
||||
pub const _errno = __errno;
|
||||
|
||||
pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);
|
||||
pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
|
||||
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
|
||||
|
||||
pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
|
||||
@ -1026,8 +1026,8 @@ pub const SIG = struct {
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
|
||||
pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
|
||||
|
||||
/// signal handler
|
||||
handler: extern union {
|
||||
|
||||
@ -8,7 +8,7 @@ const timezone = std.c.timezone;
|
||||
extern "c" fn ___errno() *c_int;
|
||||
pub const _errno = ___errno;
|
||||
|
||||
pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);
|
||||
pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
|
||||
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
|
||||
|
||||
pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
|
||||
@ -952,8 +952,8 @@ pub const SIG = struct {
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
|
||||
pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
|
||||
|
||||
/// signal options
|
||||
flags: c_uint,
|
||||
|
||||
@ -254,7 +254,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
|
||||
|
||||
// Inner writer wrapped in a HuffmanBitWriter
|
||||
hm_bw: hm_bw.HuffmanBitWriter(WriterType) = undefined,
|
||||
bulk_hasher: std.meta.FnPtr(fn ([]u8, []u32) u32),
|
||||
bulk_hasher: *const fn ([]u8, []u32) u32,
|
||||
|
||||
sync: bool, // requesting flush
|
||||
best_speed_enc: *fast.DeflateFast, // Encoder for best_speed
|
||||
|
||||
@ -133,7 +133,8 @@ fn testToFromWithLevelAndLimit(level: deflate.Compression, input: []const u8, li
|
||||
try expect(read == input.len);
|
||||
try expect(mem.eql(u8, input, decompressed));
|
||||
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
if (false) {
|
||||
// TODO: this test has regressed
|
||||
try testSync(level, input);
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +334,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
|
||||
|
||||
// Next step in the decompression,
|
||||
// and decompression state.
|
||||
step: std.meta.FnPtr(fn (*Self) Error!void),
|
||||
step: *const fn (*Self) Error!void,
|
||||
step_state: DecompressorState,
|
||||
final: bool,
|
||||
err: ?Error,
|
||||
@ -479,12 +479,6 @@ pub fn Decompressor(comptime ReaderType: type) type {
|
||||
}
|
||||
|
||||
pub fn close(self: *Self) ?Error {
|
||||
if (@import("builtin").zig_backend == .stage1) {
|
||||
if (self.err == Error.EndOfStreamWithNoError) {
|
||||
return null;
|
||||
}
|
||||
return self.err;
|
||||
}
|
||||
if (self.err == @as(?Error, error.EndOfStreamWithNoError)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -638,7 +638,7 @@ fn parseFormValue(allocator: mem.Allocator, in_stream: anytype, form_id: u64, en
|
||||
FORM.line_strp => FormValue{ .LineStrPtr = try readAddress(in_stream, endian, is_64) },
|
||||
FORM.indirect => {
|
||||
const child_form_id = try nosuspend leb.readULEB128(u64, in_stream);
|
||||
if (builtin.zig_backend != .stage1) {
|
||||
if (true) {
|
||||
return parseFormValue(allocator, in_stream, child_form_id, endian, is_64);
|
||||
}
|
||||
const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64));
|
||||
|
||||
@ -109,7 +109,7 @@ pub fn Batch(
|
||||
}
|
||||
|
||||
test "std.event.Batch" {
|
||||
if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
|
||||
if (true) return error.SkipZigTest;
|
||||
var count: usize = 0;
|
||||
var batch = Batch(void, 2, .auto_async).init();
|
||||
batch.add(&async sleepALittle(&count));
|
||||
|
||||
@ -2209,7 +2209,7 @@ test "pointer" {
|
||||
try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value});
|
||||
try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value});
|
||||
}
|
||||
const FnPtr = if (builtin.zig_backend == .stage1) fn () void else *align(1) const fn () void;
|
||||
const FnPtr = *align(1) const fn () void;
|
||||
{
|
||||
const value = @intToPtr(FnPtr, 0xdeadbeef);
|
||||
try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
|
||||
@ -2266,10 +2266,6 @@ test "struct" {
|
||||
}
|
||||
|
||||
test "enum" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 starts the typename with 'std' which might also be desireable for stage2
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const Enum = enum {
|
||||
One,
|
||||
Two,
|
||||
@ -2285,10 +2281,6 @@ test "enum" {
|
||||
}
|
||||
|
||||
test "non-exhaustive enum" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 fails to return fully qualified namespaces.
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const Enum = enum(u16) {
|
||||
One = 0x000f,
|
||||
Two = 0xbeef,
|
||||
@ -2462,10 +2454,6 @@ test "custom" {
|
||||
}
|
||||
|
||||
test "struct" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 fails to return fully qualified namespaces.
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const S = struct {
|
||||
a: u32,
|
||||
b: anyerror,
|
||||
@ -2484,10 +2472,6 @@ test "struct" {
|
||||
}
|
||||
|
||||
test "union" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 fails to return fully qualified namespaces.
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const TU = union(enum) {
|
||||
float: f32,
|
||||
int: u32,
|
||||
@ -2518,10 +2502,6 @@ test "union" {
|
||||
}
|
||||
|
||||
test "enum" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 fails to return fully qualified namespaces.
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const E = enum {
|
||||
One,
|
||||
Two,
|
||||
@ -2534,10 +2514,6 @@ test "enum" {
|
||||
}
|
||||
|
||||
test "struct.self-referential" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 fails to return fully qualified namespaces.
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const S = struct {
|
||||
const SelfType = @This();
|
||||
a: ?*SelfType,
|
||||
@ -2552,10 +2528,6 @@ test "struct.self-referential" {
|
||||
}
|
||||
|
||||
test "struct.zero-size" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 fails to return fully qualified namespaces.
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const A = struct {
|
||||
fn foo() void {}
|
||||
};
|
||||
@ -2633,10 +2605,6 @@ test "formatFloatValue with comptime_float" {
|
||||
}
|
||||
|
||||
test "formatType max_depth" {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// stage1 fails to return fully qualified namespaces.
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
const Vec2 = struct {
|
||||
const SelfType = @This();
|
||||
x: f32,
|
||||
@ -2724,12 +2692,6 @@ test "vector" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// Regressed in LLVM 14:
|
||||
// https://github.com/llvm/llvm-project/issues/55522
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false };
|
||||
const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };
|
||||
const vu64: @Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 };
|
||||
|
||||
@ -70,9 +70,7 @@ test "fmt.parseFloat" {
|
||||
}
|
||||
|
||||
test "fmt.parseFloat nan and inf" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .aarch64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/12027
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
@ -2373,10 +2373,7 @@ pub fn stringifyAlloc(allocator: std.mem.Allocator, value: anytype, options: Str
|
||||
}
|
||||
|
||||
test {
|
||||
if (builtin.zig_backend != .stage1) {
|
||||
// https://github.com/ziglang/zig/issues/8442
|
||||
_ = @import("json/test.zig");
|
||||
}
|
||||
_ = @import("json/test.zig");
|
||||
_ = @import("json/write_stream.zig");
|
||||
}
|
||||
|
||||
|
||||
@ -347,9 +347,7 @@ fn test_write_leb128(value: anytype) !void {
|
||||
}
|
||||
|
||||
test "serialize unsigned LEB128" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .riscv64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) {
|
||||
// https://github.com/ziglang/zig/issues/12031
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
@ -368,9 +366,7 @@ test "serialize unsigned LEB128" {
|
||||
}
|
||||
|
||||
test "serialize signed LEB128" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .riscv64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) {
|
||||
// https://github.com/ziglang/zig/issues/12031
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
@ -528,9 +528,7 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {
|
||||
}
|
||||
|
||||
test "shl" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .aarch64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/12012
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
@ -574,9 +572,7 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {
|
||||
}
|
||||
|
||||
test "shr" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .aarch64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/12012
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
@ -621,9 +617,7 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T {
|
||||
}
|
||||
|
||||
test "rotr" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .aarch64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/12012
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
@ -667,9 +661,7 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T {
|
||||
}
|
||||
|
||||
test "rotl" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .aarch64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/12012
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
@ -1695,7 +1687,7 @@ fn testSign() !void {
|
||||
}
|
||||
|
||||
test "sign" {
|
||||
if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
|
||||
if (builtin.zig_backend == .stage2_llvm) {
|
||||
// https://github.com/ziglang/zig/issues/12012
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ pub fn zeroes(comptime T: type) T {
|
||||
}
|
||||
|
||||
test "zeroes" {
|
||||
if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
|
||||
if (builtin.zig_backend == .stage2_llvm) {
|
||||
// Regressed in LLVM 14:
|
||||
// https://github.com/llvm/llvm-project/issues/55522
|
||||
return error.SkipZigTest;
|
||||
@ -3187,8 +3187,6 @@ pub fn asBytes(ptr: anytype) AsBytesReturnType(@TypeOf(ptr)) {
|
||||
}
|
||||
|
||||
test "asBytes" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
const deadbeef = @as(u32, 0xDEADBEEF);
|
||||
const deadbeef_bytes = switch (native_endian) {
|
||||
.Big => "\xDE\xAD\xBE\xEF",
|
||||
@ -3282,8 +3280,6 @@ pub fn bytesAsValue(comptime T: type, bytes: anytype) BytesAsValueReturnType(T,
|
||||
}
|
||||
|
||||
test "bytesAsValue" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
const deadbeef = @as(u32, 0xDEADBEEF);
|
||||
const deadbeef_bytes = switch (native_endian) {
|
||||
.Big => "\xDE\xAD\xBE\xEF",
|
||||
@ -3485,8 +3481,6 @@ test "sliceAsBytes with sentinel slice" {
|
||||
}
|
||||
|
||||
test "sliceAsBytes packed struct at runtime and comptime" {
|
||||
if (builtin.zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
const Foo = packed struct {
|
||||
a: u4,
|
||||
b: u4,
|
||||
|
||||
@ -20,7 +20,7 @@ pub const VTable = struct {
|
||||
/// `ret_addr` is optionally provided as the first return address of the
|
||||
/// allocation call stack. If the value is `0` it means no return address
|
||||
/// has been provided.
|
||||
alloc: std.meta.FnPtr(fn (ctx: *anyopaque, len: usize, ptr_align: u8, ret_addr: usize) ?[*]u8),
|
||||
alloc: *const fn (ctx: *anyopaque, len: usize, ptr_align: u8, ret_addr: usize) ?[*]u8,
|
||||
|
||||
/// Attempt to expand or shrink memory in place. `buf.len` must equal the
|
||||
/// length requested from the most recent successful call to `alloc` or
|
||||
@ -37,7 +37,7 @@ pub const VTable = struct {
|
||||
/// `ret_addr` is optionally provided as the first return address of the
|
||||
/// allocation call stack. If the value is `0` it means no return address
|
||||
/// has been provided.
|
||||
resize: std.meta.FnPtr(fn (ctx: *anyopaque, buf: []u8, buf_align: u8, new_len: usize, ret_addr: usize) bool),
|
||||
resize: *const fn (ctx: *anyopaque, buf: []u8, buf_align: u8, new_len: usize, ret_addr: usize) bool,
|
||||
|
||||
/// Free and invalidate a buffer.
|
||||
///
|
||||
@ -50,7 +50,7 @@ pub const VTable = struct {
|
||||
/// `ret_addr` is optionally provided as the first return address of the
|
||||
/// allocation call stack. If the value is `0` it means no return address
|
||||
/// has been provided.
|
||||
free: std.meta.FnPtr(fn (ctx: *anyopaque, buf: []u8, buf_align: u8, ret_addr: usize) void),
|
||||
free: *const fn (ctx: *anyopaque, buf: []u8, buf_align: u8, ret_addr: usize) void,
|
||||
};
|
||||
|
||||
pub fn noResize(
|
||||
|
||||
@ -361,11 +361,7 @@ pub fn assumeSentinel(p: anytype, comptime sentinel_val: Elem(@TypeOf(p))) Senti
|
||||
const ReturnType = Sentinel(T, sentinel_val);
|
||||
switch (@typeInfo(T)) {
|
||||
.Pointer => |info| switch (info.size) {
|
||||
.Slice => if (@import("builtin").zig_backend == .stage1)
|
||||
return @bitCast(ReturnType, p)
|
||||
else
|
||||
return @ptrCast(ReturnType, p),
|
||||
.Many, .One => return @ptrCast(ReturnType, p),
|
||||
.Slice, .Many, .One => return @ptrCast(ReturnType, p),
|
||||
.C => {},
|
||||
},
|
||||
.Optional => |info| switch (@typeInfo(info.child)) {
|
||||
@ -658,8 +654,6 @@ pub fn FieldEnum(comptime T: type) type {
|
||||
const field_infos = fields(T);
|
||||
|
||||
if (field_infos.len == 0) {
|
||||
// TODO simplify when stage1 is removed
|
||||
if (@import("builtin").zig_backend == .stage1) @compileError("stage1 doesn't allow empty enums");
|
||||
return @Type(.{
|
||||
.Enum = .{
|
||||
.layout = .Auto,
|
||||
@ -742,9 +736,7 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
|
||||
}
|
||||
|
||||
test "std.meta.FieldEnum" {
|
||||
if (comptime @import("builtin").zig_backend != .stage1) {
|
||||
try expectEqualEnum(enum {}, FieldEnum(struct {}));
|
||||
}
|
||||
try expectEqualEnum(enum {}, FieldEnum(struct {}));
|
||||
try expectEqualEnum(enum { a }, FieldEnum(struct { a: u8 }));
|
||||
try expectEqualEnum(enum { a, b, c }, FieldEnum(struct { a: u8, b: void, c: f32 }));
|
||||
try expectEqualEnum(enum { a, b, c }, FieldEnum(union { a: u8, b: void, c: f32 }));
|
||||
@ -1239,27 +1231,3 @@ test "isError" {
|
||||
try std.testing.expect(isError(math.absInt(@as(i8, -128))));
|
||||
try std.testing.expect(!isError(math.absInt(@as(i8, -127))));
|
||||
}
|
||||
|
||||
/// This function returns a function pointer for a given function signature.
|
||||
/// It's a helper to make code compatible to both stage1 and stage2.
|
||||
///
|
||||
/// **WARNING:** This function is deprecated and will be removed together with stage1.
|
||||
pub fn FnPtr(comptime Fn: type) type {
|
||||
return if (@import("builtin").zig_backend != .stage1)
|
||||
*const Fn
|
||||
else
|
||||
Fn;
|
||||
}
|
||||
|
||||
test "FnPtr" {
|
||||
var func: FnPtr(fn () i64) = undefined;
|
||||
|
||||
// verify that we can perform runtime exchange
|
||||
// and not have a function body in stage2:
|
||||
|
||||
func = std.time.timestamp;
|
||||
_ = func();
|
||||
|
||||
func = std.time.milliTimestamp;
|
||||
_ = func();
|
||||
}
|
||||
|
||||
@ -90,13 +90,12 @@ pub fn MultiArrayList(comptime S: type) type {
|
||||
};
|
||||
}
|
||||
const Sort = struct {
|
||||
fn lessThan(trash: *i32, lhs: Data, rhs: Data) bool {
|
||||
_ = trash;
|
||||
fn lessThan(context: void, lhs: Data, rhs: Data) bool {
|
||||
_ = context;
|
||||
return lhs.alignment > rhs.alignment;
|
||||
}
|
||||
};
|
||||
var trash: i32 = undefined; // workaround for stage1 compiler bug
|
||||
std.sort.sort(Data, &data, &trash, Sort.lessThan);
|
||||
std.sort.sort(Data, &data, {}, Sort.lessThan);
|
||||
var sizes_bytes: [fields.len]usize = undefined;
|
||||
var field_indexes: [fields.len]usize = undefined;
|
||||
for (data) |elem, i| {
|
||||
|
||||
@ -5360,7 +5360,7 @@ pub fn toPosixPath(file_path: []const u8) ![MAX_PATH_BYTES - 1:0]u8 {
|
||||
/// if this happens the fix is to add the error code to the corresponding
|
||||
/// switch expression, possibly introduce a new error in the error set, and
|
||||
/// send a patch to Zig.
|
||||
pub const unexpected_error_tracing = (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and builtin.mode == .Debug;
|
||||
pub const unexpected_error_tracing = builtin.zig_backend == .stage2_llvm and builtin.mode == .Debug;
|
||||
|
||||
pub const UnexpectedError = error{
|
||||
/// The Operating System returned an undocumented error code.
|
||||
|
||||
@ -936,16 +936,10 @@ pub fn flock(fd: fd_t, operation: i32) usize {
|
||||
return syscall2(.flock, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, operation)));
|
||||
}
|
||||
|
||||
var vdso_clock_gettime = if (builtin.zig_backend == .stage1)
|
||||
@ptrCast(?*const anyopaque, init_vdso_clock_gettime)
|
||||
else
|
||||
@ptrCast(?*const anyopaque, &init_vdso_clock_gettime);
|
||||
var vdso_clock_gettime = @ptrCast(?*const anyopaque, &init_vdso_clock_gettime);
|
||||
|
||||
// We must follow the C calling convention when we call into the VDSO
|
||||
const vdso_clock_gettime_ty = if (builtin.zig_backend == .stage1)
|
||||
fn (i32, *timespec) callconv(.C) usize
|
||||
else
|
||||
*align(1) const fn (i32, *timespec) callconv(.C) usize;
|
||||
const vdso_clock_gettime_ty = *align(1) const fn (i32, *timespec) callconv(.C) usize;
|
||||
|
||||
pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
|
||||
if (@hasDecl(VDSO, "CGT_SYM")) {
|
||||
@ -1151,8 +1145,8 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact
|
||||
const mask_size = @sizeOf(@TypeOf(ksa.mask));
|
||||
|
||||
if (act) |new| {
|
||||
const restore_rt_ptr = if (builtin.zig_backend == .stage1) restore_rt else &restore_rt;
|
||||
const restore_ptr = if (builtin.zig_backend == .stage1) restore else &restore;
|
||||
const restore_rt_ptr = &restore_rt;
|
||||
const restore_ptr = &restore;
|
||||
const restorer_fn = if ((new.flags & SA.SIGINFO) != 0) restore_rt_ptr else restore_ptr;
|
||||
ksa = k_sigaction{
|
||||
.handler = new.handler.handler,
|
||||
@ -3145,8 +3139,8 @@ pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).Array.l
|
||||
pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
|
||||
|
||||
const k_sigaction_funcs = struct {
|
||||
const handler = ?std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
const restorer = std.meta.FnPtr(fn () callconv(.C) void);
|
||||
const handler = ?*const fn (c_int) align(1) callconv(.C) void;
|
||||
const restorer = *const fn () callconv(.C) void;
|
||||
};
|
||||
|
||||
pub const k_sigaction = switch (native_arch) {
|
||||
@ -3172,8 +3166,8 @@ pub const k_sigaction = switch (native_arch) {
|
||||
|
||||
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
|
||||
pub const Sigaction = extern struct {
|
||||
pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
|
||||
pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);
|
||||
pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
|
||||
pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
|
||||
|
||||
handler: extern union {
|
||||
handler: ?handler_fn,
|
||||
@ -3181,7 +3175,7 @@ pub const Sigaction = extern struct {
|
||||
},
|
||||
mask: sigset_t,
|
||||
flags: c_uint,
|
||||
restorer: ?std.meta.FnPtr(fn () callconv(.C) void) = null,
|
||||
restorer: ?*const fn () callconv(.C) void = null,
|
||||
};
|
||||
|
||||
pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len;
|
||||
@ -3314,25 +3308,12 @@ pub const epoll_data = extern union {
|
||||
u64: u64,
|
||||
};
|
||||
|
||||
pub const epoll_event = switch (builtin.zig_backend) {
|
||||
// stage1 crashes with the align(4) field so we have this workaround
|
||||
.stage1 => switch (native_arch) {
|
||||
.x86_64 => packed struct {
|
||||
events: u32,
|
||||
data: epoll_data,
|
||||
},
|
||||
else => extern struct {
|
||||
events: u32,
|
||||
data: epoll_data,
|
||||
},
|
||||
},
|
||||
else => extern struct {
|
||||
events: u32,
|
||||
data: epoll_data align(switch (native_arch) {
|
||||
.x86_64 => 4,
|
||||
else => @alignOf(epoll_data),
|
||||
}),
|
||||
},
|
||||
pub const epoll_event = extern struct {
|
||||
events: u32,
|
||||
data: epoll_data align(switch (native_arch) {
|
||||
.x86_64 => 4,
|
||||
else => @alignOf(epoll_data),
|
||||
}),
|
||||
};
|
||||
|
||||
pub const VFS_CAP_REVISION_MASK = 0xFF000000;
|
||||
|
||||
@ -98,7 +98,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -98,7 +98,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -190,7 +190,7 @@ pub fn syscall7(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -126,7 +126,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -126,7 +126,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -95,7 +95,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
|
||||
@ -178,7 +178,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -118,7 +118,7 @@ pub fn socketcall(call: usize, args: [*]usize) usize {
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -100,7 +100,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
|
||||
const CloneFn = *const fn (arg: usize) callconv(.C) u8;
|
||||
|
||||
/// This matches the libc clone function.
|
||||
pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
|
||||
|
||||
@ -785,10 +785,8 @@ test "sigaction" {
|
||||
}
|
||||
};
|
||||
|
||||
const actual_handler = if (builtin.zig_backend == .stage1) S.handler else &S.handler;
|
||||
|
||||
var sa = os.Sigaction{
|
||||
.handler = .{ .sigaction = actual_handler },
|
||||
.handler = .{ .sigaction = &S.handler },
|
||||
.mask = os.empty_sigset,
|
||||
.flags = os.SA.SIGINFO | os.SA.RESETHAND,
|
||||
};
|
||||
@ -799,7 +797,7 @@ test "sigaction" {
|
||||
|
||||
// Check that we can read it back correctly.
|
||||
try os.sigaction(os.SIG.USR1, null, &old_sa);
|
||||
try testing.expectEqual(actual_handler, old_sa.handler.sigaction.?);
|
||||
try testing.expectEqual(&S.handler, old_sa.handler.sigaction.?);
|
||||
try testing.expect((old_sa.flags & os.SA.SIGINFO) != 0);
|
||||
|
||||
// Invoke the handler.
|
||||
|
||||
@ -6,8 +6,8 @@ const Status = uefi.Status;
|
||||
|
||||
/// Protocol for touchscreens
|
||||
pub const AbsolutePointerProtocol = extern struct {
|
||||
_reset: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status),
|
||||
_get_state: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status),
|
||||
_reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status,
|
||||
_get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status,
|
||||
wait_for_input: Event,
|
||||
mode: *AbsolutePointerMode,
|
||||
|
||||
|
||||
@ -44,10 +44,10 @@ pub const BlockIoProtocol = extern struct {
|
||||
revision: u64,
|
||||
media: *EfiBlockMedia,
|
||||
|
||||
_reset: std.meta.FnPtr(fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status),
|
||||
_read_blocks: std.meta.FnPtr(fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status),
|
||||
_write_blocks: std.meta.FnPtr(fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status),
|
||||
_flush_blocks: std.meta.FnPtr(fn (*BlockIoProtocol) callconv(.C) Status),
|
||||
_reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status,
|
||||
_read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status,
|
||||
_write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status,
|
||||
_flush_blocks: *const fn (*BlockIoProtocol) callconv(.C) Status,
|
||||
|
||||
/// Resets the block device hardware.
|
||||
pub fn reset(self: *Self, extended_verification: bool) Status {
|
||||
|
||||
@ -6,7 +6,7 @@ const Status = uefi.Status;
|
||||
|
||||
/// Override EDID information
|
||||
pub const EdidOverrideProtocol = extern struct {
|
||||
_get_edid: std.meta.FnPtr(fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(.C) Status),
|
||||
_get_edid: *const fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(.C) Status,
|
||||
|
||||
/// Returns policy information and potentially a replacement EDID for the specified video output device.
|
||||
pub fn getEdid(
|
||||
|
||||
@ -7,16 +7,16 @@ const Status = uefi.Status;
|
||||
|
||||
pub const FileProtocol = extern struct {
|
||||
revision: u64,
|
||||
_open: std.meta.FnPtr(fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status),
|
||||
_close: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),
|
||||
_delete: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),
|
||||
_read: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status),
|
||||
_write: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status),
|
||||
_get_position: std.meta.FnPtr(fn (*const FileProtocol, *u64) callconv(.C) Status),
|
||||
_set_position: std.meta.FnPtr(fn (*const FileProtocol, u64) callconv(.C) Status),
|
||||
_get_info: std.meta.FnPtr(fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status),
|
||||
_set_info: std.meta.FnPtr(fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status),
|
||||
_flush: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),
|
||||
_open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status,
|
||||
_close: *const fn (*const FileProtocol) callconv(.C) Status,
|
||||
_delete: *const fn (*const FileProtocol) callconv(.C) Status,
|
||||
_read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status,
|
||||
_write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status,
|
||||
_get_position: *const fn (*const FileProtocol, *u64) callconv(.C) Status,
|
||||
_set_position: *const fn (*const FileProtocol, u64) callconv(.C) Status,
|
||||
_get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status,
|
||||
_set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status,
|
||||
_flush: *const fn (*const FileProtocol) callconv(.C) Status,
|
||||
|
||||
pub const SeekError = error{SeekError};
|
||||
pub const GetSeekPosError = error{GetSeekPosError};
|
||||
|
||||
@ -5,9 +5,9 @@ const Status = uefi.Status;
|
||||
|
||||
/// Graphics output
|
||||
pub const GraphicsOutputProtocol = extern struct {
|
||||
_query_mode: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status),
|
||||
_set_mode: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status),
|
||||
_blt: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status),
|
||||
_query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status,
|
||||
_set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status,
|
||||
_blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status,
|
||||
mode: *GraphicsOutputProtocolMode,
|
||||
|
||||
/// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports.
|
||||
|
||||
@ -7,10 +7,10 @@ const hii = uefi.protocols.hii;
|
||||
/// Database manager for HII-related data structures.
|
||||
pub const HIIDatabaseProtocol = extern struct {
|
||||
_new_package_list: Status, // TODO
|
||||
_remove_package_list: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status),
|
||||
_update_package_list: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status),
|
||||
_list_package_lists: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status),
|
||||
_export_package_lists: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status),
|
||||
_remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status,
|
||||
_update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status,
|
||||
_list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status,
|
||||
_export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status,
|
||||
_register_package_notify: Status, // TODO
|
||||
_unregister_package_notify: Status, // TODO
|
||||
_find_keyboard_layouts: Status, // TODO
|
||||
|
||||
@ -7,7 +7,7 @@ const hii = uefi.protocols.hii;
|
||||
/// Display a popup window
|
||||
pub const HIIPopupProtocol = extern struct {
|
||||
revision: u64,
|
||||
_create_popup: std.meta.FnPtr(fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status),
|
||||
_create_popup: *const fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status,
|
||||
|
||||
/// Displays a popup window.
|
||||
pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status {
|
||||
|
||||
@ -5,10 +5,10 @@ const Event = uefi.Event;
|
||||
const Status = uefi.Status;
|
||||
|
||||
pub const Ip6ConfigProtocol = extern struct {
|
||||
_set_data: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status),
|
||||
_get_data: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status),
|
||||
_register_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status),
|
||||
_unregister_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status),
|
||||
_set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status,
|
||||
_get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status,
|
||||
_register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
|
||||
_unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
|
||||
|
||||
pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status {
|
||||
return self._set_data(self, data_type, data_size, data);
|
||||
|
||||
@ -8,15 +8,15 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
|
||||
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
|
||||
|
||||
pub const Ip6Protocol = extern struct {
|
||||
_get_mode_data: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),
|
||||
_configure: std.meta.FnPtr(fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status),
|
||||
_groups: std.meta.FnPtr(fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status),
|
||||
_routes: std.meta.FnPtr(fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status),
|
||||
_neighbors: std.meta.FnPtr(fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status),
|
||||
_transmit: std.meta.FnPtr(fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status),
|
||||
_receive: std.meta.FnPtr(fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status),
|
||||
_cancel: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status),
|
||||
_poll: std.meta.FnPtr(fn (*const Ip6Protocol) callconv(.C) Status),
|
||||
_get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
|
||||
_configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status,
|
||||
_groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
|
||||
_routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status,
|
||||
_neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status,
|
||||
_transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
|
||||
_receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
|
||||
_cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status,
|
||||
_poll: *const fn (*const Ip6Protocol) callconv(.C) Status,
|
||||
|
||||
/// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
|
||||
pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
|
||||
|
||||
@ -5,8 +5,8 @@ const Guid = uefi.Guid;
|
||||
const Status = uefi.Status;
|
||||
|
||||
pub const Ip6ServiceBindingProtocol = extern struct {
|
||||
_create_child: std.meta.FnPtr(fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status),
|
||||
_destroy_child: std.meta.FnPtr(fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status),
|
||||
_create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status,
|
||||
_destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status,
|
||||
|
||||
pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {
|
||||
return self._create_child(self, handle);
|
||||
|
||||
@ -20,7 +20,7 @@ pub const LoadedImageProtocol = extern struct {
|
||||
image_size: u64,
|
||||
image_code_type: MemoryType,
|
||||
image_data_type: MemoryType,
|
||||
_unload: std.meta.FnPtr(fn (*const LoadedImageProtocol, Handle) callconv(.C) Status),
|
||||
_unload: *const fn (*const LoadedImageProtocol, Handle) callconv(.C) Status,
|
||||
|
||||
/// Unloads an image from memory.
|
||||
pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status {
|
||||
|
||||
@ -8,14 +8,14 @@ const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
|
||||
const MacAddress = uefi.protocols.MacAddress;
|
||||
|
||||
pub const ManagedNetworkProtocol = extern struct {
|
||||
_get_mode_data: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),
|
||||
_configure: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status),
|
||||
_mcast_ip_to_mac: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status),
|
||||
_groups: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status),
|
||||
_transmit: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status),
|
||||
_receive: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status),
|
||||
_cancel: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status),
|
||||
_poll: std.meta.FnPtr(fn (*const ManagedNetworkProtocol) callconv(.C) Status),
|
||||
_get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
|
||||
_configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status,
|
||||
_mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
|
||||
_groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
|
||||
_transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
|
||||
_receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
|
||||
_cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status,
|
||||
_poll: *const fn (*const ManagedNetworkProtocol) callconv(.C) Status,
|
||||
|
||||
/// Returns the operational parameters for the current MNP child driver.
|
||||
/// May also support returning the underlying SNP driver mode data.
|
||||
|
||||
@ -5,8 +5,8 @@ const Guid = uefi.Guid;
|
||||
const Status = uefi.Status;
|
||||
|
||||
pub const ManagedNetworkServiceBindingProtocol = extern struct {
|
||||
_create_child: std.meta.FnPtr(fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status),
|
||||
_destroy_child: std.meta.FnPtr(fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status),
|
||||
_create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status,
|
||||
_destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status,
|
||||
|
||||
pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {
|
||||
return self._create_child(self, handle);
|
||||
|
||||
@ -5,8 +5,8 @@ const Status = uefi.Status;
|
||||
|
||||
/// Random Number Generator protocol
|
||||
pub const RNGProtocol = extern struct {
|
||||
_get_info: std.meta.FnPtr(fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status),
|
||||
_get_rng: std.meta.FnPtr(fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status),
|
||||
_get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status,
|
||||
_get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status,
|
||||
|
||||
/// Returns information about the random number generation implementation.
|
||||
pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status {
|
||||
|
||||
@ -6,7 +6,7 @@ const Status = uefi.Status;
|
||||
|
||||
pub const SimpleFileSystemProtocol = extern struct {
|
||||
revision: u64,
|
||||
_open_volume: std.meta.FnPtr(fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status),
|
||||
_open_volume: *const fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status,
|
||||
|
||||
pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {
|
||||
return self._open_volume(self, root);
|
||||
|
||||
@ -6,19 +6,19 @@ const Status = uefi.Status;
|
||||
|
||||
pub const SimpleNetworkProtocol = extern struct {
|
||||
revision: u64,
|
||||
_start: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),
|
||||
_stop: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),
|
||||
_initialize: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status),
|
||||
_reset: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status),
|
||||
_shutdown: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),
|
||||
_receive_filters: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status),
|
||||
_station_address: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status),
|
||||
_statistics: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status),
|
||||
_mcast_ip_to_mac: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status),
|
||||
_nvdata: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status),
|
||||
_get_status: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status),
|
||||
_transmit: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status),
|
||||
_receive: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status),
|
||||
_start: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
|
||||
_stop: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
|
||||
_initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status,
|
||||
_reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status,
|
||||
_shutdown: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
|
||||
_receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status,
|
||||
_station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
|
||||
_statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status,
|
||||
_mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
|
||||
_nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status,
|
||||
_get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status,
|
||||
_transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status,
|
||||
_receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status,
|
||||
wait_for_packet: Event,
|
||||
mode: *SimpleNetworkMode,
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ const Status = uefi.Status;
|
||||
|
||||
/// Protocol for mice
|
||||
pub const SimplePointerProtocol = struct {
|
||||
_reset: std.meta.FnPtr(fn (*const SimplePointerProtocol, bool) callconv(.C) Status),
|
||||
_get_state: std.meta.FnPtr(fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status),
|
||||
_reset: *const fn (*const SimplePointerProtocol, bool) callconv(.C) Status,
|
||||
_get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status,
|
||||
wait_for_input: Event,
|
||||
mode: *SimplePointerMode,
|
||||
|
||||
|
||||
@ -6,12 +6,12 @@ const Status = uefi.Status;
|
||||
|
||||
/// Character input devices, e.g. Keyboard
|
||||
pub const SimpleTextInputExProtocol = extern struct {
|
||||
_reset: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status),
|
||||
_read_key_stroke_ex: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status),
|
||||
_reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status,
|
||||
_read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status,
|
||||
wait_for_key_ex: Event,
|
||||
_set_state: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status),
|
||||
_register_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const KeyData, std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), **anyopaque) callconv(.C) Status),
|
||||
_unregister_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status),
|
||||
_set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status,
|
||||
_register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(.C) usize, **anyopaque) callconv(.C) Status,
|
||||
_unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Resets the input device hardware.
|
||||
pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {
|
||||
@ -29,7 +29,7 @@ pub const SimpleTextInputExProtocol = extern struct {
|
||||
}
|
||||
|
||||
/// Register a notification function for a particular keystroke for the input device.
|
||||
pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), handle: **anyopaque) Status {
|
||||
pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: *const fn (*const KeyData) callconv(.C) usize, handle: **anyopaque) Status {
|
||||
return self._register_key_notify(self, key_data, notify, handle);
|
||||
}
|
||||
|
||||
|
||||
@ -7,8 +7,8 @@ const Status = uefi.Status;
|
||||
|
||||
/// Character input devices, e.g. Keyboard
|
||||
pub const SimpleTextInputProtocol = extern struct {
|
||||
_reset: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status),
|
||||
_read_key_stroke: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status),
|
||||
_reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status,
|
||||
_read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status,
|
||||
wait_for_key: Event,
|
||||
|
||||
/// Resets the input device hardware.
|
||||
|
||||
@ -5,15 +5,15 @@ const Status = uefi.Status;
|
||||
|
||||
/// Character output devices
|
||||
pub const SimpleTextOutputProtocol = extern struct {
|
||||
_reset: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status),
|
||||
_output_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status),
|
||||
_test_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status),
|
||||
_query_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status),
|
||||
_set_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status),
|
||||
_set_attribute: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status),
|
||||
_clear_screen: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol) callconv(.C) Status),
|
||||
_set_cursor_position: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status),
|
||||
_enable_cursor: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status),
|
||||
_reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
|
||||
_output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,
|
||||
_test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,
|
||||
_query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status,
|
||||
_set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
|
||||
_set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
|
||||
_clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(.C) Status,
|
||||
_set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status,
|
||||
_enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
|
||||
mode: *SimpleTextOutputMode,
|
||||
|
||||
/// Resets the text output device hardware.
|
||||
|
||||
@ -10,13 +10,13 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
|
||||
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
|
||||
|
||||
pub const Udp6Protocol = extern struct {
|
||||
_get_mode_data: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),
|
||||
_configure: std.meta.FnPtr(fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status),
|
||||
_groups: std.meta.FnPtr(fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status),
|
||||
_transmit: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status),
|
||||
_receive: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status),
|
||||
_cancel: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status),
|
||||
_poll: std.meta.FnPtr(fn (*const Udp6Protocol) callconv(.C) Status),
|
||||
_get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
|
||||
_configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status,
|
||||
_groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
|
||||
_transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
|
||||
_receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
|
||||
_cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status,
|
||||
_poll: *const fn (*const Udp6Protocol) callconv(.C) Status,
|
||||
|
||||
pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
|
||||
return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data);
|
||||
|
||||
@ -5,8 +5,8 @@ const Guid = uefi.Guid;
|
||||
const Status = uefi.Status;
|
||||
|
||||
pub const Udp6ServiceBindingProtocol = extern struct {
|
||||
_create_child: std.meta.FnPtr(fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status),
|
||||
_destroy_child: std.meta.FnPtr(fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status),
|
||||
_create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status,
|
||||
_destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status,
|
||||
|
||||
pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {
|
||||
return self._create_child(self, handle);
|
||||
|
||||
@ -22,138 +22,138 @@ pub const BootServices = extern struct {
|
||||
hdr: TableHeader,
|
||||
|
||||
/// Raises a task's priority level and returns its previous level.
|
||||
raiseTpl: std.meta.FnPtr(fn (new_tpl: usize) callconv(.C) usize),
|
||||
raiseTpl: *const fn (new_tpl: usize) callconv(.C) usize,
|
||||
|
||||
/// Restores a task's priority level to its previous value.
|
||||
restoreTpl: std.meta.FnPtr(fn (old_tpl: usize) callconv(.C) void),
|
||||
restoreTpl: *const fn (old_tpl: usize) callconv(.C) void,
|
||||
|
||||
/// Allocates memory pages from the system.
|
||||
allocatePages: std.meta.FnPtr(fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(.C) Status),
|
||||
allocatePages: *const fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(.C) Status,
|
||||
|
||||
/// Frees memory pages.
|
||||
freePages: std.meta.FnPtr(fn (memory: [*]align(4096) u8, pages: usize) callconv(.C) Status),
|
||||
freePages: *const fn (memory: [*]align(4096) u8, pages: usize) callconv(.C) Status,
|
||||
|
||||
/// Returns the current memory map.
|
||||
getMemoryMap: std.meta.FnPtr(fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(.C) Status),
|
||||
getMemoryMap: *const fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(.C) Status,
|
||||
|
||||
/// Allocates pool memory.
|
||||
allocatePool: std.meta.FnPtr(fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(.C) Status),
|
||||
allocatePool: *const fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(.C) Status,
|
||||
|
||||
/// Returns pool memory to the system.
|
||||
freePool: std.meta.FnPtr(fn (buffer: [*]align(8) u8) callconv(.C) Status),
|
||||
freePool: *const fn (buffer: [*]align(8) u8) callconv(.C) Status,
|
||||
|
||||
/// Creates an event.
|
||||
createEvent: std.meta.FnPtr(fn (type: u32, notify_tpl: usize, notify_func: ?std.meta.FnPtr(fn (Event, ?*anyopaque) callconv(.C) void), notifyCtx: ?*const anyopaque, event: *Event) callconv(.C) Status),
|
||||
createEvent: *const fn (type: u32, notify_tpl: usize, notify_func: ?*const fn (Event, ?*anyopaque) callconv(.C) void, notifyCtx: ?*const anyopaque, event: *Event) callconv(.C) Status,
|
||||
|
||||
/// Sets the type of timer and the trigger time for a timer event.
|
||||
setTimer: std.meta.FnPtr(fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(.C) Status),
|
||||
setTimer: *const fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(.C) Status,
|
||||
|
||||
/// Stops execution until an event is signaled.
|
||||
waitForEvent: std.meta.FnPtr(fn (event_len: usize, events: [*]const Event, index: *usize) callconv(.C) Status),
|
||||
waitForEvent: *const fn (event_len: usize, events: [*]const Event, index: *usize) callconv(.C) Status,
|
||||
|
||||
/// Signals an event.
|
||||
signalEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),
|
||||
signalEvent: *const fn (event: Event) callconv(.C) Status,
|
||||
|
||||
/// Closes an event.
|
||||
closeEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),
|
||||
closeEvent: *const fn (event: Event) callconv(.C) Status,
|
||||
|
||||
/// Checks whether an event is in the signaled state.
|
||||
checkEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),
|
||||
checkEvent: *const fn (event: Event) callconv(.C) Status,
|
||||
|
||||
/// Installs a protocol interface on a device handle. If the handle does not exist, it is created
|
||||
/// and added to the list of handles in the system. installMultipleProtocolInterfaces()
|
||||
/// performs more error checking than installProtocolInterface(), so its use is recommended over this.
|
||||
installProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(.C) Status),
|
||||
installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Reinstalls a protocol interface on a device handle
|
||||
reinstallProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(.C) Status),
|
||||
reinstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Removes a protocol interface from a device handle. Usage of
|
||||
/// uninstallMultipleProtocolInterfaces is recommended over this.
|
||||
uninstallProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(.C) Status),
|
||||
uninstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Queries a handle to determine if it supports a specified protocol.
|
||||
handleProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(.C) Status),
|
||||
handleProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(.C) Status,
|
||||
|
||||
reserved: *anyopaque,
|
||||
|
||||
/// Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
|
||||
registerProtocolNotify: std.meta.FnPtr(fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(.C) Status),
|
||||
registerProtocolNotify: *const fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Returns an array of handles that support a specified protocol.
|
||||
locateHandle: std.meta.FnPtr(fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(.C) Status),
|
||||
locateHandle: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(.C) Status,
|
||||
|
||||
/// Locates the handle to a device on the device path that supports the specified protocol
|
||||
locateDevicePath: std.meta.FnPtr(fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(.C) Status),
|
||||
locateDevicePath: *const fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(.C) Status,
|
||||
|
||||
/// Adds, updates, or removes a configuration table entry from the EFI System Table.
|
||||
installConfigurationTable: std.meta.FnPtr(fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(.C) Status),
|
||||
installConfigurationTable: *const fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Loads an EFI image into memory.
|
||||
loadImage: std.meta.FnPtr(fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, imageHandle: *?Handle) callconv(.C) Status),
|
||||
loadImage: *const fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, imageHandle: *?Handle) callconv(.C) Status,
|
||||
|
||||
/// Transfers control to a loaded image's entry point.
|
||||
startImage: std.meta.FnPtr(fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(.C) Status),
|
||||
startImage: *const fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(.C) Status,
|
||||
|
||||
/// Terminates a loaded EFI image and returns control to boot services.
|
||||
exit: std.meta.FnPtr(fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(.C) Status),
|
||||
exit: *const fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Unloads an image.
|
||||
unloadImage: std.meta.FnPtr(fn (image_handle: Handle) callconv(.C) Status),
|
||||
unloadImage: *const fn (image_handle: Handle) callconv(.C) Status,
|
||||
|
||||
/// Terminates all boot services.
|
||||
exitBootServices: std.meta.FnPtr(fn (image_handle: Handle, map_key: usize) callconv(.C) Status),
|
||||
exitBootServices: *const fn (image_handle: Handle, map_key: usize) callconv(.C) Status,
|
||||
|
||||
/// Returns a monotonically increasing count for the platform.
|
||||
getNextMonotonicCount: std.meta.FnPtr(fn (count: *u64) callconv(.C) Status),
|
||||
getNextMonotonicCount: *const fn (count: *u64) callconv(.C) Status,
|
||||
|
||||
/// Induces a fine-grained stall.
|
||||
stall: std.meta.FnPtr(fn (microseconds: usize) callconv(.C) Status),
|
||||
stall: *const fn (microseconds: usize) callconv(.C) Status,
|
||||
|
||||
/// Sets the system's watchdog timer.
|
||||
setWatchdogTimer: std.meta.FnPtr(fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(.C) Status),
|
||||
setWatchdogTimer: *const fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(.C) Status,
|
||||
|
||||
/// Connects one or more drives to a controller.
|
||||
connectController: std.meta.FnPtr(fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(.C) Status),
|
||||
connectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(.C) Status,
|
||||
|
||||
// Disconnects one or more drivers from a controller
|
||||
disconnectController: std.meta.FnPtr(fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(.C) Status),
|
||||
disconnectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(.C) Status,
|
||||
|
||||
/// Queries a handle to determine if it supports a specified protocol.
|
||||
openProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(.C) Status),
|
||||
openProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(.C) Status,
|
||||
|
||||
/// Closes a protocol on a handle that was opened using openProtocol().
|
||||
closeProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(.C) Status),
|
||||
closeProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(.C) Status,
|
||||
|
||||
/// Retrieves the list of agents that currently have a protocol interface opened.
|
||||
openProtocolInformation: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(.C) Status),
|
||||
openProtocolInformation: *const fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(.C) Status,
|
||||
|
||||
/// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.
|
||||
protocolsPerHandle: std.meta.FnPtr(fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(.C) Status),
|
||||
protocolsPerHandle: *const fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(.C) Status,
|
||||
|
||||
/// Returns an array of handles that support the requested protocol in a buffer allocated from pool.
|
||||
locateHandleBuffer: std.meta.FnPtr(fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, num_handles: *usize, buffer: *[*]Handle) callconv(.C) Status),
|
||||
locateHandleBuffer: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, num_handles: *usize, buffer: *[*]Handle) callconv(.C) Status,
|
||||
|
||||
/// Returns the first protocol instance that matches the given protocol.
|
||||
locateProtocol: std.meta.FnPtr(fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(.C) Status),
|
||||
locateProtocol: *const fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Installs one or more protocol interfaces into the boot services environment
|
||||
installMultipleProtocolInterfaces: std.meta.FnPtr(fn (handle: *Handle, ...) callconv(.C) Status),
|
||||
installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
|
||||
|
||||
/// Removes one or more protocol interfaces into the boot services environment
|
||||
uninstallMultipleProtocolInterfaces: std.meta.FnPtr(fn (handle: *Handle, ...) callconv(.C) Status),
|
||||
uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
|
||||
|
||||
/// Computes and returns a 32-bit CRC for a data buffer.
|
||||
calculateCrc32: std.meta.FnPtr(fn (data: [*]const u8, data_size: usize, *u32) callconv(.C) Status),
|
||||
calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(.C) Status,
|
||||
|
||||
/// Copies the contents of one buffer to another buffer
|
||||
copyMem: std.meta.FnPtr(fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(.C) void),
|
||||
copyMem: *const fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(.C) void,
|
||||
|
||||
/// Fills a buffer with a specified value
|
||||
setMem: std.meta.FnPtr(fn (buffer: [*]u8, size: usize, value: u8) callconv(.C) void),
|
||||
setMem: *const fn (buffer: [*]u8, size: usize, value: u8) callconv(.C) void,
|
||||
|
||||
/// Creates an event in a group.
|
||||
createEventEx: std.meta.FnPtr(fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(.C) Status),
|
||||
createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(.C) Status,
|
||||
|
||||
/// Opens a protocol with a structure as the loaded image for a UEFI application
|
||||
pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {
|
||||
@ -191,7 +191,7 @@ pub const BootServices = extern struct {
|
||||
pub const tpl_high_level: usize = 31;
|
||||
};
|
||||
|
||||
pub const EfiEventNotify = std.meta.FnPtr(fn (event: Event, ctx: *anyopaque) callconv(.C) void);
|
||||
pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(.C) void;
|
||||
|
||||
pub const TimerDelay = enum(u32) {
|
||||
TimerCancel,
|
||||
|
||||
@ -19,50 +19,50 @@ pub const RuntimeServices = extern struct {
|
||||
hdr: TableHeader,
|
||||
|
||||
/// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.
|
||||
getTime: std.meta.FnPtr(fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status),
|
||||
getTime: *const fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status,
|
||||
|
||||
/// Sets the current local time and date information
|
||||
setTime: std.meta.FnPtr(fn (time: *uefi.Time) callconv(.C) Status),
|
||||
setTime: *const fn (time: *uefi.Time) callconv(.C) Status,
|
||||
|
||||
/// Returns the current wakeup alarm clock setting
|
||||
getWakeupTime: std.meta.FnPtr(fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status),
|
||||
getWakeupTime: *const fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status,
|
||||
|
||||
/// Sets the system wakeup alarm clock time
|
||||
setWakeupTime: std.meta.FnPtr(fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status),
|
||||
setWakeupTime: *const fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status,
|
||||
|
||||
/// Changes the runtime addressing mode of EFI firmware from physical to virtual.
|
||||
setVirtualAddressMap: std.meta.FnPtr(fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status),
|
||||
setVirtualAddressMap: *const fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status,
|
||||
|
||||
/// Determines the new virtual address that is to be used on subsequent memory accesses.
|
||||
convertPointer: std.meta.FnPtr(fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status),
|
||||
convertPointer: *const fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Returns the value of a variable.
|
||||
getVariable: std.meta.FnPtr(fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(.C) Status),
|
||||
getVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Enumerates the current variable names.
|
||||
getNextVariableName: std.meta.FnPtr(fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status),
|
||||
getNextVariableName: *const fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status,
|
||||
|
||||
/// Sets the value of a variable.
|
||||
setVariable: std.meta.FnPtr(fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(.C) Status),
|
||||
setVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(.C) Status,
|
||||
|
||||
/// Return the next high 32 bits of the platform's monotonic counter
|
||||
getNextHighMonotonicCount: std.meta.FnPtr(fn (high_count: *u32) callconv(.C) Status),
|
||||
getNextHighMonotonicCount: *const fn (high_count: *u32) callconv(.C) Status,
|
||||
|
||||
/// Resets the entire platform.
|
||||
resetSystem: std.meta.FnPtr(fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn),
|
||||
resetSystem: *const fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn,
|
||||
|
||||
/// Passes capsules to the firmware with both virtual and physical mapping.
|
||||
/// Depending on the intended consumption, the firmware may process the capsule immediately.
|
||||
/// If the payload should persist across a system reset, the reset value returned from
|
||||
/// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule
|
||||
/// to be processed by the firmware as part of the reset process.
|
||||
updateCapsule: std.meta.FnPtr(fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status),
|
||||
updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status,
|
||||
|
||||
/// Returns if the capsule can be supported via `updateCapsule`
|
||||
queryCapsuleCapabilities: std.meta.FnPtr(fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status),
|
||||
queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status,
|
||||
|
||||
/// Returns information about the EFI variables
|
||||
queryVariableInfo: std.meta.FnPtr(fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status),
|
||||
queryVariableInfo: *const fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status,
|
||||
|
||||
pub const signature: u64 = 0x56524553544e5552;
|
||||
};
|
||||
|
||||
@ -2696,7 +2696,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2;
|
||||
pub const MEM_DECOMMIT = 0x4000;
|
||||
pub const MEM_RELEASE = 0x8000;
|
||||
|
||||
pub const PTHREAD_START_ROUTINE = std.meta.FnPtr(fn (LPVOID) callconv(.C) DWORD);
|
||||
pub const PTHREAD_START_ROUTINE = *const fn (LPVOID) callconv(.C) DWORD;
|
||||
pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;
|
||||
|
||||
pub const WIN32_FIND_DATAW = extern struct {
|
||||
@ -2869,7 +2869,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct {
|
||||
pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;
|
||||
pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY;
|
||||
|
||||
pub const PIMAGE_TLS_CALLBACK = ?std.meta.FnPtr(fn (PVOID, DWORD, PVOID) callconv(.C) void);
|
||||
pub const PIMAGE_TLS_CALLBACK = ?*const fn (PVOID, DWORD, PVOID) callconv(.C) void;
|
||||
|
||||
pub const PROV_RSA_FULL = 1;
|
||||
|
||||
@ -2922,14 +2922,14 @@ pub const RTL_QUERY_REGISTRY_TABLE = extern struct {
|
||||
DefaultLength: ULONG,
|
||||
};
|
||||
|
||||
pub const RTL_QUERY_REGISTRY_ROUTINE = ?std.meta.FnPtr(fn (
|
||||
pub const RTL_QUERY_REGISTRY_ROUTINE = ?*const fn (
|
||||
PWSTR,
|
||||
ULONG,
|
||||
?*anyopaque,
|
||||
ULONG,
|
||||
?*anyopaque,
|
||||
?*anyopaque,
|
||||
) callconv(WINAPI) NTSTATUS);
|
||||
) callconv(WINAPI) NTSTATUS;
|
||||
|
||||
/// Path is a full path
|
||||
pub const RTL_REGISTRY_ABSOLUTE = 0;
|
||||
@ -3026,7 +3026,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003;
|
||||
pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;
|
||||
pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;
|
||||
|
||||
pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?std.meta.FnPtr(fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void);
|
||||
pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?*const fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void;
|
||||
|
||||
pub const FILE_NOTIFY_CHANGE_CREATION = 64;
|
||||
pub const FILE_NOTIFY_CHANGE_SIZE = 8;
|
||||
@ -3079,7 +3079,7 @@ pub const RTL_CRITICAL_SECTION = extern struct {
|
||||
pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
|
||||
pub const INIT_ONCE = RTL_RUN_ONCE;
|
||||
pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;
|
||||
pub const INIT_ONCE_FN = std.meta.FnPtr(fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL);
|
||||
pub const INIT_ONCE_FN = *const fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL;
|
||||
|
||||
pub const RTL_RUN_ONCE = extern struct {
|
||||
Ptr: ?*anyopaque,
|
||||
@ -3382,7 +3382,7 @@ pub const EXCEPTION_POINTERS = extern struct {
|
||||
ContextRecord: *std.os.windows.CONTEXT,
|
||||
};
|
||||
|
||||
pub const VECTORED_EXCEPTION_HANDLER = std.meta.FnPtr(fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long);
|
||||
pub const VECTORED_EXCEPTION_HANDLER = *const fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long;
|
||||
|
||||
pub const OBJECT_ATTRIBUTES = extern struct {
|
||||
Length: ULONG,
|
||||
@ -3658,7 +3658,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct {
|
||||
DosPath: UNICODE_STRING,
|
||||
};
|
||||
|
||||
pub const PPS_POST_PROCESS_INIT_ROUTINE = ?std.meta.FnPtr(fn () callconv(.C) void);
|
||||
pub const PPS_POST_PROCESS_INIT_ROUTINE = ?*const fn () callconv(.C) void;
|
||||
|
||||
pub const FILE_BOTH_DIR_INFORMATION = extern struct {
|
||||
NextEntryOffset: ULONG,
|
||||
@ -3678,7 +3678,7 @@ pub const FILE_BOTH_DIR_INFORMATION = extern struct {
|
||||
};
|
||||
pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION;
|
||||
|
||||
pub const IO_APC_ROUTINE = std.meta.FnPtr(fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void);
|
||||
pub const IO_APC_ROUTINE = *const fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void;
|
||||
|
||||
pub const CURDIR = extern struct {
|
||||
DosPath: UNICODE_STRING,
|
||||
@ -3750,8 +3750,8 @@ pub const ENUM_PAGE_FILE_INFORMATION = extern struct {
|
||||
PeakUsage: SIZE_T,
|
||||
};
|
||||
|
||||
pub const PENUM_PAGE_FILE_CALLBACKW = ?std.meta.FnPtr(fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL);
|
||||
pub const PENUM_PAGE_FILE_CALLBACKA = ?std.meta.FnPtr(fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL);
|
||||
pub const PENUM_PAGE_FILE_CALLBACKW = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL;
|
||||
pub const PENUM_PAGE_FILE_CALLBACKA = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL;
|
||||
|
||||
pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct {
|
||||
BasicInfo: PSAPI_WS_WATCH_INFORMATION,
|
||||
@ -3851,7 +3851,7 @@ pub const CTRL_CLOSE_EVENT: DWORD = 2;
|
||||
pub const CTRL_LOGOFF_EVENT: DWORD = 5;
|
||||
pub const CTRL_SHUTDOWN_EVENT: DWORD = 6;
|
||||
|
||||
pub const HANDLER_ROUTINE = std.meta.FnPtr(fn (dwCtrlType: DWORD) callconv(WINAPI) BOOL);
|
||||
pub const HANDLER_ROUTINE = *const fn (dwCtrlType: DWORD) callconv(WINAPI) BOOL;
|
||||
|
||||
/// Processor feature enumeration.
|
||||
pub const PF = enum(DWORD) {
|
||||
|
||||
@ -39,7 +39,7 @@ fn selectSymbol(comptime function_static: anytype, function_dynamic: @TypeOf(fun
|
||||
|
||||
// === Messages ===
|
||||
|
||||
pub const WNDPROC = std.meta.FnPtr(fn (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT);
|
||||
pub const WNDPROC = *const fn (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;
|
||||
|
||||
pub const MSG = extern struct {
|
||||
hWnd: ?HWND,
|
||||
@ -1056,7 +1056,7 @@ pub fn getMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:
|
||||
}
|
||||
|
||||
pub extern "user32" fn GetMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) callconv(WINAPI) BOOL;
|
||||
pub var pfnGetMessageW: std.meta.FnPtr(@TypeOf(GetMessageW)) = undefined;
|
||||
pub var pfnGetMessageW: *const @TypeOf(GetMessageW) = undefined;
|
||||
pub fn getMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32) !void {
|
||||
const function = selectSymbol(GetMessageW, pfnGetMessageW, .win2k);
|
||||
|
||||
@ -1087,7 +1087,7 @@ pub fn peekMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:
|
||||
}
|
||||
|
||||
pub extern "user32" fn PeekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) callconv(WINAPI) BOOL;
|
||||
pub var pfnPeekMessageW: std.meta.FnPtr(@TypeOf(PeekMessageW)) = undefined;
|
||||
pub var pfnPeekMessageW: *const @TypeOf(PeekMessageW) = undefined;
|
||||
pub fn peekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32, wRemoveMsg: u32) !bool {
|
||||
const function = selectSymbol(PeekMessageW, pfnPeekMessageW, .win2k);
|
||||
|
||||
@ -1112,7 +1112,7 @@ pub fn dispatchMessageA(lpMsg: *const MSG) LRESULT {
|
||||
}
|
||||
|
||||
pub extern "user32" fn DispatchMessageW(lpMsg: *const MSG) callconv(WINAPI) LRESULT;
|
||||
pub var pfnDispatchMessageW: std.meta.FnPtr(@TypeOf(DispatchMessageW)) = undefined;
|
||||
pub var pfnDispatchMessageW: *const @TypeOf(DispatchMessageW) = undefined;
|
||||
pub fn dispatchMessageW(lpMsg: *const MSG) LRESULT {
|
||||
const function = selectSymbol(DispatchMessageW, pfnDispatchMessageW, .win2k);
|
||||
return function(lpMsg);
|
||||
@ -1129,7 +1129,7 @@ pub fn defWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRE
|
||||
}
|
||||
|
||||
pub extern "user32" fn DefWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;
|
||||
pub var pfnDefWindowProcW: std.meta.FnPtr(@TypeOf(DefWindowProcW)) = undefined;
|
||||
pub var pfnDefWindowProcW: *const @TypeOf(DefWindowProcW) = undefined;
|
||||
pub fn defWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT {
|
||||
const function = selectSymbol(DefWindowProcW, pfnDefWindowProcW, .win2k);
|
||||
return function(hWnd, Msg, wParam, lParam);
|
||||
@ -1191,7 +1191,7 @@ pub fn registerClassExA(window_class: *const WNDCLASSEXA) !ATOM {
|
||||
}
|
||||
|
||||
pub extern "user32" fn RegisterClassExW(*const WNDCLASSEXW) callconv(WINAPI) ATOM;
|
||||
pub var pfnRegisterClassExW: std.meta.FnPtr(@TypeOf(RegisterClassExW)) = undefined;
|
||||
pub var pfnRegisterClassExW: *const @TypeOf(RegisterClassExW) = undefined;
|
||||
pub fn registerClassExW(window_class: *const WNDCLASSEXW) !ATOM {
|
||||
const function = selectSymbol(RegisterClassExW, pfnRegisterClassExW, .win2k);
|
||||
const atom = function(window_class);
|
||||
@ -1215,7 +1215,7 @@ pub fn unregisterClassA(lpClassName: [*:0]const u8, hInstance: HINSTANCE) !void
|
||||
}
|
||||
|
||||
pub extern "user32" fn UnregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) callconv(WINAPI) BOOL;
|
||||
pub var pfnUnregisterClassW: std.meta.FnPtr(@TypeOf(UnregisterClassW)) = undefined;
|
||||
pub var pfnUnregisterClassW: *const @TypeOf(UnregisterClassW) = undefined;
|
||||
pub fn unregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) !void {
|
||||
const function = selectSymbol(UnregisterClassW, pfnUnregisterClassW, .win2k);
|
||||
if (function(lpClassName, hInstance) == 0) {
|
||||
@ -1292,7 +1292,7 @@ pub fn createWindowExA(dwExStyle: u32, lpClassName: [*:0]const u8, lpWindowName:
|
||||
}
|
||||
|
||||
pub extern "user32" fn CreateWindowExW(dwExStyle: DWORD, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: DWORD, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?LPVOID) callconv(WINAPI) ?HWND;
|
||||
pub var pfnCreateWindowExW: std.meta.FnPtr(@TypeOf(CreateWindowExW)) = undefined;
|
||||
pub var pfnCreateWindowExW: *const @TypeOf(CreateWindowExW) = undefined;
|
||||
pub fn createWindowExW(dwExStyle: u32, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: u32, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?*anyopaque) !HWND {
|
||||
const function = selectSymbol(CreateWindowExW, pfnCreateWindowExW, .win2k);
|
||||
const window = function(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWindParent, hMenu, hInstance, lpParam);
|
||||
@ -1382,7 +1382,7 @@ pub fn getWindowLongA(hWnd: HWND, nIndex: i32) !i32 {
|
||||
}
|
||||
|
||||
pub extern "user32" fn GetWindowLongW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG;
|
||||
pub var pfnGetWindowLongW: std.meta.FnPtr(@TypeOf(GetWindowLongW)) = undefined;
|
||||
pub var pfnGetWindowLongW: *const @TypeOf(GetWindowLongW) = undefined;
|
||||
pub fn getWindowLongW(hWnd: HWND, nIndex: i32) !i32 {
|
||||
const function = selectSymbol(GetWindowLongW, pfnGetWindowLongW, .win2k);
|
||||
|
||||
@ -1415,7 +1415,7 @@ pub fn getWindowLongPtrA(hWnd: HWND, nIndex: i32) !isize {
|
||||
}
|
||||
|
||||
pub extern "user32" fn GetWindowLongPtrW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG_PTR;
|
||||
pub var pfnGetWindowLongPtrW: std.meta.FnPtr(@TypeOf(GetWindowLongPtrW)) = undefined;
|
||||
pub var pfnGetWindowLongPtrW: *const @TypeOf(GetWindowLongPtrW) = undefined;
|
||||
pub fn getWindowLongPtrW(hWnd: HWND, nIndex: i32) !isize {
|
||||
if (@sizeOf(LONG_PTR) == 4) return getWindowLongW(hWnd, nIndex);
|
||||
const function = selectSymbol(GetWindowLongPtrW, pfnGetWindowLongPtrW, .win2k);
|
||||
@ -1449,7 +1449,7 @@ pub fn setWindowLongA(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
|
||||
}
|
||||
|
||||
pub extern "user32" fn SetWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: LONG) callconv(WINAPI) LONG;
|
||||
pub var pfnSetWindowLongW: std.meta.FnPtr(@TypeOf(SetWindowLongW)) = undefined;
|
||||
pub var pfnSetWindowLongW: *const @TypeOf(SetWindowLongW) = undefined;
|
||||
pub fn setWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
|
||||
const function = selectSymbol(SetWindowLongW, pfnSetWindowLongW, .win2k);
|
||||
|
||||
@ -1484,7 +1484,7 @@ pub fn setWindowLongPtrA(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
|
||||
}
|
||||
|
||||
pub extern "user32" fn SetWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: LONG_PTR) callconv(WINAPI) LONG_PTR;
|
||||
pub var pfnSetWindowLongPtrW: std.meta.FnPtr(@TypeOf(SetWindowLongPtrW)) = undefined;
|
||||
pub var pfnSetWindowLongPtrW: *const @TypeOf(SetWindowLongPtrW) = undefined;
|
||||
pub fn setWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
|
||||
if (@sizeOf(LONG_PTR) == 4) return setWindowLongW(hWnd, nIndex, dwNewLong);
|
||||
const function = selectSymbol(SetWindowLongPtrW, pfnSetWindowLongPtrW, .win2k);
|
||||
@ -1580,7 +1580,7 @@ pub fn messageBoxA(hWnd: ?HWND, lpText: [*:0]const u8, lpCaption: [*:0]const u8,
|
||||
}
|
||||
|
||||
pub extern "user32" fn MessageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: ?[*:0]const u16, uType: UINT) callconv(WINAPI) i32;
|
||||
pub var pfnMessageBoxW: std.meta.FnPtr(@TypeOf(MessageBoxW)) = undefined;
|
||||
pub var pfnMessageBoxW: *const @TypeOf(MessageBoxW) = undefined;
|
||||
pub fn messageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: [*:0]const u16, uType: u32) !i32 {
|
||||
const function = selectSymbol(MessageBoxW, pfnMessageBoxW, .win2k);
|
||||
const value = function(hWnd, lpText, lpCaption, uType);
|
||||
|
||||
@ -942,7 +942,7 @@ pub const UDP_NOCHECKSUM = 1;
|
||||
pub const UDP_CHECKSUM_COVERAGE = 20;
|
||||
pub const GAI_STRERROR_BUFFER_SIZE = 1024;
|
||||
|
||||
pub const LPCONDITIONPROC = std.meta.FnPtr(fn (
|
||||
pub const LPCONDITIONPROC = *const fn (
|
||||
lpCallerId: *WSABUF,
|
||||
lpCallerData: *WSABUF,
|
||||
lpSQOS: *QOS,
|
||||
@ -951,14 +951,14 @@ pub const LPCONDITIONPROC = std.meta.FnPtr(fn (
|
||||
lpCalleeData: *WSABUF,
|
||||
g: *u32,
|
||||
dwCallbackData: usize,
|
||||
) callconv(WINAPI) i32);
|
||||
) callconv(WINAPI) i32;
|
||||
|
||||
pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = std.meta.FnPtr(fn (
|
||||
pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = *const fn (
|
||||
dwError: u32,
|
||||
cbTransferred: u32,
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
dwFlags: u32,
|
||||
) callconv(WINAPI) void);
|
||||
) callconv(WINAPI) void;
|
||||
|
||||
pub const FLOWSPEC = extern struct {
|
||||
TokenRate: u32,
|
||||
@ -1173,7 +1173,7 @@ pub const TRANSMIT_FILE_BUFFERS = extern struct {
|
||||
TailLength: u32,
|
||||
};
|
||||
|
||||
pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn (
|
||||
pub const LPFN_TRANSMITFILE = *const fn (
|
||||
hSocket: SOCKET,
|
||||
hFile: HANDLE,
|
||||
nNumberOfBytesToWrite: u32,
|
||||
@ -1181,9 +1181,9 @@ pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn (
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
|
||||
dwReserved: u32,
|
||||
) callconv(WINAPI) BOOL);
|
||||
) callconv(WINAPI) BOOL;
|
||||
|
||||
pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn (
|
||||
pub const LPFN_ACCEPTEX = *const fn (
|
||||
sListenSocket: SOCKET,
|
||||
sAcceptSocket: SOCKET,
|
||||
lpOutputBuffer: *anyopaque,
|
||||
@ -1192,9 +1192,9 @@ pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn (
|
||||
dwRemoteAddressLength: u32,
|
||||
lpdwBytesReceived: *u32,
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
) callconv(WINAPI) BOOL);
|
||||
) callconv(WINAPI) BOOL;
|
||||
|
||||
pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn (
|
||||
pub const LPFN_GETACCEPTEXSOCKADDRS = *const fn (
|
||||
lpOutputBuffer: *anyopaque,
|
||||
dwReceiveDataLength: u32,
|
||||
dwLocalAddressLength: u32,
|
||||
@ -1203,29 +1203,29 @@ pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn (
|
||||
LocalSockaddrLength: *i32,
|
||||
RemoteSockaddr: **sockaddr,
|
||||
RemoteSockaddrLength: *i32,
|
||||
) callconv(WINAPI) void);
|
||||
) callconv(WINAPI) void;
|
||||
|
||||
pub const LPFN_WSASENDMSG = std.meta.FnPtr(fn (
|
||||
pub const LPFN_WSASENDMSG = *const fn (
|
||||
s: SOCKET,
|
||||
lpMsg: *const std.x.os.Socket.Message,
|
||||
dwFlags: u32,
|
||||
lpNumberOfBytesSent: ?*u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32);
|
||||
) callconv(WINAPI) i32;
|
||||
|
||||
pub const LPFN_WSARECVMSG = std.meta.FnPtr(fn (
|
||||
pub const LPFN_WSARECVMSG = *const fn (
|
||||
s: SOCKET,
|
||||
lpMsg: *std.x.os.Socket.Message,
|
||||
lpdwNumberOfBytesRecv: ?*u32,
|
||||
lpOverlapped: ?*OVERLAPPED,
|
||||
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
|
||||
) callconv(WINAPI) i32);
|
||||
) callconv(WINAPI) i32;
|
||||
|
||||
pub const LPSERVICE_CALLBACK_PROC = std.meta.FnPtr(fn (
|
||||
pub const LPSERVICE_CALLBACK_PROC = *const fn (
|
||||
lParam: LPARAM,
|
||||
hAsyncTaskHandle: HANDLE,
|
||||
) callconv(WINAPI) void);
|
||||
) callconv(WINAPI) void;
|
||||
|
||||
pub const SERVICE_ASYNC_INFO = extern struct {
|
||||
lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC,
|
||||
@ -1233,11 +1233,11 @@ pub const SERVICE_ASYNC_INFO = extern struct {
|
||||
hAsyncTaskHandle: HANDLE,
|
||||
};
|
||||
|
||||
pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = std.meta.FnPtr(fn (
|
||||
pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = *const fn (
|
||||
dwError: u32,
|
||||
dwBytes: u32,
|
||||
lpOverlapped: *OVERLAPPED,
|
||||
) callconv(WINAPI) void);
|
||||
) callconv(WINAPI) void;
|
||||
|
||||
pub const fd_set = extern struct {
|
||||
fd_count: u32,
|
||||
|
||||
@ -338,12 +338,12 @@ pub fn PackedIntSliceEndian(comptime Int: type, comptime endian: Endian) type {
|
||||
};
|
||||
}
|
||||
|
||||
const we_are_testing_this_with_stage1_which_leaks_comptime_memory = true;
|
||||
|
||||
test "PackedIntArray" {
|
||||
// TODO @setEvalBranchQuota generates panics in wasm32. Investigate.
|
||||
if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
|
||||
if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;
|
||||
|
||||
// TODO: enable this test
|
||||
if (true) return error.SkipZigTest;
|
||||
|
||||
@setEvalBranchQuota(10000);
|
||||
const max_bits = 256;
|
||||
@ -405,7 +405,9 @@ test "PackedIntArray initAllTo" {
|
||||
test "PackedIntSlice" {
|
||||
// TODO @setEvalBranchQuota generates panics in wasm32. Investigate.
|
||||
if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
|
||||
if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;
|
||||
|
||||
// TODO enable this test
|
||||
if (true) return error.SkipZigTest;
|
||||
|
||||
@setEvalBranchQuota(10000);
|
||||
const max_bits = 256;
|
||||
@ -444,7 +446,9 @@ test "PackedIntSlice" {
|
||||
}
|
||||
|
||||
test "PackedIntSlice of PackedInt(Array/Slice)" {
|
||||
if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;
|
||||
// TODO enable this test
|
||||
if (true) return error.SkipZigTest;
|
||||
|
||||
const max_bits = 16;
|
||||
const int_count = 19;
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ pub const RomuTrio = @import("rand/RomuTrio.zig");
|
||||
|
||||
pub const Random = struct {
|
||||
ptr: *anyopaque,
|
||||
fillFn: std.meta.FnPtr(fn (ptr: *anyopaque, buf: []u8) void),
|
||||
fillFn: *const fn (ptr: *anyopaque, buf: []u8) void,
|
||||
|
||||
pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random {
|
||||
const Ptr = @TypeOf(pointer);
|
||||
|
||||
@ -412,7 +412,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
|
||||
}
|
||||
|
||||
test "SegmentedList basic usage" {
|
||||
if (@import("builtin").zig_backend == .stage1) {
|
||||
if (false) {
|
||||
// https://github.com/ziglang/zig/issues/11787
|
||||
try testSegmentedList(0);
|
||||
}
|
||||
|
||||
@ -191,9 +191,7 @@ pub fn extract(
|
||||
}
|
||||
|
||||
test "vector patterns" {
|
||||
if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
|
||||
builtin.cpu.arch == .aarch64)
|
||||
{
|
||||
if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
|
||||
// https://github.com/ziglang/zig/issues/12012
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
@ -419,7 +417,7 @@ test "vector prefix scan" {
|
||||
return error.SkipZigTest;
|
||||
}
|
||||
|
||||
if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
|
||||
if (builtin.zig_backend == .stage2_llvm) {
|
||||
// Regressed in LLVM 14:
|
||||
// https://github.com/llvm/llvm-project/issues/55522
|
||||
return error.SkipZigTest;
|
||||
|
||||
@ -354,9 +354,7 @@ fn testUtf16CountCodepoints() !void {
|
||||
|
||||
test "utf16 count codepoints" {
|
||||
try testUtf16CountCodepoints();
|
||||
// TODO stage1 error: out of bounds slice
|
||||
if (@import("builtin").zig_backend != .stage1)
|
||||
comptime try testUtf16CountCodepoints();
|
||||
comptime try testUtf16CountCodepoints();
|
||||
}
|
||||
|
||||
test "utf8 encode" {
|
||||
|
||||
@ -2009,8 +2009,6 @@ fn fullStructInit(tree: Ast, info: full.StructInit.Components) full.StructInit {
|
||||
|
||||
fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType {
|
||||
const token_tags = tree.tokens.items(.tag);
|
||||
// TODO: looks like stage1 isn't quite smart enough to handle enum
|
||||
// literals in some places here
|
||||
const Size = std.builtin.Type.Pointer.Size;
|
||||
const size: Size = switch (token_tags[info.main_token]) {
|
||||
.asterisk,
|
||||
|
||||
@ -9,19 +9,13 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
|
||||
// this function should behave like transCCast in translate-c, except it's for macros
|
||||
const SourceType = @TypeOf(target);
|
||||
switch (@typeInfo(DestType)) {
|
||||
.Fn => if (builtin.zig_backend == .stage1)
|
||||
return castToPtr(DestType, SourceType, target)
|
||||
else
|
||||
return castToPtr(*const DestType, SourceType, target),
|
||||
.Fn => return castToPtr(*const DestType, SourceType, target),
|
||||
.Pointer => return castToPtr(DestType, SourceType, target),
|
||||
.Optional => |dest_opt| {
|
||||
if (@typeInfo(dest_opt.child) == .Pointer) {
|
||||
return castToPtr(DestType, SourceType, target);
|
||||
} else if (@typeInfo(dest_opt.child) == .Fn) {
|
||||
if (builtin.zig_backend == .stage1)
|
||||
return castToPtr(DestType, SourceType, target)
|
||||
else
|
||||
return castToPtr(?*const dest_opt.child, SourceType, target);
|
||||
return castToPtr(?*const dest_opt.child, SourceType, target);
|
||||
}
|
||||
},
|
||||
.Int => {
|
||||
@ -149,7 +143,7 @@ test "cast" {
|
||||
try testing.expect(cast(?*anyopaque, -1) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))));
|
||||
try testing.expect(cast(?*anyopaque, foo) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))));
|
||||
|
||||
const FnPtr = ?if (builtin.zig_backend == .stage1) fn (*anyopaque) void else *align(1) const fn (*anyopaque) void;
|
||||
const FnPtr = ?*align(1) const fn (*anyopaque) void;
|
||||
try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0)));
|
||||
try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1))));
|
||||
}
|
||||
@ -160,12 +154,6 @@ pub fn sizeof(target: anytype) usize {
|
||||
switch (@typeInfo(T)) {
|
||||
.Float, .Int, .Struct, .Union, .Array, .Bool, .Vector => return @sizeOf(T),
|
||||
.Fn => {
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
// sizeof(main) returns 1, sizeof(&main) returns pointer size.
|
||||
// We cannot distinguish those types in Zig, so use pointer size.
|
||||
return @sizeOf(T);
|
||||
}
|
||||
|
||||
// sizeof(main) in C returns 1
|
||||
return 1;
|
||||
},
|
||||
@ -263,9 +251,7 @@ test "sizeof" {
|
||||
try testing.expect(sizeof(*const *const [4:0]u8) == ptr_size);
|
||||
try testing.expect(sizeof(*const [4]u8) == ptr_size);
|
||||
|
||||
if (builtin.zig_backend == .stage1) {
|
||||
try testing.expect(sizeof(sizeof) == @sizeOf(@TypeOf(sizeof)));
|
||||
} else if (false) { // TODO
|
||||
if (false) { // TODO
|
||||
try testing.expect(sizeof(&sizeof) == @sizeOf(@TypeOf(&sizeof)));
|
||||
try testing.expect(sizeof(sizeof) == 1);
|
||||
}
|
||||
|
||||
@ -5427,11 +5427,6 @@ pub fn build_crt_file(
|
||||
});
|
||||
errdefer comp.gpa.free(basename);
|
||||
|
||||
// TODO: This is extracted into a local variable to work around a stage1 miscompilation.
|
||||
const emit_bin = Compilation.EmitLoc{
|
||||
.directory = null, // Put it in the cache directory.
|
||||
.basename = basename,
|
||||
};
|
||||
const sub_compilation = try Compilation.create(comp.gpa, .{
|
||||
.local_cache_directory = comp.global_cache_directory,
|
||||
.global_cache_directory = comp.global_cache_directory,
|
||||
@ -5443,7 +5438,10 @@ pub fn build_crt_file(
|
||||
.output_mode = output_mode,
|
||||
.thread_pool = comp.thread_pool,
|
||||
.libc_installation = comp.bin_file.options.libc_installation,
|
||||
.emit_bin = emit_bin,
|
||||
.emit_bin = .{
|
||||
.directory = null, // Put it in the cache directory.
|
||||
.basename = basename,
|
||||
},
|
||||
.optimize_mode = comp.compilerRtOptMode(),
|
||||
.want_sanitize_c = false,
|
||||
.want_stack_check = false,
|
||||
@ -5488,15 +5486,16 @@ pub fn build_crt_file(
|
||||
});
|
||||
}
|
||||
|
||||
pub fn stage1AddLinkLib(comp: *Compilation, lib_name: []const u8) !void {
|
||||
pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void {
|
||||
// Avoid deadlocking on building import libs such as kernel32.lib
|
||||
// This can happen when the user uses `build-exe foo.obj -lkernel32` and then
|
||||
// when we create a sub-Compilation for zig libc, it also tries to build kernel32.lib.
|
||||
// This can happen when the user uses `build-exe foo.obj -lkernel32` and
|
||||
// then when we create a sub-Compilation for zig libc, it also tries to
|
||||
// build kernel32.lib.
|
||||
if (comp.bin_file.options.skip_linker_dependencies) return;
|
||||
|
||||
// This happens when an `extern "foo"` function is referenced by the stage1 backend.
|
||||
// If we haven't seen this library yet and we're targeting Windows, we need to queue up
|
||||
// a work item to produce the DLL import library for this.
|
||||
// This happens when an `extern "foo"` function is referenced.
|
||||
// If we haven't seen this library yet and we're targeting Windows, we need
|
||||
// to queue up a work item to produce the DLL import library for this.
|
||||
const gop = try comp.bin_file.options.system_libs.getOrPut(comp.gpa, lib_name);
|
||||
if (!gop.found_existing and comp.getTarget().os.tag == .windows) {
|
||||
try comp.work_queue.writeItem(.{
|
||||
|
||||
@ -71,7 +71,7 @@ import_table: std.StringArrayHashMapUnmanaged(*File) = .{},
|
||||
/// Keys are fully resolved file paths. This table owns the keys and values.
|
||||
embed_table: std.StringHashMapUnmanaged(*EmbedFile) = .{},
|
||||
|
||||
/// This is a temporary addition to stage2 in order to match stage1 behavior,
|
||||
/// This is a temporary addition to stage2 in order to match legacy behavior,
|
||||
/// however the end-game once the lang spec is settled will be to use a global
|
||||
/// InternPool for comptime memoized objects, making this behavior consistent across all types,
|
||||
/// not only string literals. Or, we might decide to not guarantee string literals
|
||||
@ -3544,17 +3544,15 @@ fn freeExportList(gpa: Allocator, export_list: *ArrayListUnmanaged(*Export)) voi
|
||||
export_list.deinit(gpa);
|
||||
}
|
||||
|
||||
// TODO https://github.com/ziglang/zig/issues/8643
|
||||
const data_has_safety_tag = @sizeOf(Zir.Inst.Data) != 8;
|
||||
// TODO This is taking advantage of matching stage1 debug union layout.
|
||||
// We need a better language feature for initializing a union with
|
||||
// a runtime-known tag.
|
||||
const Stage1DataLayout = extern struct {
|
||||
const HackDataLayout = extern struct {
|
||||
data: [8]u8 align(@alignOf(Zir.Inst.Data)),
|
||||
safety_tag: u8,
|
||||
};
|
||||
comptime {
|
||||
if (data_has_safety_tag) {
|
||||
assert(@sizeOf(Stage1DataLayout) == @sizeOf(Zir.Inst.Data));
|
||||
assert(@sizeOf(HackDataLayout) == @sizeOf(Zir.Inst.Data));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3695,7 +3693,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
|
||||
const tags = zir.instructions.items(.tag);
|
||||
for (zir.instructions.items(.data)) |*data, i| {
|
||||
const union_tag = Zir.Inst.Tag.data_tags[@enumToInt(tags[i])];
|
||||
const as_struct = @ptrCast(*Stage1DataLayout, data);
|
||||
const as_struct = @ptrCast(*HackDataLayout, data);
|
||||
as_struct.* = .{
|
||||
.safety_tag = @enumToInt(union_tag),
|
||||
.data = safety_buffer[i],
|
||||
@ -3881,7 +3879,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
|
||||
if (data_has_safety_tag) {
|
||||
// The `Data` union has a safety tag but in the file format we store it without.
|
||||
for (file.zir.instructions.items(.data)) |*data, i| {
|
||||
const as_struct = @ptrCast(*const Stage1DataLayout, data);
|
||||
const as_struct = @ptrCast(*const HackDataLayout, data);
|
||||
safety_buffer[i] = as_struct.data;
|
||||
}
|
||||
}
|
||||
|
||||
28
src/Sema.zig
28
src/Sema.zig
@ -8307,7 +8307,7 @@ fn handleExternLibName(
|
||||
.{ lib_name, lib_name },
|
||||
);
|
||||
}
|
||||
comp.stage1AddLinkLib(lib_name) catch |err| {
|
||||
comp.addLinkLib(lib_name) catch |err| {
|
||||
return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{
|
||||
lib_name, @errorName(err),
|
||||
});
|
||||
@ -8401,15 +8401,11 @@ fn funcCommon(
|
||||
}
|
||||
}
|
||||
|
||||
// These locals are pulled out from the init expression below to work around
|
||||
// a stage1 compiler bug.
|
||||
// In the case of generic calling convention, or generic alignment, we use
|
||||
// default values which are only meaningful for the generic function, *not*
|
||||
// the instantiation, which can depend on comptime parameters.
|
||||
// Related proposal: https://github.com/ziglang/zig/issues/11834
|
||||
const cc_workaround = cc orelse .Unspecified;
|
||||
const align_workaround = alignment orelse 0;
|
||||
|
||||
const cc_resolved = cc orelse .Unspecified;
|
||||
const param_types = try sema.arena.alloc(Type, block.params.items.len);
|
||||
const comptime_params = try sema.arena.alloc(bool, block.params.items.len);
|
||||
for (block.params.items) |param, i| {
|
||||
@ -8421,7 +8417,7 @@ fn funcCommon(
|
||||
comptime_params,
|
||||
i,
|
||||
&is_generic,
|
||||
cc_workaround,
|
||||
cc_resolved,
|
||||
has_body,
|
||||
) catch |err| switch (err) {
|
||||
error.NeededSourceLocation => {
|
||||
@ -8433,7 +8429,7 @@ fn funcCommon(
|
||||
comptime_params,
|
||||
i,
|
||||
&is_generic,
|
||||
cc_workaround,
|
||||
cc_resolved,
|
||||
has_body,
|
||||
);
|
||||
return error.AnalysisFail;
|
||||
@ -8481,10 +8477,10 @@ fn funcCommon(
|
||||
};
|
||||
return sema.failWithOwnedErrorMsg(msg);
|
||||
}
|
||||
if (!Type.fnCallingConventionAllowsZigTypes(cc_workaround) and !try sema.validateExternType(return_type, .ret_ty)) {
|
||||
if (!Type.fnCallingConventionAllowsZigTypes(cc_resolved) and !try sema.validateExternType(return_type, .ret_ty)) {
|
||||
const msg = msg: {
|
||||
const msg = try sema.errMsg(block, ret_ty_src, "return type '{}' not allowed in function with calling convention '{s}'", .{
|
||||
return_type.fmt(sema.mod), @tagName(cc_workaround),
|
||||
return_type.fmt(sema.mod), @tagName(cc_resolved),
|
||||
});
|
||||
errdefer msg.destroy(sema.gpa);
|
||||
|
||||
@ -8533,7 +8529,7 @@ fn funcCommon(
|
||||
}
|
||||
|
||||
const arch = sema.mod.getTarget().cpu.arch;
|
||||
if (switch (cc_workaround) {
|
||||
if (switch (cc_resolved) {
|
||||
.Unspecified, .C, .Naked, .Async, .Inline => null,
|
||||
.Interrupt => switch (arch) {
|
||||
.x86, .x86_64, .avr, .msp430 => null,
|
||||
@ -8569,13 +8565,13 @@ fn funcCommon(
|
||||
},
|
||||
}) |allowed_platform| {
|
||||
return sema.fail(block, cc_src, "callconv '{s}' is only available on {s}, not {s}", .{
|
||||
@tagName(cc_workaround),
|
||||
@tagName(cc_resolved),
|
||||
allowed_platform,
|
||||
@tagName(arch),
|
||||
});
|
||||
}
|
||||
|
||||
if (cc_workaround == .Inline and is_noinline) {
|
||||
if (cc_resolved == .Inline and is_noinline) {
|
||||
return sema.fail(block, cc_src, "'noinline' function cannot have callconv 'Inline'", .{});
|
||||
}
|
||||
if (is_generic and sema.no_partial_func_ty) return error.GenericPoison;
|
||||
@ -8593,9 +8589,9 @@ fn funcCommon(
|
||||
.param_types = param_types,
|
||||
.comptime_params = comptime_params.ptr,
|
||||
.return_type = return_type,
|
||||
.cc = cc_workaround,
|
||||
.cc = cc_resolved,
|
||||
.cc_is_generic = cc == null,
|
||||
.alignment = align_workaround,
|
||||
.alignment = alignment orelse 0,
|
||||
.align_is_generic = alignment == null,
|
||||
.section_is_generic = section == .generic,
|
||||
.addrspace_is_generic = address_space == null,
|
||||
@ -19107,8 +19103,6 @@ fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
|
||||
const operand_elem_size = operand_elem_ty.abiSize(target);
|
||||
const dest_elem_size = dest_elem_ty.abiSize(target);
|
||||
if (operand_elem_size != dest_elem_size) {
|
||||
// note that this is not implemented in stage1 so we should probably wait
|
||||
// until that codebase is replaced before implementing this in stage2.
|
||||
return sema.fail(block, dest_ty_src, "TODO: implement @ptrCast between slices changing the length", .{});
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,10 +15,7 @@ const Runnable = struct {
|
||||
runFn: RunProto,
|
||||
};
|
||||
|
||||
const RunProto = switch (builtin.zig_backend) {
|
||||
.stage1 => fn (*Runnable) void,
|
||||
else => *const fn (*Runnable) void,
|
||||
};
|
||||
const RunProto = *const fn (*Runnable) void;
|
||||
|
||||
pub fn init(pool: *ThreadPool, allocator: std.mem.Allocator) !void {
|
||||
pool.* = .{
|
||||
|
||||
@ -161,12 +161,11 @@ pub const ASTUnit = opaque {
|
||||
extern fn ZigClangASTUnit_getSourceManager(*ASTUnit) *SourceManager;
|
||||
|
||||
pub const visitLocalTopLevelDecls = ZigClangASTUnit_visitLocalTopLevelDecls;
|
||||
extern fn ZigClangASTUnit_visitLocalTopLevelDecls(*ASTUnit, context: ?*anyopaque, Fn: ?VisitorFn) bool;
|
||||
|
||||
const VisitorFn = if (@import("builtin").zig_backend == .stage1)
|
||||
fn (?*anyopaque, *const Decl) callconv(.C) bool
|
||||
else
|
||||
*const fn (?*anyopaque, *const Decl) callconv(.C) bool;
|
||||
extern fn ZigClangASTUnit_visitLocalTopLevelDecls(
|
||||
*ASTUnit,
|
||||
context: ?*anyopaque,
|
||||
Fn: ?*const fn (?*anyopaque, *const Decl) callconv(.C) bool,
|
||||
) bool;
|
||||
|
||||
pub const getLocalPreprocessingEntities_begin = ZigClangASTUnit_getLocalPreprocessingEntities_begin;
|
||||
extern fn ZigClangASTUnit_getLocalPreprocessingEntities_begin(*ASTUnit) PreprocessingRecord.iterator;
|
||||
|
||||
@ -98,54 +98,13 @@ pub fn generateFunction(
|
||||
.aarch64_be,
|
||||
.aarch64_32,
|
||||
=> return @import("arch/aarch64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.arc => return Function(.arc).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.avr => return Function(.avr).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.bpfel => return Function(.bpfel).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.bpfeb => return Function(.bpfeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.hexagon => return Function(.hexagon).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.mips => return Function(.mips).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.mipsel => return Function(.mipsel).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.mips64 => return Function(.mips64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.mips64el => return Function(.mips64el).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.msp430 => return Function(.msp430).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.powerpc => return Function(.powerpc).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.powerpc64 => return Function(.powerpc64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.powerpc64le => return Function(.powerpc64le).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.r600 => return Function(.r600).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.amdgcn => return Function(.amdgcn).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.riscv32 => return Function(.riscv32).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
.riscv64 => return @import("arch/riscv64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.sparc => return Function(.sparc).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
.sparc64 => return @import("arch/sparc64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.sparcel => return Function(.sparcel).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.s390x => return Function(.s390x).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.tce => return Function(.tce).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.tcele => return Function(.tcele).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.thumb => return Function(.thumb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.thumbeb => return Function(.thumbeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.x86 => return Function(.x86).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
.x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.xcore => return Function(.xcore).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.nvptx => return Function(.nvptx).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.nvptx64 => return Function(.nvptx64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.le32 => return Function(.le32).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.le64 => return Function(.le64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.amdil => return Function(.amdil).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.amdil64 => return Function(.amdil64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.hsail => return Function(.hsail).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.hsail64 => return Function(.hsail64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.spir => return Function(.spir).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.spir64 => return Function(.spir64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.kalimba => return Function(.kalimba).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.shave => return Function(.shave).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.lanai => return Function(.lanai).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.renderscript32 => return Function(.renderscript32).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.renderscript64 => return Function(.renderscript64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
//.ve => return Function(.ve).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
.wasm32,
|
||||
.wasm64,
|
||||
=> return @import("arch/wasm/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
|
||||
else => @panic("Backend architectures that don't have good support yet are commented out, to improve compilation performance. If you are interested in one of these other backends feel free to uncomment them. Eventually these will be completed, but stage1 is slow and a memory hog."),
|
||||
else => unreachable,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4972,8 +4972,7 @@ fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue {
|
||||
|
||||
if (f.liveness.isUnused(inst)) {
|
||||
try reap(f, inst, &.{extra.struct_operand});
|
||||
// TODO this @as is needed because of a stage1 bug
|
||||
return @as(CValue, CValue.none);
|
||||
return .none;
|
||||
}
|
||||
|
||||
const struct_ptr = try f.resolveInst(extra.struct_operand);
|
||||
@ -4987,8 +4986,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue
|
||||
|
||||
if (f.liveness.isUnused(inst)) {
|
||||
try reap(f, inst, &.{ty_op.operand});
|
||||
// TODO this @as is needed because of a stage1 bug
|
||||
return @as(CValue, CValue.none);
|
||||
return .none;
|
||||
}
|
||||
|
||||
const struct_ptr = try f.resolveInst(ty_op.operand);
|
||||
|
||||
@ -1392,8 +1392,9 @@ pub const Object = struct {
|
||||
const dir_path = file.pkg.root_src_directory.path orelse ".";
|
||||
const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path));
|
||||
defer gpa.free(sub_file_path_z);
|
||||
const stage1_workaround = std.fs.path.dirname(file.sub_file_path) orelse "";
|
||||
const dir_path_z = try std.fs.path.joinZ(gpa, &.{ dir_path, stage1_workaround });
|
||||
const dir_path_z = try std.fs.path.joinZ(gpa, &.{
|
||||
dir_path, std.fs.path.dirname(file.sub_file_path) orelse "",
|
||||
});
|
||||
defer gpa.free(dir_path_z);
|
||||
const di_file = o.di_builder.?.createFile(sub_file_path_z, dir_path_z);
|
||||
gop.value_ptr.* = di_file.toNode();
|
||||
@ -6107,12 +6108,11 @@ pub const FuncGen = struct {
|
||||
}
|
||||
|
||||
fn airAssembly(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
|
||||
// Eventually, the Zig compiler needs to be reworked to have inline assembly go
|
||||
// through the same parsing code regardless of backend, and have LLVM-flavored
|
||||
// inline assembly be *output* from that assembler.
|
||||
// We don't have such an assembler implemented yet though. For now, this
|
||||
// implementation feeds the inline assembly code directly to LLVM, same
|
||||
// as stage1.
|
||||
// Eventually, the Zig compiler needs to be reworked to have inline
|
||||
// assembly go through the same parsing code regardless of backend, and
|
||||
// have LLVM-flavored inline assembly be *output* from that assembler.
|
||||
// We don't have such an assembler implemented yet though. For now,
|
||||
// this implementation feeds the inline assembly code directly to LLVM.
|
||||
|
||||
const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
|
||||
const extra = self.air.extraData(Air.Asm, ty_pl.payload);
|
||||
|
||||
@ -333,8 +333,6 @@ fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {
|
||||
}
|
||||
|
||||
test "SPIR-V Section emit() - no operands" {
|
||||
if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
var section = Section{};
|
||||
defer section.deinit(std.testing.allocator);
|
||||
|
||||
@ -344,8 +342,6 @@ test "SPIR-V Section emit() - no operands" {
|
||||
}
|
||||
|
||||
test "SPIR-V Section emit() - simple" {
|
||||
if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
var section = Section{};
|
||||
defer section.deinit(std.testing.allocator);
|
||||
|
||||
@ -362,8 +358,6 @@ test "SPIR-V Section emit() - simple" {
|
||||
}
|
||||
|
||||
test "SPIR-V Section emit() - string" {
|
||||
if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
var section = Section{};
|
||||
defer section.deinit(std.testing.allocator);
|
||||
|
||||
@ -389,8 +383,6 @@ test "SPIR-V Section emit() - string" {
|
||||
}
|
||||
|
||||
test "SPIR-V Section emit()- extended mask" {
|
||||
if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
var section = Section{};
|
||||
defer section.deinit(std.testing.allocator);
|
||||
|
||||
@ -415,8 +407,6 @@ test "SPIR-V Section emit()- extended mask" {
|
||||
}
|
||||
|
||||
test "SPIR-V Section emit() - extended union" {
|
||||
if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
|
||||
|
||||
var section = Section{};
|
||||
defer section.deinit(std.testing.allocator);
|
||||
|
||||
|
||||
@ -3289,15 +3289,11 @@ fn parseCrossTargetOrReportFatalError(
|
||||
fatal("unknown CPU feature: '{s}'", .{diags.unknown_feature_name.?});
|
||||
},
|
||||
error.UnknownObjectFormat => {
|
||||
{
|
||||
help: {
|
||||
var help_text = std.ArrayList(u8).init(allocator);
|
||||
defer help_text.deinit();
|
||||
inline for (@typeInfo(std.Target.ObjectFormat).Enum.fields) |field| {
|
||||
help_text.writer().print(" {s}\n", .{field.name}) catch
|
||||
// TODO change this back to `break :help`
|
||||
// this working around a stage1 bug.
|
||||
//break :help;
|
||||
@panic("out of memory");
|
||||
help_text.writer().print(" {s}\n", .{field.name}) catch break :help;
|
||||
}
|
||||
std.log.info("available object formats:\n{s}", .{help_text.items});
|
||||
}
|
||||
|
||||
@ -523,13 +523,13 @@ pub const AtomicPtrAlignmentDiagnostics = struct {
|
||||
/// If ABI alignment of `ty` is OK for atomic operations, returns 0.
|
||||
/// Otherwise returns the alignment required on a pointer for the target
|
||||
/// to perform atomic operations.
|
||||
// TODO this function does not take into account CPU features, which can affect
|
||||
// this value. Audit this!
|
||||
pub fn atomicPtrAlignment(
|
||||
target: std.Target,
|
||||
ty: Type,
|
||||
diags: *AtomicPtrAlignmentDiagnostics,
|
||||
) AtomicPtrAlignmentError!u32 {
|
||||
// TODO this was ported from stage1 but it does not take into account CPU features,
|
||||
// which can affect this value. Audit this!
|
||||
const max_atomic_bits: u16 = switch (target.cpu.arch) {
|
||||
.avr,
|
||||
.msp430,
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
//! This is the userland implementation of translate-c which is used by both stage1
|
||||
//! and stage2.
|
||||
|
||||
const std = @import("std");
|
||||
const testing = std.testing;
|
||||
const assert = std.debug.assert;
|
||||
|
||||
10
src/type.zig
10
src/type.zig
@ -1554,10 +1554,10 @@ pub const Type = extern union {
|
||||
) @TypeOf(writer).Error!void {
|
||||
_ = options;
|
||||
comptime assert(unused_format_string.len == 0);
|
||||
if (@import("builtin").zig_backend != .stage1) {
|
||||
// This is disabled to work around a stage2 bug where this function recursively
|
||||
// causes more generic function instantiations resulting in an infinite loop
|
||||
// in the compiler.
|
||||
if (true) {
|
||||
// This is disabled to work around a bug where this function
|
||||
// recursively causes more generic function instantiations
|
||||
// resulting in an infinite loop in the compiler.
|
||||
try writer.writeAll("[TODO fix internal compiler bug regarding dump]");
|
||||
return;
|
||||
}
|
||||
@ -6551,9 +6551,7 @@ pub const Type = extern union {
|
||||
else => {},
|
||||
}
|
||||
} else {
|
||||
// TODO stage1 type inference bug
|
||||
const T = Type.Tag;
|
||||
|
||||
const type_payload = try arena.create(Type.Payload.ElemType);
|
||||
type_payload.* = .{
|
||||
.base = .{
|
||||
|
||||
@ -337,7 +337,6 @@ ZIG_EXTERN_C void ZigLLVMParseCommandLineOptions(size_t argc, const char *const
|
||||
|
||||
// synchronize with llvm/include/ADT/Triple.h::ArchType
|
||||
// synchronize with std.Target.Cpu.Arch
|
||||
// synchronize with src/stage1/target.cpp::arch_list
|
||||
// synchronize with codegen/llvm/bindings.zig::ArchType
|
||||
enum ZigLLVM_ArchType {
|
||||
ZigLLVM_UnknownArch,
|
||||
@ -428,7 +427,6 @@ enum ZigLLVM_VendorType {
|
||||
// synchronize with llvm/include/ADT/Triple.h::OsType
|
||||
// synchronize with std.Target.Os.Tag
|
||||
// synchronize with codegen/llvm/bindings.zig::OsType
|
||||
// synchronize with src/stage1/target.cpp::os_list
|
||||
enum ZigLLVM_OSType {
|
||||
ZigLLVM_UnknownOS,
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user