diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-08-30 14:50:33 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-08-31 12:49:18 -0700 |
| commit | 150169f1e0cf08d4b76fed81fc205a63177b6e01 (patch) | |
| tree | c39318b34c361a9a5a8ddaa1aae80cba1fe27f0c /src/codegen | |
| parent | ab99dd9c5d22a3d927453081654b1f75b2521b48 (diff) | |
| download | zig-150169f1e0cf08d4b76fed81fc205a63177b6e01.tar.gz zig-150169f1e0cf08d4b76fed81fc205a63177b6e01.zip | |
std.fmt: delete deprecated APIs
std.fmt.Formatter -> std.fmt.Alt
std.fmt.format -> std.Io.Writer.print
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/c.zig | 20 | ||||
| -rw-r--r-- | src/codegen/c/Type.zig | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index b2ecac5d10..4468fa600f 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -371,11 +371,11 @@ fn formatIdentOptions(ident: []const u8, w: *Writer, solo: bool) Writer.Error!vo } } -pub fn fmtIdentSolo(ident: []const u8) std.fmt.Formatter([]const u8, formatIdentSolo) { +pub fn fmtIdentSolo(ident: []const u8) std.fmt.Alt([]const u8, formatIdentSolo) { return .{ .data = ident }; } -pub fn fmtIdentUnsolo(ident: []const u8) std.fmt.Formatter([]const u8, formatIdentUnsolo) { +pub fn fmtIdentUnsolo(ident: []const u8) std.fmt.Alt([]const u8, formatIdentUnsolo) { return .{ .data = ident }; } @@ -394,7 +394,7 @@ pub fn fmtCTypePoolString( ctype_pool_string: CType.Pool.String, ctype_pool: *const CType.Pool, solo: bool, -) std.fmt.Formatter(CTypePoolStringFormatData, formatCTypePoolString) { +) std.fmt.Alt(CTypePoolStringFormatData, formatCTypePoolString) { return .{ .data = .{ .ctype_pool_string = ctype_pool_string, .ctype_pool = ctype_pool, @@ -610,11 +610,11 @@ pub const Function = struct { return f.object.dg.renderIntCast(w, dest_ty, .{ .c_value = .{ .f = f, .value = src, .v = v } }, src_ty, location); } - fn fmtIntLiteralDec(f: *Function, val: Value) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + fn fmtIntLiteralDec(f: *Function, val: Value) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return f.object.dg.fmtIntLiteralDec(val, .Other); } - fn fmtIntLiteralHex(f: *Function, val: Value) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + fn fmtIntLiteralHex(f: *Function, val: Value) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return f.object.dg.fmtIntLiteralHex(val, .Other); } @@ -1919,7 +1919,7 @@ pub const DeclGen = struct { kind: CType.Kind, name: union(enum) { nav: InternPool.Nav.Index, - fmt_ctype_pool_string: std.fmt.Formatter(CTypePoolStringFormatData, formatCTypePoolString), + fmt_ctype_pool_string: std.fmt.Alt(CTypePoolStringFormatData, formatCTypePoolString), @"export": struct { main_name: InternPool.NullTerminatedString, extern_name: InternPool.NullTerminatedString, @@ -2439,7 +2439,7 @@ pub const DeclGen = struct { loc: ValueRenderLocation, base: u8, case: std.fmt.Case, - ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { const zcu = dg.pt.zcu; const kind = loc.toCTypeKind(); const ty = val.typeOf(zcu); @@ -2461,7 +2461,7 @@ pub const DeclGen = struct { dg: *DeclGen, val: Value, loc: ValueRenderLocation, - ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return fmtIntLiteral(dg, val, loc, 10, .lower); } @@ -2469,7 +2469,7 @@ pub const DeclGen = struct { dg: *DeclGen, val: Value, loc: ValueRenderLocation, - ) !std.fmt.Formatter(FormatIntLiteralContext, formatIntLiteral) { + ) !std.fmt.Alt(FormatIntLiteralContext, formatIntLiteral) { return fmtIntLiteral(dg, val, loc, 16, .lower); } }; @@ -8295,7 +8295,7 @@ fn formatStringLiteral(data: FormatStringContext, w: *Writer) Writer.Error!void try literal.end(); } -fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Formatter(FormatStringContext, formatStringLiteral) { +fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Alt(FormatStringContext, formatStringLiteral) { return .{ .data = .{ .str = str, .sentinel = sentinel } }; } diff --git a/src/codegen/c/Type.zig b/src/codegen/c/Type.zig index d270e1dc9c..fa4db36a0c 100644 --- a/src/codegen/c/Type.zig +++ b/src/codegen/c/Type.zig @@ -989,7 +989,7 @@ pub const Pool = struct { else try writer.print("f{d}", .{@intFromEnum(data.string.index)}); } - pub fn fmt(str: String, pool: *const Pool) std.fmt.Formatter(FormatData, format) { + pub fn fmt(str: String, pool: *const Pool) std.fmt.Alt(FormatData, format) { return .{ .data = .{ .string = str, .pool = pool } }; } |
