authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-11 15:06:20-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-11 15:06:20-05:00
logca180d3f02914d282505752a1d2fe08e175f9d99
tree07205165370989989e32b2db75eb943dea24556f
parentf7173f4f081bdc200732cc9f7d58d3d54f9b0205

std.io.parseUnsigned buf parameter is const

fixes padding in printf See #258

3 files changed, 4 insertions(+), 4 deletions(-)

src/analyze.cpp+1-1
...@@ -3302,7 +3302,7 @@ bool ir_get_var_is_comptime(VariableTableEntry *var) {...@@ -3302,7 +3302,7 @@ bool ir_get_var_is_comptime(VariableTableEntry *var) {
3302}3302}
33033303
3304bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {3304bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
3305 assert(a->type == b->type);3305 assert(a->type->id == b->type->id);
3306 assert(a->special == ConstValSpecialStatic);3306 assert(a->special == ConstValSpecialStatic);
3307 assert(b->special == ConstValSpecialStatic);3307 assert(b->special == ConstValSpecialStatic);
3308 switch (a->type->id) {3308 switch (a->type->id) {
std/io.zig+1-1
...@@ -469,7 +469,7 @@ pub const InStream = struct {...@@ -469,7 +469,7 @@ pub const InStream = struct {
469 }469 }
470};470};
471471
472pub fn parseUnsigned(comptime T: type, buf: []u8, radix: u8) -> %T {472pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) -> %T {
473 var x: T = 0;473 var x: T = 0;
474474
475 for (buf) |c| {475 for (buf) |c| {
test/run_tests.cpp+2-2
...@@ -319,9 +319,9 @@ pub const b_text = a_text;...@@ -319,9 +319,9 @@ pub const b_text = a_text;
319const io = @import("std").io;319const io = @import("std").io;
320320
321pub fn main(args: [][]u8) -> %void {321pub fn main(args: [][]u8) -> %void {
322 %%io.stdout.printf("Hello, world!\n");322 %%io.stdout.printf("Hello, world!\n{d4} {x3}\n", u32(12), u16(0x12));
323}323}
324 )SOURCE", "Hello, world!\n");324 )SOURCE", "Hello, world!\n0012 012\n");
325325
326326
327 add_simple_case_libc("number literals", R"SOURCE(327 add_simple_case_libc("number literals", R"SOURCE(