Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/compiler/aro/assembly_backend/x86_64.zig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn serializeFloat(comptime T: type, value: T, w: *std.Io.Writer) !void {
},
else => {
const size = @bitSizeOf(T);
const storage_unit = std.meta.intToEnum(StorageUnit, size) catch unreachable;
const storage_unit = std.enums.fromInt(StorageUnit, size).?;
const IntTy = @Type(.{ .int = .{ .signedness = .unsigned, .bits = size } });
const int_val: IntTy = @bitCast(value);
return serializeInt(int_val, storage_unit, w);
Expand Down Expand Up @@ -95,7 +95,7 @@ fn emitSingleValue(c: *AsmCodeGen, qt: QualType, node: Node.Index) !void {
if (!scalar_kind.isReal()) {
return c.todo("Codegen _Complex values", node.tok(c.tree));
} else if (scalar_kind.isInt()) {
const storage_unit = std.meta.intToEnum(StorageUnit, bit_size) catch return c.todo("Codegen _BitInt values", node.tok(c.tree));
const storage_unit = std.enums.fromInt(StorageUnit, bit_size) orelse return c.todo("Codegen _BitInt values", node.tok(c.tree));
try c.data.print(" .{s} ", .{@tagName(storage_unit)});
_ = try value.print(qt, c.comp, c.data);
try c.data.writeByte('\n');
Expand Down
9 changes: 0 additions & 9 deletions lib/compiler/reduce/Walk.zig
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,6 @@ fn walkExpression(w: *Walk, node: Ast.Node.Index) Error!void {
.@"asm",
=> return walkAsm(w, ast.fullAsm(node).?),

.asm_legacy => {
return walkAsmLegacy(w, ast.legacyAsm(node).?);
},

.enum_literal => {
return walkIdentifier(w, ast.nodeMainToken(node)); // name
},
Expand Down Expand Up @@ -881,11 +877,6 @@ fn walkAsm(w: *Walk, asm_node: Ast.full.Asm) Error!void {
try walkExpressions(w, asm_node.ast.items);
}

fn walkAsmLegacy(w: *Walk, asm_node: Ast.full.AsmLegacy) Error!void {
try walkExpression(w, asm_node.ast.template);
try walkExpressions(w, asm_node.ast.items);
}

/// Check if it is already gutted (i.e. its body replaced with `@trap()`).
fn isFnBodyGutted(ast: *const Ast, body_node: Ast.Node.Index) bool {
// skip over discards
Expand Down
2 changes: 0 additions & 2 deletions lib/docs/wasm/Walk.zig
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,6 @@ fn expr(w: *Walk, scope: *Scope, parent_decl: Decl.Index, node: Ast.Node.Index)
try expr(w, scope, parent_decl, full.ast.template);
},

.asm_legacy => {},

.builtin_call_two,
.builtin_call_two_comma,
.builtin_call,
Expand Down
2 changes: 1 addition & 1 deletion lib/docs/wasm/markdown.zig
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ fn mainImpl() !void {
var stdin_reader = std.fs.File.stdin().reader(&stdin_buffer);

while (stdin_reader.takeDelimiterExclusive('\n')) |line| {
const trimmed = std.mem.trimRight(u8, line, '\r');
const trimmed = std.mem.trimEnd(u8, line, '\r');
try parser.feedLine(trimmed);
} else |err| switch (err) {
error.EndOfStream => {},
Expand Down
137 changes: 2 additions & 135 deletions lib/std/Build/Step/Compile.zig
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ force_undefined_symbols: std.StringHashMap(void),
/// Overrides the default stack size
stack_size: ?u64 = null,

/// Deprecated; prefer using `lto`.
want_lto: ?bool = null,

use_llvm: ?bool,
use_lld: ?bool,
use_new_linker: ?bool,
Expand Down Expand Up @@ -539,7 +536,7 @@ pub fn installHeadersDirectory(
/// When a module links with this artifact, all headers marked for installation are added to that
/// module's include search path.
pub fn installConfigHeader(cs: *Compile, config_header: *Step.ConfigHeader) void {
cs.installHeader(config_header.getOutput(), config_header.include_path);
cs.installHeader(config_header.getOutputFile(), config_header.include_path);
}

/// Forwards all headers marked for installation from `lib` to this artifact.
Expand Down Expand Up @@ -682,18 +679,6 @@ pub fn producesImplib(compile: *Compile) bool {
return compile.isDll();
}

/// Deprecated; use `compile.root_module.link_libc = true` instead.
/// To be removed after 0.15.0 is tagged.
pub fn linkLibC(compile: *Compile) void {
compile.root_module.link_libc = true;
}

/// Deprecated; use `compile.root_module.link_libcpp = true` instead.
/// To be removed after 0.15.0 is tagged.
pub fn linkLibCpp(compile: *Compile) void {
compile.root_module.link_libcpp = true;
}

const PkgConfigResult = struct {
cflags: []const []const u8,
libs: []const []const u8,
Expand Down Expand Up @@ -807,46 +792,6 @@ fn runPkgConfig(compile: *Compile, lib_name: []const u8) !PkgConfigResult {
};
}

/// Deprecated; use `compile.root_module.linkSystemLibrary(name, .{})` instead.
/// To be removed after 0.15.0 is tagged.
pub fn linkSystemLibrary(compile: *Compile, name: []const u8) void {
return compile.root_module.linkSystemLibrary(name, .{});
}

/// Deprecated; use `compile.root_module.linkSystemLibrary(name, options)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn linkSystemLibrary2(
compile: *Compile,
name: []const u8,
options: Module.LinkSystemLibraryOptions,
) void {
return compile.root_module.linkSystemLibrary(name, options);
}

/// Deprecated; use `c.root_module.linkFramework(name, .{})` instead.
/// To be removed after 0.15.0 is tagged.
pub fn linkFramework(c: *Compile, name: []const u8) void {
c.root_module.linkFramework(name, .{});
}

/// Deprecated; use `compile.root_module.addCSourceFiles(options)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addCSourceFiles(compile: *Compile, options: Module.AddCSourceFilesOptions) void {
compile.root_module.addCSourceFiles(options);
}

/// Deprecated; use `compile.root_module.addCSourceFile(source)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addCSourceFile(compile: *Compile, source: Module.CSourceFile) void {
compile.root_module.addCSourceFile(source);
}

/// Deprecated; use `compile.root_module.addWin32ResourceFile(source)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addWin32ResourceFile(compile: *Compile, source: Module.RcSourceFile) void {
compile.root_module.addWin32ResourceFile(source);
}

pub fn setVerboseLink(compile: *Compile, value: bool) void {
compile.verbose_link = value;
}
Expand Down Expand Up @@ -928,84 +873,6 @@ pub fn getEmittedLlvmBc(compile: *Compile) LazyPath {
return compile.getEmittedFileGeneric(&compile.generated_llvm_bc);
}

/// Deprecated; use `compile.root_module.addAssemblyFile(source)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addAssemblyFile(compile: *Compile, source: LazyPath) void {
compile.root_module.addAssemblyFile(source);
}

/// Deprecated; use `compile.root_module.addObjectFile(source)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addObjectFile(compile: *Compile, source: LazyPath) void {
compile.root_module.addObjectFile(source);
}

/// Deprecated; use `compile.root_module.addObject(object)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addObject(compile: *Compile, object: *Compile) void {
compile.root_module.addObject(object);
}

