* remove deprecated `std.fs.Dir` APIs
* `std.fs.Dir.openDir` now takes a options struct with bool fields for
`access_sub_paths` and `iterate`. It's now much more clear how
opening directories works.
* fixed the std lib and various zig code calling the wrong openDir
function.
* the runtime safety check for dir flags is removed in favor of the
cheaper option of putting a comment on the same line as handling
EBADF / ACCESS_DENIED, since that will show up in stack traces.
closes#4682
The self-hosted compiler is still bit rotted and still not compiling
successfully yet. I have a more serious rework of the code in a
different branch.
* re-introduce `std.build.Target` which is distinct from `std.Target`.
`std.build.Target` wraps `std.Target` so that it can be annotated as
"the native target" or an explicitly specified target.
* `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
struct which has the tag as well as version range information.
* `std.elf` gains some more ELF header constants.
* `std.Target.parse` gains the ability to parse operating system
version ranges as well as glibc version.
* Added `std.Target.isGnuLibC()`.
* self-hosted dynamic linker detection and glibc version detection.
This also adds the improved logic using `/usr/bin/env` rather than
invoking the system C compiler to find the dynamic linker when zig
is statically linked. Related: #2084
Note: this `/usr/bin/env` code is work-in-progress.
* `-target-glibc` CLI option is removed in favor of the new `-target`
syntax. Example: `-target x86_64-linux-gnu.2.27`
closes#1907
1. behavior tests with --test-evented-io
2. std lib tests with --test-evented-io
3. fuzz test evented I/O a bit, make it robust
4. make sure it works on all platforms (kqueue, Windows IOCP,
epoll/other)
5. restart efforts on self-hosted
* Implements #3768. This is a sweeping breaking change that requires
many (trivial) edits to Zig source code. Array values no longer
coerced to slices; however one may use `&` to obtain a reference to
an array value, which may then be coerced to a slice.
* Adds `IrInstruction::dump`, for debugging purposes. It's useful to
call to inspect the instruction when debugging Zig IR.
* Fixes bugs with result location semantics. See the new behavior test
cases, and compile error test cases.
* Fixes bugs with `@typeInfo` not properly resolving const values.
* Behavior tests are passing but std lib tests are not yet. There
is more work to do before merging this branch.
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
This modifies the build process of Zig to put all of the source files
into libcompiler.a, except main.cpp and userland.cpp.
Next, the build process links main.cpp, userland.cpp, and libcompiler.a
into zig1. userland.cpp is a shim for functions that will later be
replaced with self-hosted implementations.
Next, the build process uses zig1 to build src-self-hosted/stage1.zig
into libuserland.a, which does not depend on any of the things that
are shimmed in userland.cpp, such as translate-c.
Finally, the build process re-links main.cpp and libcompiler.a, except
with libuserland.a instead of userland.cpp. Now the shims are replaced
with .zig code. This provides all of the Zig standard library to the
stage1 C++ compiler, and enables us to move certain things to userland,
such as translate-c.
As a proof of concept I have made the `zig zen` command use text defined
in userland. I added `zig translate-c-2` which is a work-in-progress
reimplementation of translate-c in userland, which currently calls
`std.debug.panic("unimplemented")` and you can see the stack trace makes
it all the way back into the C++ main() function (Thanks LemonBoy for
improving that!).
This could potentially let us move other things into userland, such as
hashing algorithms, the entire cache system, .d file parsing, pretty
much anything that libuserland.a itself doesn't need to depend on.
This can also let us have `zig fmt` in stage1 without the overhead
of child process execution, and without the initial compilation delay
before it gets cached.
See #1964
* CLI: `-target [name]` instead of `--target-*` args.
This matches clang's API.
* `builtin.Environ` renamed to `builtin.Abi`
- likewise `builtin.environ` renamed to `builtin.abi`
* stop hiding the concept of sub-arch. closes#1526
* `zig targets` only shows available targets. closes#438
* include all targets in readme, even those that don't
print with `zig targets` but note they are Tier 4
* refactor target.cpp and make the naming conventions
more consistent
* introduce the concept of a "default C ABI" for a given
OS/Arch combo. As a rule of thumb, if the system compiler
is clang or gcc then the default C ABI is the gnu ABI.