From cb46d0b5b0d1d83856adab34b461049f5cfac019 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 11 Jan 2016 20:43:48 -0700 Subject: [PATCH] fix not adding builtin functions code --- README.md | 8 ++++---- src/codegen.cpp | 3 +-- test/run_tests.cpp | 19 +++++-------------- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 4d4b0ad25c..47bf4beb4e 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,10 @@ compromises backward compatibility. ### Current Status * Have a look in the examples/ folder to see some code examples. - * Some language features available such as loops, inline assembly, expressions, - literals, functions, importing other files. - * Only Linux x86_64 is supported. - * Only building for the native target is supported. + * Basic language features available such as loops, inline assembly, + expressions, literals, functions, importing, structs, enums. + * Linux x86_64 is supported. + * Building for the native target is supported. * Optimized machine code that Zig produces is indistinguishable from optimized machine code produced from equivalent C program. * Zig can generate dynamic libraries, executables, object files, and C diff --git a/src/codegen.cpp b/src/codegen.cpp index 3f5daa21d3..cd6d43d661 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2748,8 +2748,7 @@ void codegen_add_root_code(CodeGen *g, Buf *src_dir, Buf *src_basename, Buf *sou g->bootstrap_import = add_special_code(g, "bootstrap.zig"); } - // TODO re-enable this - //add_special_code(g, "builtin.zig"); + add_special_code(g, "builtin.zig"); } if (g->verbose) { diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 6955b6c0e3..445433a863 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1033,19 +1033,6 @@ fn print_ok(val: #typeof(x)) -> #typeof(foo) { const foo : i32 = 0; )SOURCE", "OK\n"); - add_simple_case("enum with void types", R"SOURCE( -use "std.zig"; -enum Foo { A, B, C, D, } -pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 { - const foo : Foo = Foo.B; - if (foo != Foo.B) { - print_str("BAD\n"); - } - print_str("OK\n"); - return 0; -} - )SOURCE", "OK\n"); - add_simple_case("enum type", R"SOURCE( use "std.zig"; @@ -1070,7 +1057,11 @@ enum Bar { pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 { const foo1 = Foo.One(13); const foo2 = Foo.Two(Point { .x = 1234, .y = 5678, }); - const bar = Bar.A; + const bar = Bar.B; + + if (bar != Bar.B) { + print_str("BAD\n"); + } if (#value_count(Foo) != 3) { print_str("BAD\n");