commit 3d9b6cfcc9341cef40a8a525a4acf8be8b81992c (tree)
parent 56129d26ebd8c54563e92a78b9dab20f69dbc646
Author: Andrew Kelley <andrew@ziglang.org>
Date: Thu, 25 Aug 2022 16:17:00 -0700
stage2: add an explicit padding field to avoid Valgrind warning
Adds a `unused: u32 = 0` field to `Zir.Header`.
We could leave this as padding, however it triggers a Valgrind warning because
we read and write undefined bytes to the file system. This is harmless, but
it's essentially free to have a zero field here and makes the warning go away,
making it more likely that following Valgrind warnings will be taken seriously.
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/Zir.zig b/src/Zir.zig
@@ -43,7 +43,11 @@ pub const Header = extern struct {
instructions_len: u32,
string_bytes_len: u32,
extra_len: u32,
-
+ /// We could leave this as padding, however it triggers a Valgrind warning because
+ /// we read and write undefined bytes to the file system. This is harmless, but
+ /// it's essentially free to have a zero field here and makes the warning go away,
+ /// making it more likely that following Valgrind warnings will be taken seriously.
+ unused: u32 = 0,
stat_inode: std.fs.File.INode,
stat_size: u64,
stat_mtime: i128,