/// Deprecated; use `compile.root_module.linkLibrary(library)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn linkLibrary(compile: *Compile, library: *Compile) void {
compile.root_module.linkLibrary(library);
}

/// Deprecated; use `compile.root_module.addAfterIncludePath(lazy_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addAfterIncludePath(compile: *Compile, lazy_path: LazyPath) void {
compile.root_module.addAfterIncludePath(lazy_path);
}

/// Deprecated; use `compile.root_module.addSystemIncludePath(lazy_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addSystemIncludePath(compile: *Compile, lazy_path: LazyPath) void {
compile.root_module.addSystemIncludePath(lazy_path);
}

/// Deprecated; use `compile.root_module.addIncludePath(lazy_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addIncludePath(compile: *Compile, lazy_path: LazyPath) void {
compile.root_module.addIncludePath(lazy_path);
}

/// Deprecated; use `compile.root_module.addConfigHeader(config_header)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addConfigHeader(compile: *Compile, config_header: *Step.ConfigHeader) void {
compile.root_module.addConfigHeader(config_header);
}

/// Deprecated; use `compile.root_module.addEmbedPath(lazy_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addEmbedPath(compile: *Compile, lazy_path: LazyPath) void {
compile.root_module.addEmbedPath(lazy_path);
}

/// Deprecated; use `compile.root_module.addLibraryPath(directory_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addLibraryPath(compile: *Compile, directory_path: LazyPath) void {
compile.root_module.addLibraryPath(directory_path);
}

