From 4a132d4bce75aa9d81b5af0e8c2180ce1e0a3c60 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Thu, 22 Aug 2024 13:10:44 -0400 Subject: [PATCH] Type: fix inconsistency between `zig fmt` and `@typeName` --- ci/x86_64-linux-debug.sh | 2 +- ci/x86_64-linux-release.sh | 2 +- src/Type.zig | 2 +- test/src/Debugger.zig | 36 ++++++++++++++++++------------------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ci/x86_64-linux-debug.sh b/ci/x86_64-linux-debug.sh index 04431ba960..f4a4e0e13b 100755 --- a/ci/x86_64-linux-debug.sh +++ b/ci/x86_64-linux-debug.sh @@ -64,7 +64,7 @@ stage3-debug/bin/zig build \ stage3-debug/bin/zig build test docs \ --maxrss 21000000000 \ - -Dlldb=$HOME/deps/lldb-zig/Debug-f96d3e6fc/bin/lldb \ + -Dlldb=$HOME/deps/lldb-zig/Debug-62538077d/bin/lldb \ -fqemu \ -fwasmtime \ -Dstatic-llvm \ diff --git a/ci/x86_64-linux-release.sh b/ci/x86_64-linux-release.sh index 57f17bdc76..f9ebad2ade 100755 --- a/ci/x86_64-linux-release.sh +++ b/ci/x86_64-linux-release.sh @@ -64,7 +64,7 @@ stage3-release/bin/zig build \ stage3-release/bin/zig build test docs \ --maxrss 21000000000 \ - -Dlldb=$HOME/deps/lldb-zig/Release-f96d3e6fc/bin/lldb \ + -Dlldb=$HOME/deps/lldb-zig/Release-62538077d/bin/lldb \ -fqemu \ -fwasmtime \ -Dstatic-llvm \ diff --git a/src/Type.zig b/src/Type.zig index 0a37e5a6f5..4437722f7d 100644 --- a/src/Type.zig +++ b/src/Type.zig @@ -202,6 +202,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error .C => try writer.writeAll("[*c]"), .Slice => try writer.writeAll("[]"), } + if (info.flags.is_allowzero and info.flags.size != .C) try writer.writeAll("allowzero "); if (info.flags.alignment != .none or info.packed_offset.host_size != 0 or info.flags.vector_index != .none) @@ -229,7 +230,6 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error } if (info.flags.is_const) try writer.writeAll("const "); if (info.flags.is_volatile) try writer.writeAll("volatile "); - if (info.flags.is_allowzero and info.flags.size != .C) try writer.writeAll("allowzero "); try print(Type.fromInterned(info.child), writer, pt); return; diff --git a/test/src/Debugger.zig b/test/src/Debugger.zig index 4f2c82a56b..718d89dd1c 100644 --- a/test/src/Debugger.zig +++ b/test/src/Debugger.zig @@ -205,26 +205,26 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { \\ single_volatile: *volatile u32 = @ptrFromInt(0x1018), \\ single_const_volatile: *const volatile u32 = @ptrFromInt(0x101c), \\ single_allowzero: *allowzero u32 = @ptrFromInt(0x1020), - \\ single_const_allowzero: *const allowzero u32 = @ptrFromInt(0x1024), - \\ single_volatile_allowzero: *volatile allowzero u32 = @ptrFromInt(0x1028), - \\ single_const_volatile_allowzero: *const volatile allowzero u32 = @ptrFromInt(0x102c), + \\ single_allowzero_const: *allowzero const u32 = @ptrFromInt(0x1024), + \\ single_allowzero_volatile: *allowzero volatile u32 = @ptrFromInt(0x1028), + \\ single_allowzero_const_volatile: *allowzero const volatile u32 = @ptrFromInt(0x102c), \\ \\ many: [*]u32 = @ptrFromInt(0x2010), \\ many_const: [*]const u32 = @ptrFromInt(0x2014), \\ many_volatile: [*]volatile u32 = @ptrFromInt(0x2018), \\ many_const_volatile: [*]const volatile u32 = @ptrFromInt(0x201c), \\ many_allowzero: [*]allowzero u32 = @ptrFromInt(0x2020), - \\ many_const_allowzero: [*]const allowzero u32 = @ptrFromInt(0x2024), - \\ many_volatile_allowzero: [*]volatile allowzero u32 = @ptrFromInt(0x2028), - \\ many_const_volatile_allowzero: [*]const volatile allowzero u32 = @ptrFromInt(0x202c), + \\ many_allowzero_const: [*]allowzero const u32 = @ptrFromInt(0x2024), + \\ many_allowzero_volatile: [*]allowzero volatile u32 = @ptrFromInt(0x2028), + \\ many_allowzero_const_volatile: [*]allowzero const volatile u32 = @ptrFromInt(0x202c), \\ slice: []u32 = array[0..1], \\ slice_const: []const u32 = array[0..2], \\ slice_volatile: []volatile u32 = array[0..3], \\ slice_const_volatile: []const volatile u32 = array[0..4], \\ slice_allowzero: []allowzero u32 = array[4..4], - \\ slice_const_allowzero: []const allowzero u32 = array[4..5], - \\ slice_volatile_allowzero: []volatile allowzero u32 = array[4..6], - \\ slice_const_volatile_allowzero: []const volatile allowzero u32 = array[4..7], + \\ slice_allowzero_const: []allowzero const u32 = array[4..5], + \\ slice_allowzero_volatile: []allowzero volatile u32 = array[4..6], + \\ slice_allowzero_const_volatile: []allowzero const volatile u32 = array[4..7], \\ \\ c: [*c]u32 = @ptrFromInt(0x4010), \\ c_const: [*c]const u32 = @ptrFromInt(0x4014), @@ -254,17 +254,17 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { \\ (*volatile u32) single_volatile = 0x0000000000001018 \\ (*const volatile u32) single_const_volatile = 0x000000000000101c \\ (*allowzero u32) single_allowzero = 0x0000000000001020 - \\ (*const allowzero u32) single_const_allowzero = 0x0000000000001024 - \\ (*volatile allowzero u32) single_volatile_allowzero = 0x0000000000001028 - \\ (*const volatile allowzero u32) single_const_volatile_allowzero = 0x000000000000102c + \\ (*allowzero const u32) single_allowzero_const = 0x0000000000001024 + \\ (*allowzero volatile u32) single_allowzero_volatile = 0x0000000000001028 + \\ (*allowzero const volatile u32) single_allowzero_const_volatile = 0x000000000000102c \\ ([*]u32) many = 0x0000000000002010 \\ ([*]const u32) many_const = 0x0000000000002014 \\ ([*]volatile u32) many_volatile = 0x0000000000002018 \\ ([*]const volatile u32) many_const_volatile = 0x000000000000201c \\ ([*]allowzero u32) many_allowzero = 0x0000000000002020 - \\ ([*]const allowzero u32) many_const_allowzero = 0x0000000000002024 - \\ ([*]volatile allowzero u32) many_volatile_allowzero = 0x0000000000002028 - \\ ([*]const volatile allowzero u32) many_const_volatile_allowzero = 0x000000000000202c + \\ ([*]allowzero const u32) many_allowzero_const = 0x0000000000002024 + \\ ([*]allowzero volatile u32) many_allowzero_volatile = 0x0000000000002028 + \\ ([*]allowzero const volatile u32) many_allowzero_const_volatile = 0x000000000000202c \\ ([]u32) slice = len=1 { \\ (u32) [0] = 3010 \\ } @@ -284,14 +284,14 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { \\ (u32) [3] = 3022 \\ } \\ ([]allowzero u32) slice_allowzero = len=0 {} - \\ ([]const allowzero u32) slice_const_allowzero = len=1 { + \\ ([]allowzero const u32) slice_allowzero_const = len=1 { \\ (u32) [0] = 3026 \\ } - \\ ([]volatile allowzero u32) slice_volatile_allowzero = len=2 { + \\ ([]allowzero volatile u32) slice_allowzero_volatile = len=2 { \\ (u32) [0] = 3026 \\ (u32) [1] = 3030 \\ } - \\ ([]const volatile allowzero u32) slice_const_volatile_allowzero = len=3 { + \\ ([]allowzero const volatile u32) slice_allowzero_const_volatile = len=3 { \\ (u32) [0] = 3026 \\ (u32) [1] = 3030 \\ (u32) [2] = 3034