Update uses of @fieldParentPtr to pass a pointer type
This commit is contained in:
@@ -1062,8 +1062,8 @@ pub fn getUninstallStep(self: *Build) *Step {
|
||||
|
||||
fn makeUninstall(uninstall_step: *Step, prog_node: *std.Progress.Node) anyerror!void {
|
||||
_ = prog_node;
|
||||
const uninstall_tls = @fieldParentPtr(TopLevelStep, "step", uninstall_step);
|
||||
const self = @fieldParentPtr(Build, "uninstall_tls", uninstall_tls);
|
||||
const uninstall_tls = @fieldParentPtr(*TopLevelStep, "step", uninstall_step);
|
||||
const self = @fieldParentPtr(*Build, "uninstall_tls", uninstall_tls);
|
||||
|
||||
for (self.installed_files.items) |installed_file| {
|
||||
const full_path = self.getInstallPath(installed_file.dir, installed_file.path);
|
||||
|
||||
@@ -231,7 +231,7 @@ fn makeNoOp(step: *Step, prog_node: *std.Progress.Node) anyerror!void {
|
||||
|
||||
pub fn cast(step: *Step, comptime T: type) ?*T {
|
||||
if (step.id == T.base_id) {
|
||||
return @fieldParentPtr(T, "step", step);
|
||||
return @fieldParentPtr(*T, "step", step);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ pub fn setName(self: *CheckFile, name: []const u8) void {
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
const b = step.owner;
|
||||
const self = @fieldParentPtr(CheckFile, "step", step);
|
||||
const self = @fieldParentPtr(*CheckFile, "step", step);
|
||||
|
||||
const src_path = self.source.getPath(b);
|
||||
const contents = fs.cwd().readFileAlloc(b.allocator, src_path, self.max_bytes) catch |err| {
|
||||
|
||||
@@ -530,7 +530,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
const b = step.owner;
|
||||
const gpa = b.allocator;
|
||||
const self = @fieldParentPtr(CheckObject, "step", step);
|
||||
const self = @fieldParentPtr(*CheckObject, "step", step);
|
||||
|
||||
const src_path = self.source.getPath(b);
|
||||
const contents = fs.cwd().readFileAllocOptions(
|
||||
|
||||
@@ -918,7 +918,7 @@ fn getGeneratedFilePath(self: *Compile, comptime tag_name: []const u8, asking_st
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
const b = step.owner;
|
||||
const arena = b.allocator;
|
||||
const self = @fieldParentPtr(Compile, "step", step);
|
||||
const self = @fieldParentPtr(*Compile, "step", step);
|
||||
|
||||
var zig_args = ArrayList([]const u8).init(arena);
|
||||
defer zig_args.deinit();
|
||||
|
||||
@@ -167,7 +167,7 @@ fn putValue(self: *ConfigHeader, field_name: []const u8, comptime T: type, v: T)
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
const b = step.owner;
|
||||
const self = @fieldParentPtr(ConfigHeader, "step", step);
|
||||
const self = @fieldParentPtr(*ConfigHeader, "step", step);
|
||||
const gpa = b.allocator;
|
||||
const arena = b.allocator;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
|
||||
const b = step.owner;
|
||||
const arena = b.allocator;
|
||||
const self = @fieldParentPtr(Fmt, "step", step);
|
||||
const self = @fieldParentPtr(*Fmt, "step", step);
|
||||
|
||||
var argv: std.ArrayListUnmanaged([]const u8) = .{};
|
||||
try argv.ensureUnusedCapacity(arena, 2 + 1 + self.paths.len + 2 * self.exclude_paths.len);
|
||||
|
||||
@@ -121,7 +121,7 @@ pub fn create(owner: *std.Build, artifact: *Step.Compile, options: Options) *Ins
|
||||
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
const self = @fieldParentPtr(InstallArtifact, "step", step);
|
||||
const self = @fieldParentPtr(*InstallArtifact, "step", step);
|
||||
const dest_builder = step.owner;
|
||||
const cwd = fs.cwd();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ pub fn create(owner: *std.Build, options: Options) *InstallDirStep {
|
||||
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
const self = @fieldParentPtr(InstallDirStep, "step", step);
|
||||
const self = @fieldParentPtr(*InstallDirStep, "step", step);
|
||||
const dest_builder = self.dest_builder;
|
||||
const arena = dest_builder.allocator;
|
||||
const dest_prefix = dest_builder.getInstallPath(self.options.install_dir, self.options.install_subdir);
|
||||
|
||||
@@ -43,7 +43,7 @@ pub fn create(
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
const src_builder = step.owner;
|
||||
const self = @fieldParentPtr(InstallFile, "step", step);
|
||||
const self = @fieldParentPtr(*InstallFile, "step", step);
|
||||
const dest_builder = self.dest_builder;
|
||||
const full_src_path = self.source.getPath2(src_builder, step);
|
||||
const full_dest_path = dest_builder.getInstallPath(self.dir, self.dest_rel_path);
|
||||
|
||||
@@ -92,7 +92,7 @@ pub fn getOutputSeparatedDebug(self: *const ObjCopy) ?std.Build.LazyPath {
|
||||
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
const b = step.owner;
|
||||
const self = @fieldParentPtr(ObjCopy, "step", step);
|
||||
const self = @fieldParentPtr(*ObjCopy, "step", step);
|
||||
|
||||
var man = b.graph.cache.obtain();
|
||||
defer man.deinit();
|
||||
|
||||
@@ -415,7 +415,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
|
||||
const b = step.owner;
|
||||
const self = @fieldParentPtr(Options, "step", step);
|
||||
const self = @fieldParentPtr(*Options, "step", step);
|
||||
|
||||
for (self.args.items) |item| {
|
||||
self.addOption(
|
||||
|
||||
@@ -28,7 +28,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
|
||||
const b = step.owner;
|
||||
const self = @fieldParentPtr(RemoveDir, "step", step);
|
||||
const self = @fieldParentPtr(*RemoveDir, "step", step);
|
||||
|
||||
b.build_root.handle.deleteTree(self.dir_path) catch |err| {
|
||||
if (b.build_root.path) |base| {
|
||||
|
||||
@@ -497,7 +497,7 @@ const IndexedOutput = struct {
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
const b = step.owner;
|
||||
const arena = b.allocator;
|
||||
const self = @fieldParentPtr(Run, "step", step);
|
||||
const self = @fieldParentPtr(*Run, "step", step);
|
||||
const has_side_effects = self.hasSideEffects();
|
||||
|
||||
var argv_list = ArrayList([]const u8).init(arena);
|
||||
|
||||
@@ -118,7 +118,7 @@ pub fn defineCMacroRaw(self: *TranslateC, name_and_value: []const u8) void {
|
||||
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
const b = step.owner;
|
||||
const self = @fieldParentPtr(TranslateC, "step", step);
|
||||
const self = @fieldParentPtr(*TranslateC, "step", step);
|
||||
|
||||
var argv_list = std.ArrayList([]const u8).init(b.allocator);
|
||||
try argv_list.append(b.graph.zig_exe);
|
||||
|
||||
@@ -141,7 +141,7 @@ fn maybeUpdateName(wf: *WriteFile) void {
|
||||
fn make(step: *Step, prog_node: *std.Progress.Node) !void {
|
||||
_ = prog_node;
|
||||
const b = step.owner;
|
||||
const wf = @fieldParentPtr(WriteFile, "step", step);
|
||||
const wf = @fieldParentPtr(*WriteFile, "step", step);
|
||||
|
||||
// Writing to source files is kind of an extra capability of this
|
||||
// WriteFile - arguably it should be a different step. But anyway here
|
||||
|
||||
@@ -88,8 +88,8 @@ pub fn spawn(pool: *Pool, comptime func: anytype, args: anytype) !void {
|
||||
run_node: RunQueue.Node = .{ .data = .{ .runFn = runFn } },
|
||||
|
||||
fn runFn(runnable: *Runnable) void {
|
||||
const run_node = @fieldParentPtr(RunQueue.Node, "data", runnable);
|
||||
const closure = @fieldParentPtr(@This(), "run_node", run_node);
|
||||
const run_node = @fieldParentPtr(*RunQueue.Node, "data", runnable);
|
||||
const closure = @fieldParentPtr(*@This(), "run_node", run_node);
|
||||
@call(.auto, func, closure.arguments);
|
||||
|
||||
// The thread pool's allocator is protected by the mutex.
|
||||
|
||||
@@ -108,7 +108,7 @@ pub const ConnectionPool = struct {
|
||||
pool.mutex.lock();
|
||||
defer pool.mutex.unlock();
|
||||
|
||||
const node = @fieldParentPtr(Node, "data", connection);
|
||||
const node = @fieldParentPtr(*Node, "data", connection);
|
||||
|
||||
pool.used.remove(node);
|
||||
|
||||
|
||||
@@ -11686,20 +11686,20 @@ const Scope = struct {
|
||||
fn cast(base: *Scope, comptime T: type) ?*T {
|
||||
if (T == Defer) {
|
||||
switch (base.tag) {
|
||||
.defer_normal, .defer_error => return @fieldParentPtr(T, "base", base),
|
||||
.defer_normal, .defer_error => return @alignCast(@fieldParentPtr(*align(1) T, "base", base)),
|
||||
else => return null,
|
||||
}
|
||||
}
|
||||
if (T == Namespace) {
|
||||
switch (base.tag) {
|
||||
.namespace => return @fieldParentPtr(T, "base", base),
|
||||
.namespace => return @alignCast(@fieldParentPtr(*align(1) T, "base", base)),
|
||||
else => return null,
|
||||
}
|
||||
}
|
||||
if (base.tag != T.base_tag)
|
||||
return null;
|
||||
|
||||
return @fieldParentPtr(T, "base", base);
|
||||
return @alignCast(@fieldParentPtr(*align(1) T, "base", base));
|
||||
}
|
||||
|
||||
fn parent(base: *Scope) ?*Scope {
|
||||
|
||||
@@ -414,7 +414,7 @@ pub const Macros = struct {
|
||||
}
|
||||
|
||||
pub fn WL_CONTAINER_OF(ptr: anytype, sample: anytype, comptime member: []const u8) @TypeOf(sample) {
|
||||
return @fieldParentPtr(@TypeOf(sample.*), member, ptr);
|
||||
return @fieldParentPtr(@TypeOf(sample), member, ptr);
|
||||
}
|
||||
|
||||
/// A 2-argument function-like macro defined as #define FOO(A, B) (A)(B)
|
||||
|
||||
Reference in New Issue
Block a user