0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/lib/std
Andrew Kelley 8ce880ca75 avoid calling into stage1 backend when AstGen fails
The motivation for this commit is that there exists source files which
produce ast-check errors, but crash stage1 or otherwise trigger stage1
bugs. Previously to this commit, Zig would run AstGen, collect the
compile errors, run stage1, report stage1 compile errors and exit if
any, and then report AstGen compile errors.

The main change in this commit is to report AstGen errors prior to
invoking stage1, and in fact if any AstGen errors occur, do not invoke
stage1 at all.

This caused most of the compile error tests to fail due to things such
as unused local variables and mismatched stage1/stage2 error messages.
It was taking a long time to update the test cases one-by-one, so I
took this opportunity to unify the stage1 and stage2 testing harness,
specifically with regards to compile errors. In this way we can start
keeping track of which tests pass for 1, 2, or both.
`zig build test-compile-errors` no longer works; it is now integrated
into `zig build test-stage2`.

This is one step closer to executing compile error tests in parallel; in
fact the ThreadPool object is already in scope.

There are some cases where the stage1 compile errors were actually
better; those are left failing in this commit, to be addressed in a
follow-up commit.

Other changes in this commit:

 * build.zig: improve support for -Dstage1 used with the test step.
 * AstGen: minor cosmetic changes to error messages.
 * stage2: add -fstage1 and -fno-stage1 flags. This now allows one to
   download a binary of the zig compiler and use the llvm backend of
   self-hosted. This was also needed for hooking up the test harness.
   However, I realized that stage1 calls exit() and also has memory
   leaks, so had to complicate the test harness by not using this flag
   after all and instead invoking as a child process.
   - These CLI flags will disappear once we start shipping the
     self-hosted compiler as the main compiler. Until then, they can be
     used to try out the work-in-progress stage2.
 * stage2: select the LLVM backend by default for release modes, as long
   as the target architecture is supported by LLVM.
 * test harness: support setting the optimize mode
