aboutsummaryrefslogtreecommitdiff
path: root/std/debug.zig
diff options
context:
space:
mode:
authorJosh Wolfe <thejoshwolfe@gmail.com>2017-04-23 16:59:55 -0700
committerJosh Wolfe <thejoshwolfe@gmail.com>2017-04-23 21:15:15 -0700
commitc6605cba8375871a145896f9cf1090e9c823214a (patch)
treef6309057804dc9fd6d5fa10feafb9d8f6a44a713 /std/debug.zig
parent6de33ded81981554ccffc3ecbfcd5b0f628cf502 (diff)
downloadzig-c6605cba8375871a145896f9cf1090e9c823214a.tar.gz
zig-c6605cba8375871a145896f9cf1090e9c823214a.zip
blocks check that their statements are void
closes #291 This changes the error message "return value ignored" to "expression value is ignored". This is because this error also applies to {1;}, which has no function calls. Also fix ignored expression values in std and test. This caught a bug in debug.readAllocBytes where an early Eof error would have been missed. See #219.
Diffstat (limited to 'std/debug.zig')
-rw-r--r--std/debug.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/std/debug.zig b/std/debug.zig
index a37f8749cf..45f7dcf091 100644
--- a/std/debug.zig
+++ b/std/debug.zig
@@ -217,7 +217,7 @@ fn getString(st: &ElfStackTrace, offset: u64) -> %[]u8 {
fn readAllocBytes(in_stream: &io.InStream, size: usize) -> %[]u8 {
const buf = %return global_allocator.alloc(u8, size);
%defer global_allocator.free(buf);
- %return in_stream.read(buf);
+ if (size < %return in_stream.read(buf)) return error.Eof;
return buf;
}