| author | |
| committer | |
| log | afac5d28951cfd913851094649e8b9f2136694ca |
| tree | 85587c7cc735424cc4595c616d3c1a1c7ad3461e |
| parent | ead50ea6657d31632f5661f788b035a66c344d13 |
9 files changed, 58 insertions(+), 47 deletions(-)
src/Compilation.zig+10-5| ... | ... | @@ -772,7 +772,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 772 | 772 | if (build_options.is_stage1 and comp.bin_file.options.use_llvm) { |
| 773 | 773 | try comp.work_queue.writeItem(.{ .stage1_module = {} }); |
| 774 | 774 | } |
| 775 | if (is_exe_or_dyn_lib) { | |
| 775 | if (is_exe_or_dyn_lib and comp.bin_file.options.use_llvm) { | |
| 776 | 776 | try comp.work_queue.writeItem(.{ .libcompiler_rt = {} }); |
| 777 | 777 | if (!comp.bin_file.options.link_libc) { |
| 778 | 778 | try comp.work_queue.writeItem(.{ .zig_libc = {} }); |
| ... | ... | @@ -1128,6 +1128,9 @@ pub fn performAllTheWork(self: *Compilation) error{OutOfMemory}!void { |
| 1128 | 1128 | }; |
| 1129 | 1129 | }, |
| 1130 | 1130 | .stage1_module => { |
| 1131 | if (!build_options.is_stage1) | |
| 1132 | unreachable; | |
| 1133 | ||
| 1131 | 1134 | self.updateStage1Module() catch |err| { |
| 1132 | 1135 | fatal("unable to build stage1 zig object: {}", .{@errorName(err)}); |
| 1133 | 1136 | }; |
| ... | ... | @@ -1685,11 +1688,13 @@ pub fn classifyFileExt(filename: []const u8) FileExt { |
| 1685 | 1688 | test "classifyFileExt" { |
| 1686 | 1689 | std.testing.expectEqual(FileExt.cpp, classifyFileExt("foo.cc")); |
| 1687 | 1690 | std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.nim")); |
| 1688 | std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so")); | |
| 1689 | std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so.1")); | |
| 1690 | std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so.1.2")); | |
| 1691 | std.testing.expectEqual(FileExt.so, classifyFileExt("foo.so.1.2.3")); | |
| 1691 | std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so")); | |
| 1692 | std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1")); | |
| 1693 | std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2")); | |
| 1694 | std.testing.expectEqual(FileExt.shared_library, classifyFileExt("foo.so.1.2.3")); | |
| 1692 | 1695 | std.testing.expectEqual(FileExt.unknown, classifyFileExt("foo.so.1.2.3~")); |
| 1696 | std.testing.expectEqual(FileExt.zig, classifyFileExt("foo.zig")); | |
| 1697 | std.testing.expectEqual(FileExt.zir, classifyFileExt("foo.zir")); | |
| 1693 | 1698 | } |
| 1694 | 1699 | |
| 1695 | 1700 | fn haveFramePointer(comp: *Compilation) bool { |
src/stage1/stage2.h+1-1| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | 31 | // ABI warning: the types and declarations in this file must match both those in |
| 32 | // stage2.cpp and src-self-hosted/stage1.zig. | |
| 32 | // stage2.cpp and src/stage1.zig. | |
| 33 | 33 | |
| 34 | 34 | // ABI warning |
| 35 | 35 | enum Error { |
src/test.zig+10-4| ... | ... | @@ -458,9 +458,15 @@ pub const TestContext = struct { |
| 458 | 458 | .path = try std.fs.path.join(arena, &[_][]const u8{ bogus_path, "zig-cache" }), |
| 459 | 459 | }; |
| 460 | 460 | |
| 461 | const tmp_src_path = if (case.extension == .Zig) "test_case.zig" else if (case.extension == .ZIR) "test_case.zir" else unreachable; | |
| 462 | const root_pkg = try Package.create(allocator, tmp.dir, ".", tmp_src_path); | |
| 463 | defer root_pkg.destroy(allocator); | |
| 461 | const tmp_src_path = switch (case.extension) { | |
| 462 | .Zig => "test_case.zig", | |
| 463 | .ZIR => "test_case.zir", | |
| 464 | }; | |
| 465 | ||
| 466 | var root_pkg: Package = .{ | |
| 467 | .root_src_directory = .{ .path = bogus_path, .handle = tmp.dir }, | |
| 468 | .root_src_path = tmp_src_path, | |
| 469 | }; | |
| 464 | 470 | |
| 465 | 471 | const ofmt: ?std.builtin.ObjectFormat = if (case.cbe) .c else null; |
| 466 | 472 | const bin_name = try std.zig.binNameAlloc(arena, "test_case", target, case.output_mode, null, ofmt); |
| ... | ... | @@ -486,7 +492,7 @@ pub const TestContext = struct { |
| 486 | 492 | // TODO: support testing optimizations |
| 487 | 493 | .optimize_mode = .Debug, |
| 488 | 494 | .emit_bin = emit_bin, |
| 489 | .root_pkg = root_pkg, | |
| 495 | .root_pkg = &root_pkg, | |
| 490 | 496 | .keep_source_files_loaded = true, |
| 491 | 497 | .object_format = ofmt, |
| 492 | 498 | .is_native_os = case.target.isNativeOs(), |
src/windows_sdk.h+4-4| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | |
| 17 | 17 | #include <stddef.h> |
| 18 | 18 | |
| 19 | // ABI warning - src-self-hosted/windows_sdk.zig | |
| 19 | // ABI warning - src/windows_sdk.zig | |
| 20 | 20 | struct ZigWindowsSDK { |
| 21 | 21 | const char *path10_ptr; |
| 22 | 22 | size_t path10_len; |
| ... | ... | @@ -34,7 +34,7 @@ struct ZigWindowsSDK { |
| 34 | 34 | size_t msvc_lib_dir_len; |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | // ABI warning - src-self-hosted/windows_sdk.zig | |
| 37 | // ABI warning - src/windows_sdk.zig | |
| 38 | 38 | enum ZigFindWindowsSdkError { |
| 39 | 39 | ZigFindWindowsSdkErrorNone, |
| 40 | 40 | ZigFindWindowsSdkErrorOutOfMemory, |
| ... | ... | @@ -42,10 +42,10 @@ enum ZigFindWindowsSdkError { |
| 42 | 42 | ZigFindWindowsSdkErrorPathTooLong, |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | // ABI warning - src-self-hosted/windows_sdk.zig | |
| 45 | // ABI warning - src/windows_sdk.zig | |
| 46 | 46 | ZIG_EXTERN_C enum ZigFindWindowsSdkError zig_find_windows_sdk(struct ZigWindowsSDK **out_sdk); |
| 47 | 47 | |
| 48 | // ABI warning - src-self-hosted/windows_sdk.zig | |
| 48 | // ABI warning - src/windows_sdk.zig | |
| 49 | 49 | ZIG_EXTERN_C void zig_free_windows_sdk(struct ZigWindowsSDK *sdk); |
| 50 | 50 | |
| 51 | 51 | #endif |
src/zig_clang.h+1-1| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | |
| 15 | 15 | // ATTENTION: If you modify this file, be sure to update the corresponding |
| 16 | 16 | // extern function declarations in the self-hosted compiler file |
| 17 | // src-self-hosted/clang.zig. | |
| 17 | // src/clang.zig. | |
| 18 | 18 | |
| 19 | 19 | struct ZigClangSourceLocation { |
| 20 | 20 | unsigned ID; |
test/stage2/cbe.zig+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const TestContext = @import("../../src-self-hosted/test.zig").TestContext; | |
| 2 | const TestContext = @import("../../src/test.zig").TestContext; | |
| 3 | 3 | |
| 4 | 4 | // These tests should work with all platforms, but we're using linux_x64 for |
| 5 | 5 | // now for consistency. Will be expanded eventually. |
test/stage2/spu-ii.zig+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const TestContext = @import("../../src-self-hosted/test.zig").TestContext; | |
| 2 | const TestContext = @import("../../src/test.zig").TestContext; | |
| 3 | 3 | |
| 4 | 4 | const spu = std.zig.CrossTarget{ |
| 5 | 5 | .cpu_arch = .spu_2, |
test/stage2/test.zig+28-28| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const TestContext = @import("../../src-self-hosted/test.zig").TestContext; | |
| 2 | const TestContext = @import("../../src/test.zig").TestContext; | |
| 3 | 3 | |
| 4 | 4 | // Self-hosted has differing levels of support for various architectures. For now we pass explicit |
| 5 | 5 | // target parameters to each test case. At some point we will take this to the next level and have |
| ... | ... | @@ -76,7 +76,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 76 | 76 | \\ ); |
| 77 | 77 | \\ unreachable; |
| 78 | 78 | \\} |
| 79 | , | |
| 79 | , | |
| 80 | 80 | "Hello, World!\n", |
| 81 | 81 | ); |
| 82 | 82 | // Now change the message only |
| ... | ... | @@ -108,7 +108,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 108 | 108 | \\ ); |
| 109 | 109 | \\ unreachable; |
| 110 | 110 | \\} |
| 111 | , | |
| 111 | , | |
| 112 | 112 | "What is up? This is a longer message that will force the data to be relocated in virtual address space.\n", |
| 113 | 113 | ); |
| 114 | 114 | // Now we print it twice. |
| ... | ... | @@ -184,7 +184,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 184 | 184 | \\ ); |
| 185 | 185 | \\ unreachable; |
| 186 | 186 | \\} |
| 187 | , | |
| 187 | , | |
| 188 | 188 | "Hello, World!\n", |
| 189 | 189 | ); |
| 190 | 190 | } |
| ... | ... | @@ -219,7 +219,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 219 | 219 | \\ ); |
| 220 | 220 | \\ unreachable; |
| 221 | 221 | \\} |
| 222 | , | |
| 222 | , | |
| 223 | 223 | "Hello, World!\n", |
| 224 | 224 | ); |
| 225 | 225 | } |
| ... | ... | @@ -244,7 +244,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 244 | 244 | \\ ); |
| 245 | 245 | \\ unreachable; |
| 246 | 246 | \\} |
| 247 | , | |
| 247 | , | |
| 248 | 248 | "Hello, World!\n", |
| 249 | 249 | ); |
| 250 | 250 | } |
| ... | ... | @@ -271,7 +271,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 271 | 271 | \\ ); |
| 272 | 272 | \\ unreachable; |
| 273 | 273 | \\} |
| 274 | , | |
| 274 | , | |
| 275 | 275 | "", |
| 276 | 276 | ); |
| 277 | 277 | } |
| ... | ... | @@ -298,7 +298,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 298 | 298 | \\ ); |
| 299 | 299 | \\ unreachable; |
| 300 | 300 | \\} |
| 301 | , | |
| 301 | , | |
| 302 | 302 | "", |
| 303 | 303 | ); |
| 304 | 304 | } |
| ... | ... | @@ -329,7 +329,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 329 | 329 | \\ ); |
| 330 | 330 | \\ unreachable; |
| 331 | 331 | \\} |
| 332 | , | |
| 332 | , | |
| 333 | 333 | "", |
| 334 | 334 | ); |
| 335 | 335 | |
| ... | ... | @@ -362,7 +362,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 362 | 362 | \\ ); |
| 363 | 363 | \\ unreachable; |
| 364 | 364 | \\} |
| 365 | , | |
| 365 | , | |
| 366 | 366 | "", |
| 367 | 367 | ); |
| 368 | 368 | |
| ... | ... | @@ -398,7 +398,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 398 | 398 | \\ ); |
| 399 | 399 | \\ unreachable; |
| 400 | 400 | \\} |
| 401 | , | |
| 401 | , | |
| 402 | 402 | "", |
| 403 | 403 | ); |
| 404 | 404 | |
| ... | ... | @@ -435,7 +435,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 435 | 435 | \\ ); |
| 436 | 436 | \\ unreachable; |
| 437 | 437 | \\} |
| 438 | , | |
| 438 | , | |
| 439 | 439 | "", |
| 440 | 440 | ); |
| 441 | 441 | |
| ... | ... | @@ -465,7 +465,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 465 | 465 | \\ ); |
| 466 | 466 | \\ unreachable; |
| 467 | 467 | \\} |
| 468 | , | |
| 468 | , | |
| 469 | 469 | "", |
| 470 | 470 | ); |
| 471 | 471 | |
| ... | ... | @@ -499,7 +499,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 499 | 499 | \\ ); |
| 500 | 500 | \\ unreachable; |
| 501 | 501 | \\} |
| 502 | , | |
| 502 | , | |
| 503 | 503 | "", |
| 504 | 504 | ); |
| 505 | 505 | |
| ... | ... | @@ -523,7 +523,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 523 | 523 | \\ ); |
| 524 | 524 | \\ unreachable; |
| 525 | 525 | \\} |
| 526 | , | |
| 526 | , | |
| 527 | 527 | "", |
| 528 | 528 | ); |
| 529 | 529 | |
| ... | ... | @@ -562,7 +562,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 562 | 562 | \\ ); |
| 563 | 563 | \\ unreachable; |
| 564 | 564 | \\} |
| 565 | , | |
| 565 | , | |
| 566 | 566 | "hello\nhello\nhello\nhello\n", |
| 567 | 567 | ); |
| 568 | 568 | |
| ... | ... | @@ -599,7 +599,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 599 | 599 | \\ ); |
| 600 | 600 | \\ unreachable; |
| 601 | 601 | \\} |
| 602 | , | |
| 602 | , | |
| 603 | 603 | "", |
| 604 | 604 | ); |
| 605 | 605 | |
| ... | ... | @@ -641,7 +641,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 641 | 641 | \\ ); |
| 642 | 642 | \\ unreachable; |
| 643 | 643 | \\} |
| 644 | , | |
| 644 | , | |
| 645 | 645 | "", |
| 646 | 646 | ); |
| 647 | 647 | |
| ... | ... | @@ -693,7 +693,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 693 | 693 | \\ ); |
| 694 | 694 | \\ unreachable; |
| 695 | 695 | \\} |
| 696 | , | |
| 696 | , | |
| 697 | 697 | "", |
| 698 | 698 | ); |
| 699 | 699 | |
| ... | ... | @@ -755,7 +755,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 755 | 755 | \\ ); |
| 756 | 756 | \\ unreachable; |
| 757 | 757 | \\} |
| 758 | , | |
| 758 | , | |
| 759 | 759 | "", |
| 760 | 760 | ); |
| 761 | 761 | |
| ... | ... | @@ -788,7 +788,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 788 | 788 | \\ ); |
| 789 | 789 | \\ unreachable; |
| 790 | 790 | \\} |
| 791 | , | |
| 791 | , | |
| 792 | 792 | "", |
| 793 | 793 | ); |
| 794 | 794 | |
| ... | ... | @@ -820,7 +820,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 820 | 820 | \\ ); |
| 821 | 821 | \\ unreachable; |
| 822 | 822 | \\} |
| 823 | , | |
| 823 | , | |
| 824 | 824 | "", |
| 825 | 825 | ); |
| 826 | 826 | |
| ... | ... | @@ -845,7 +845,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 845 | 845 | \\ ); |
| 846 | 846 | \\ unreachable; |
| 847 | 847 | \\} |
| 848 | , | |
| 848 | , | |
| 849 | 849 | "", |
| 850 | 850 | ); |
| 851 | 851 | |
| ... | ... | @@ -871,7 +871,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 871 | 871 | \\ ); |
| 872 | 872 | \\ unreachable; |
| 873 | 873 | \\} |
| 874 | , | |
| 874 | , | |
| 875 | 875 | "", |
| 876 | 876 | ); |
| 877 | 877 | |
| ... | ... | @@ -904,7 +904,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 904 | 904 | \\ ); |
| 905 | 905 | \\ unreachable; |
| 906 | 906 | \\} |
| 907 | , | |
| 907 | , | |
| 908 | 908 | "hello\nhello\nhello\nhello\nhello\n", |
| 909 | 909 | ); |
| 910 | 910 | } |
| ... | ... | @@ -923,7 +923,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 923 | 923 | \\ bar(); |
| 924 | 924 | \\} |
| 925 | 925 | \\fn bar() void {} |
| 926 | , | |
| 926 | , | |
| 927 | 927 | "42\n", |
| 928 | 928 | ); |
| 929 | 929 | |
| ... | ... | @@ -941,7 +941,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 941 | 941 | \\ bar(); |
| 942 | 942 | \\} |
| 943 | 943 | \\fn bar() void {} |
| 944 | , | |
| 944 | , | |
| 945 | 945 | "42\n", |
| 946 | 946 | ); |
| 947 | 947 | |
| ... | ... | @@ -957,7 +957,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 957 | 957 | \\ bar(); |
| 958 | 958 | \\} |
| 959 | 959 | \\fn bar() void {} |
| 960 | , | |
| 960 | , | |
| 961 | 961 | // This is what you get when you take the bits of the IEE-754 |
| 962 | 962 | // representation of 42.0 and reinterpret them as an unsigned |
| 963 | 963 | // integer. Guess that's a bug in wasmtime. |
test/stage2/zir.zig+2-2| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const TestContext = @import("../../src-self-hosted/test.zig").TestContext; | |
| 2 | const TestContext = @import("../../src/test.zig").TestContext; | |
| 3 | 3 | // self-hosted does not yet support PE executable files / COFF object files |
| 4 | 4 | // or mach-o files. So we do the ZIR transform test cases cross compiling for |
| 5 | 5 | // x86_64-linux. |
| ... | ... | @@ -156,7 +156,7 @@ pub fn addCases(ctx: *TestContext) !void { |
| 156 | 156 | \\ %0 = call(@a, []) |
| 157 | 157 | \\ %1 = returnvoid() |
| 158 | 158 | \\}) |
| 159 | , | |
| 159 | , | |
| 160 | 160 | &[_][]const u8{ |
| 161 | 161 | ":18:21: error: message", |
| 162 | 162 | }, |