History 2021-07-02 13:27:28 -07:00
..
atomic fix code broken from previous commit 2021-06-21 17:03:03 -07:00
build fix code broken from previous commit 2021-06-21 17:03:03 -07:00
c std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
compress std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
crypto std.crypto.p256: fix neg function compile error 2021-06-21 17:03:03 -07:00
event nice error for unsupported async sockets on Windows 2021-06-23 12:54:20 +03:00
fmt std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
fs std.fs.File: update doc comments regarding locking 2021-06-29 14:25:04 -07:00
hash fix code broken from previous commit 2021-06-21 17:03:03 -07:00
heap fix code broken from previous commit 2021-06-21 17:03:03 -07:00
io fix code broken from previous commit 2021-06-21 17:03:03 -07:00
json std/json: Fix premature closing brace being considered valid JSON 2021-05-13 11:11:28 +02:00
math fix code broken from previous commit 2021-06-21 17:03:03 -07:00
mem fix code broken from previous commit 2021-06-21 17:03:03 -07:00
meta std.TrailerFlags: remove superfluous parameter 2021-06-21 17:03:03 -07:00
net std: update usage of std.testing 2021-05-08 15:15:30 +03:00
os std/os/uefi: fix packed struct bitfields 2021-06-30 09:28:08 +03:00
rand std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
special std/build: add --sysroot general option 2021-06-25 19:13:43 +02:00
target Fix lakemont CpuModel (#9099) 2021-06-17 16:37:38 -04:00
testing Year++ 2020-12-31 15:45:24 -08:00
Thread fix code broken from previous commit 2021-06-21 17:03:03 -07:00
time Year++ 2020-12-31 15:45:24 -08:00
unicode std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
valgrind Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
x fix code broken from previous commit 2021-06-21 17:03:03 -07:00
zig avoid calling into stage1 backend when AstGen fails 2021-07-02 13:27:28 -07:00
array_hash_map.zig std: ArrayHashMap remove unused parameter 2021-06-21 17:03:03 -07:00
array_list.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
ascii.zig add allocation free versions of lower/upper string 2021-06-08 14:27:44 -04:00
atomic.zig os/bits: remove duplicate sockaddr_storage for dragonfly 2021-06-01 18:35:13 +09:00
base64.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
bit_set.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
buf_map.zig Breaking hash map changes for 0.8.0 2021-06-03 17:02:16 -05:00
buf_set.zig Breaking hash map changes for 0.8.0 2021-06-03 17:02:16 -05:00
build.zig std/build: add --sysroot general option 2021-06-25 19:13:43 +02:00
builtin.zig Add support for WASI reactor in pure Zig-exe. (#9178) 2021-06-30 20:02:48 -04:00
c.zig netbsd: add more std.os.bits 2021-06-16 14:46:25 -04:00
child_process.zig finish ChildProcess collectOutputWindows 2021-06-18 08:26:22 -06:00
coff.zig Add support for reading DWARF debug information from COFF files 2021-06-18 16:19:20 -07:00
compress.zig std: Update test "" to test where it makes sense 2021-01-22 15:46:58 +01:00
comptime_string_map.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
crypto.zig std: update usage of std.testing 2021-05-08 15:15:30 +03:00
cstr.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
debug.zig fix unused locals from merge conflict 2021-06-21 17:09:22 -07:00
dwarf.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
dwarf_bits.zig Year++ 2020-12-31 15:45:24 -08:00
dynamic_library.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
elf.zig Add fat/universal dylib support to zig ld 2021-06-25 08:38:47 +02:00
enums.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
event.zig Year++ 2020-12-31 15:45:24 -08:00
fifo.zig std: update usage of std.testing 2021-05-08 15:15:30 +03:00
fmt.zig std/fmt: add fmtDurationSigned 2021-06-27 12:54:31 +03:00
fs.zig std: implement a cross platform file locking abstraction 2021-06-29 14:25:04 -07:00
hash.zig Year++ 2020-12-31 15:45:24 -08:00
hash_map.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
heap.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
io.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
json.zig std: Catch and handle overflow in json parser 2021-07-01 22:35:19 +03:00
leb128.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
linked_list.zig std: fix code unblocked by previous commit 2021-06-21 17:03:03 -07:00
log.zig add compile error if root.log is not a function 2021-06-22 16:38:18 +03:00
macho.zig Add fat/universal dylib support to zig ld 2021-06-25 08:38:47 +02:00
math.zig zig fmt 2021-06-10 20:13:43 -07:00
mem.zig Add fat/universal dylib support to zig ld 2021-06-25 08:38:47 +02:00
meta.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
multi_array_list.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
net.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
once.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
os.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
packed_int_array.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
pdb.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
priority_dequeue.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
priority_queue.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
process.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
Progress.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
rand.zig Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen 2021-05-08 14:45:21 -07:00
SemanticVersion.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
sort.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
start.zig fix start code for WebAssembly 2021-06-30 18:39:04 -07:00
start_windows_tls.zig move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
std.zig x, x/os/Socket: initial work on new Socket abstraction 2021-04-25 21:15:02 +09:00
target.zig fix code broken from previous commit 2021-06-21 17:03:03 -07:00
testing.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
Thread.zig std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
time.zig std: update usage of std.testing 2021-05-08 15:15:30 +03:00
unicode.zig move "unreachable code" error from stage1 to stage2 2021-07-02 13:26:50 -07:00
valgrind.zig std: update regarding std.builtin reorganization 2021-05-17 16:08:09 -07:00
wasm.zig std: update usage of std.testing 2021-05-08 15:15:30 +03:00
x.zig x/io, x/os: async i/o reactor, cross-platform socket syscalls and bits 2021-06-01 18:22:57 +09:00
zig.zig Export isValidId, remove pub on unexported functions 2021-06-26 09:59:40 +03:00