aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2024-05-02 20:20:41 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-06-13 10:18:59 -0400
commit76fb2b685b202ea665b850338e353c7816f5b2bb (patch)
tree16b4b39db7541febd2b4bf92c041239bdd45f144 /src/link
parent4aa15440c7a12bcc6bc0cd589ade02295549d48c (diff)
downloadzig-76fb2b685b202ea665b850338e353c7816f5b2bb.tar.gz
zig-76fb2b685b202ea665b850338e353c7816f5b2bb.zip
std: Convert deprecated aliases to compile errors and fix usages
Deprecated aliases that are now compile errors: - `std.fs.MAX_PATH_BYTES` (renamed to `std.fs.max_path_bytes`) - `std.mem.tokenize` (split into `tokenizeAny`, `tokenizeSequence`, `tokenizeScalar`) - `std.mem.split` (split into `splitSequence`, `splitAny`, `splitScalar`) - `std.mem.splitBackwards` (split into `splitBackwardsSequence`, `splitBackwardsAny`, `splitBackwardsScalar`) - `std.unicode` + `utf16leToUtf8Alloc`, `utf16leToUtf8AllocZ`, `utf16leToUtf8`, `fmtUtf16le` (all renamed to have capitalized `Le`) + `utf8ToUtf16LeWithNull` (renamed to `utf8ToUtf16LeAllocZ`) - `std.zig.CrossTarget` (moved to `std.Target.Query`) Deprecated `lib/std/std.zig` decls were deleted instead of made a `@compileError` because the `refAllDecls` in the test block would trigger the `@compileError`. The deleted top-level `std` namespaces are: - `std.rand` (renamed to `std.Random`) - `std.TailQueue` (renamed to `std.DoublyLinkedList`) - `std.ChildProcess` (renamed/moved to `std.process.Child`) This is not exhaustive. Deprecated aliases that I didn't touch: + `std.io.*` + `std.Build.*` + `std.builtin.Mode` + `std.zig.c_translation.CIntLiteralRadix` + anything in `src/`
Diffstat (limited to 'src/link')
-rw-r--r--src/link/Dwarf.zig6
-rw-r--r--src/link/Elf.zig4
-rw-r--r--src/link/MachO.zig4
-rw-r--r--src/link/MachO/Dylib.zig2
-rw-r--r--src/link/Plan9.zig2
-rw-r--r--src/link/Wasm/Archive.zig2
6 files changed, 10 insertions, 10 deletions
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig
index 8bfaef61db..8b29bfd99b 100644
--- a/src/link/Dwarf.zig
+++ b/src/link/Dwarf.zig
@@ -2006,7 +2006,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, zcu: *Module, low_pc: u64, high_pc: u64)
// Write the form for the compile unit, which must match the abbrev table above.
const name_strp = try self.strtab.insert(self.allocator, zcu.root_mod.root_src_path);
- var compile_unit_dir_buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
+ var compile_unit_dir_buffer: [std.fs.max_path_bytes]u8 = undefined;
const compile_unit_dir = resolveCompilationDir(zcu, &compile_unit_dir_buffer);
const comp_dir_strp = try self.strtab.insert(self.allocator, compile_unit_dir);
const producer_strp = try self.strtab.insert(self.allocator, link.producer_string);
@@ -2058,7 +2058,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, zcu: *Module, low_pc: u64, high_pc: u64)
}
}
-fn resolveCompilationDir(module: *Module, buffer: *[std.fs.MAX_PATH_BYTES]u8) []const u8 {
+fn resolveCompilationDir(module: *Module, buffer: *[std.fs.max_path_bytes]u8) []const u8 {
// We fully resolve all paths at this point to avoid lack of source line info in stack
// traces or lack of debugging information which, if relative paths were used, would
// be very location dependent.
@@ -2804,7 +2804,7 @@ fn genIncludeDirsAndFileNames(self: *Dwarf, arena: Allocator) !struct {
const dir_path = std.fs.path.dirname(full_path) orelse ".";
const sub_file_path = std.fs.path.basename(full_path);
// https://github.com/ziglang/zig/issues/19353
- var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
+ var buffer: [std.fs.max_path_bytes]u8 = undefined;
const resolved = if (!std.fs.path.isAbsolute(dir_path))
std.posix.realpath(dir_path, &buffer) catch dir_path
else
diff --git a/src/link/Elf.zig b/src/link/Elf.zig
index 770d483e98..491e137b60 100644
--- a/src/link/Elf.zig
+++ b/src/link/Elf.zig
@@ -1831,7 +1831,7 @@ fn parseLdScript(self: *Elf, lib: SystemLib) ParseError!void {
break :success;
}
} else {
- var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
+ var buffer: [fs.max_path_bytes]u8 = undefined;
if (fs.realpath(scr_obj.path, &buffer)) |path| {
test_path.clearRetainingCapacity();
try test_path.writer().writeAll(path);
@@ -3706,7 +3706,7 @@ fn sortInitFini(self: *Elf) !void {
}
const default: i32 = if (is_ctor_dtor) -1 else std.math.maxInt(i32);
const name = atom_ptr.name(self);
- var it = mem.splitBackwards(u8, name, ".");
+ var it = mem.splitBackwardsScalar(u8, name, '.');
const priority = std.fmt.parseUnsigned(u16, it.first(), 10) catch default;
break :blk priority;
};
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index 947a2665de..273c3d8c25 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -1230,7 +1230,7 @@ fn parseDependentDylibs(self: *MachO) !void {
const prefix = eatPrefix(rpath, "@loader_path/") orelse rpath;
const rel_path = try fs.path.join(arena, &.{ prefix, path });
try checked_paths.append(rel_path);
- var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
+ var buffer: [fs.max_path_bytes]u8 = undefined;
const full_path = fs.realpath(rel_path, &buffer) catch continue;
break :full_path try arena.dupe(u8, full_path);
}
@@ -1243,7 +1243,7 @@ fn parseDependentDylibs(self: *MachO) !void {
}
try checked_paths.append(try arena.dupe(u8, id.name));
- var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
+ var buffer: [fs.max_path_bytes]u8 = undefined;
if (fs.realpath(id.name, &buffer)) |full_path| {
break :full_path try arena.dupe(u8, full_path);
} else |_| {
diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig
index 226094e997..aa7fea7b6f 100644
--- a/src/link/MachO/Dylib.zig
+++ b/src/link/MachO/Dylib.zig
@@ -831,7 +831,7 @@ pub const Id = struct {
var out: u32 = 0;
var values: [3][]const u8 = undefined;
- var split = mem.split(u8, string, ".");
+ var split = mem.splitScalar(u8, string, '.');
var count: u4 = 0;
while (split.next()) |value| {
if (count > 2) {
diff --git a/src/link/Plan9.zig b/src/link/Plan9.zig
index 328d669b58..ec5278e62b 100644
--- a/src/link/Plan9.zig
+++ b/src/link/Plan9.zig
@@ -365,7 +365,7 @@ fn putFn(self: *Plan9, decl_index: InternPool.DeclIndex, out: FnDeclOutput) !voi
try a.writer().writeInt(u16, 1, .big);
// getting the full file path
- var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
+ var buf: [std.fs.max_path_bytes]u8 = undefined;
const full_path = try std.fs.path.join(arena, &.{
file.mod.root.root_dir.path orelse try std.posix.getcwd(&buf),
file.mod.root.sub_path,
diff --git a/src/link/Wasm/Archive.zig b/src/link/Wasm/Archive.zig
index a9acf2ca03..e069aeef8c 100644
--- a/src/link/Wasm/Archive.zig
+++ b/src/link/Wasm/Archive.zig
@@ -192,7 +192,7 @@ pub fn parseObject(archive: Archive, wasm_file: *const Wasm, file_offset: u32) !
const object_name = try archive.parseName(header);
const name = name: {
- var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
+ var buffer: [std.fs.max_path_bytes]u8 = undefined;
const path = try std.posix.realpath(archive.name, &buffer);
break :name try std.fmt.allocPrint(gpa, "{s}({s})", .{ path, object_name });
};