/// Deprecated; use `compile.root_module.addRPath(directory_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addRPath(compile: *Compile, directory_path: LazyPath) void {
compile.root_module.addRPath(directory_path);
}

/// Deprecated; use `compile.root_module.addSystemFrameworkPath(directory_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addSystemFrameworkPath(compile: *Compile, directory_path: LazyPath) void {
compile.root_module.addSystemFrameworkPath(directory_path);
}

/// Deprecated; use `compile.root_module.addFrameworkPath(directory_path)` instead.
/// To be removed after 0.15.0 is tagged.
pub fn addFrameworkPath(compile: *Compile, directory_path: LazyPath) void {
compile.root_module.addFrameworkPath(directory_path);
}

pub fn setExecCmd(compile: *Compile, args: []const ?[]const u8) void {
const b = compile.step.owner;
assert(compile.kind == .@"test");
Expand Down Expand Up @@ -1758,7 +1625,7 @@ fn getZigArgs(compile: *Compile, fuzz: bool) ![][]const u8 {
.thin => "-flto=thin",
.none => "-fno-lto",
});
} else try addFlag(&zig_args, "lto", compile.want_lto);
}

try addFlag(&zig_args, "sanitize-coverage-trace-pc-guard", compile.sanitize_coverage_trace_pc_guard);

Expand Down
3 changes: 0 additions & 3 deletions lib/std/Build/Step/ConfigHeader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ pub fn getOutputFile(ch: *ConfigHeader) std.Build.LazyPath {
return ch.getOutputDir().path(ch.step.owner, ch.include_path);
}

/// Deprecated; use `getOutputFile`.
pub const getOutput = getOutputFile;

fn addValueInner(config_header: *ConfigHeader, name: []const u8, comptime T: type, value: T) !void {
switch (@typeInfo(T)) {
.null => {
Expand Down
5 changes: 0 additions & 5 deletions lib/std/Build/Step/Run.zig
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ skip_foreign_checks: bool,
/// external executor (such as qemu) but not fail if the executor is unavailable.
failing_to_execute_foreign_is_an_error: bool,

/// Deprecated in favor of `stdio_limit`.
max_stdio_size: usize,

/// If stderr or stdout exceeds this amount, the child process is killed and
/// the step fails.
stdio_limit: std.Io.Limit,
Expand Down Expand Up @@ -208,7 +205,6 @@ pub fn create(owner: *std.Build, name: []const u8) *Run {
.rename_step_with_output_arg = true,
.skip_foreign_checks = false,
.failing_to_execute_foreign_is_an_error = true,
.max_stdio_size = 10 * 1024 * 1024,
.stdio_limit = .unlimited,
.captured_stdout = null,
.captured_stderr = null,
Expand Down Expand Up @@ -2145,7 +2141,6 @@ fn evalGeneric(run: *Run, child: *std.process.Child) !EvalGenericResult {
var stdout_bytes: ?[]const u8 = null;
var stderr_bytes: ?[]const u8 = null;

run.stdio_limit = run.stdio_limit.min(.limited(run.max_stdio_size));
if (child.stdout) |stdout| {
if (child.stderr) |stderr| {
var poller = std.Io.poll(arena, enum { stdout, stderr }, .{
Expand Down
2 changes: 1 addition & 1 deletion lib/std/Io/Reader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ pub const TakeEnumError = Error || error{InvalidEnumTag};
pub fn takeEnum(r: *Reader, comptime Enum: type, endian: std.builtin.Endian) TakeEnumError!Enum {
const Tag = @typeInfo(Enum).@"enum".tag_type;
const int = try r.takeInt(Tag, endian);
return std.meta.intToEnum(Enum, int);
return std.enums.fromInt(Enum, int) orelse return error.InvalidEnumTag;
}

/// Reads an integer with the same size as the given nonexhaustive enum's tag type.
Expand Down
6 changes: 1 addition & 5 deletions lib/std/Io/Writer.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1201,10 +1201,6 @@ pub fn printValue(
}

const is_any = comptime std.mem.eql(u8, fmt, ANY);
if (!is_any and std.meta.hasMethod(T, "format") and fmt.len == 0) {
// after 0.15.0 is tagged, delete this compile error and its condition
@compileError("ambiguous format string; specify {f} to call format method, or {any} to skip it");
}

switch (@typeInfo(T)) {
.float, .comptime_float => {
Expand Down Expand Up @@ -1692,7 +1688,7 @@ pub fn printFloatHex(w: *Writer, value: anytype, case: std.fmt.Case, opt_precisi

try w.writeAll("0x");
try w.writeByte(buf[0]);
const trimmed = std.mem.trimRight(u8, buf[1..], "0");
const trimmed = std.mem.trimEnd(u8, buf[1..], "0");
if (opt_precision) |precision| {
if (precision > 0) try w.writeAll(".");
} else if (trimmed.len > 0) {
Expand Down
5 changes: 0 additions & 5 deletions lib/std/Io/tty.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ const process = std.process;
const windows = std.os.windows;
const native_os = builtin.os.tag;

/// Deprecated in favor of `Config.detect`.
pub fn detectConfig(file: File) Config {
return .detect(file);
}

pub const Color = enum {
black,
red,
Expand Down
2 changes: 1 addition & 1 deletion lib/std/crypto/tls/Client.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ fn readIndirect(c: *Client) Reader.Error!usize {
P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, pv.server_key) catch
return failRead(c, error.TlsBadRecordMac);
// TODO use scalar, non-slice version
const msg = mem.trimRight(u8, cleartext, "\x00");
const msg = mem.trimEnd(u8, cleartext, "\x00");
break :cleartext .{ msg.len - 1, @enumFromInt(msg[msg.len - 1]) };
},
.tls_1_2 => {
Expand Down
8 changes: 4 additions & 4 deletions lib/std/debug.zig
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,16 @@ pub fn dumpHex(bytes: []const u8) void {
}

/// Prints a hexadecimal view of the bytes, returning any error that occurs.
pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !void {
pub fn dumpHexFallible(bw: *Writer, tty_config: tty.Config, bytes: []const u8) !void {
var chunks = mem.window(u8, bytes, 16, 16);
while (chunks.next()) |window| {
// 1. Print the address.
const address = (@intFromPtr(bytes.ptr) + 0x10 * (std.math.divCeil(usize, chunks.index orelse bytes.len, 16) catch unreachable)) - 0x10;
try ttyconf.setColor(bw, .dim);
try tty_config.setColor(bw, .dim);
// We print the address in lowercase and the bytes in uppercase hexadecimal to distinguish them more.
// Also, make sure all lines are aligned by padding the address.
try bw.print("{x:0>[1]} ", .{ address, @sizeOf(usize) * 2 });
try ttyconf.setColor(bw, .reset);
try tty_config.setColor(bw, .reset);

// 2. Print the bytes.
for (window, 0..) |byte, index| {
Expand All @@ -357,7 +357,7 @@ pub fn dumpHexFallible(bw: *Writer, ttyconf: tty.Config, bytes: []const u8) !voi
try bw.writeByte(byte);
} else {
// Related: https://github.com/ziglang/zig/issues/7600
if (ttyconf == .windows_api) {
if (tty_config == .windows_api) {
try bw.writeByte('.');
continue;
}
Expand Down
Loading
Loading