* 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.
* fix libc prototypes of offsets to have correct integer sizes and
signedness. This gets all behavior tests to pass for
armv8-linux-musleabihf
* fix linux mmap syscall to have correct integer size and signedness
for offset
* disable failing armv8-linux-musleabihf std lib tests. See 3289. I
suspect compiler-rt issue. Note these tests fail with this target
triple regardless of whether musl is actually linked (-lc).
* add zig build option `-Dskip-libc` to skip tests that build libc
(e.g. if you don't want to wait for musl to build)
* add `-Denable-wine` option which uses wine to run cross compiled
windows tests on non-windows hosts
* add `-Denable-qemu` option which uses qemu to run cross compiled
foreign architecture tests
* add `-Denable-foreign-glibc=path` option which combined with
`-Denable-qemu` enables running cross compiled tests that link
against glibc. See
https://github.com/ziglang/zig/wiki/Updating-libc#glibc for how to
produce this directory.
* the test matrix is done manually. release test builds are only
enabled by default for the native target. this should save us some CI
time, while still providing decent coverage of release builds.
- add test coverage for `x86_64-linux-musl -lc` (building musl libc)
- add test coverage for `x86_64-linux-gnu -lc` (building glibc)
- add test coverage for `aarch64v8_5a-linux-none`
- add test coverage for `aarch64v8_5a-linux-musl -lc` (building musl libc)
- add test coverage for `aarch64v8_5a-linux-gnu -lc` (building glibc)
- add test coverage for `arm-linux-none`
- test coverage for `arm-linux-musleabihf -lc` (building musl libc) is
disabled due to #3286
- test coverage for `arm-linux-gnueabihf -lc` (building glibc) is disabled
due to #3287
- test coverage for `x86_64-windows-gnu -lc` (building mingw-w64) is
disabled due to #3285
* enable qemu testing on the Linux CI job. There's not really a good
reason to enable wine, since we have a Windows CI job as well.
* remove the no longer needed `--build-file ../build.zig` from CI
scripts
* fix bug in glibc compilation where it wasn't properly reading the abi
list txt files, resulting in "key not found" error.
* std.build.Target gains:
- isNetBSD
- isLinux
- osRequiresLibC
- getArchPtrBitWidth
- getExternalExecutor
* zig build system gains support for enabling wine and enabling qemu.
`artifact.enable_wine = true;`, `artifact.enable_qemu = true;`. This
communicates that the system has these tools installed and the build
system will use them to run tests.
* zig build system gains support for overriding the dynamic linker of
an executable artifact.
* fix std.c.lseek prototype. makes behavior tests for
arm-linux-musleabihf pass.
* disable std lib tests that are failing on ARM. See #3288, #3289
* provide `std.os.off_t`.
* disable some of the compiler_rt symbols for arm 32 bit. Fixes
compiler_rt tests for arm 32 bit
* add __stack_chk_guard when linking against glibc. Fixes std lib tests
for aarch64-linux-gnu
* workaround for "unable to inline function" using `@inlineCall`. Fixes
compiler_rt tests for arm 32 bit.
- include native-target when native-target ∉ cross_targets
old behavior:
- do nothing when `-Dskip-non-native`
- never execute pkg tests for non-members of cross_targets
`zig build test-compare-panic`
Create basic tests to compare panic output. The address field
is replaced by a symbolic constant and each expected output is
specific to os. Tests will only run for explicitly defined
platforms.
see also #2485
* fix crash when doing field access of slice types. closes#2486
* remove the deprecated Child property from slice types
* add -Dskip-non-native build option to build script
stage1 translate-c actually has this wrong. When exporting a function,
it's ok to use empty parameters. But for prototypes, "no prototype"
means that it has to be emitted as a function that accepts anything,
e.g. extern fn foo(...) void;
See #1964
Before, allocator implementations had to provide `allocFn`,
`reallocFn`, and `freeFn`.
Now, they must provide only `reallocFn` and `shrinkFn`.
Reallocating from a zero length slice is allocation, and
shrinking to a zero length slice is freeing.
When the new memory size is less than or equal to the
previous allocation size, `reallocFn` now has the option
to return `error.OutOfMemory` to indicate that the allocator
would not be able to take advantage of the new size.
For more details see #1306. This commit closes#1306.
This commit paves the way to solving #2009.
This commit also introduces a memory leak to all coroutines.
There is an issue where a coroutine calls the function and it
frees its own stack frame, but then the return value of `shrinkFn`
is a slice, which is implemented as an sret struct. Writing to
the return pointer causes invalid memory write. We could work
around it by having a global helper function which has a void
return type and calling that instead. But instead this hack will
suffice until I rework coroutines to be non-allocating. Basically
coroutines are not supported right now until they are reworked as
in #1194.
* in Zig build scripts, getOutputPath() is no longer a valid function
to call, unless setOutputDir() was used, or within a custom make()
function. Instead there is more convenient API to use which takes
advantage of the caching system. Search this commit diff for
`exe.run()` for an example.
* Zig build by default enables caching. All build artifacts will go
into zig-cache. If you want to access build artifacts in a convenient
location, it is recommended to add an `install` step. Otherwise
you can use the `run()` API mentioned above to execute programs
directly from their location in the cache. Closes#330.
`addSystemCommand` is available for programs not built with Zig
build.
* Please note that Zig does no cache evicting yet. You may have to
manually delete zig-cache directories periodically to keep disk
usage down. It's planned for this to be a simple Least Recently
Used eviction system eventually.
* `--output`, `--output-lib`, and `--output-h` are removed. Instead,
use `--output-dir` which defaults to the current working directory.
Or take advantage of `--cache on`, which will print the main output
path to stdout, and the other artifacts will be in the same directory
with predictable file names. `--disable-gen-h` is available when
one wants to prevent .h file generation.
* `@cImport` is always independently cached now. Closes#2015.
It always writes the generated Zig code to disk which makes debug
info and compile errors better. No more "TODO: remember C source
location to display here"
* Fix .d file parsing. (Fixes the MacOS CI failure)
* Zig no longer creates "temporary files" other than inside a
zig-cache directory.
This breaks the CLI API that Godbolt uses. The suggested new invocation
can be found in this commit diff, in the changes to `test/cli.zig`.
* 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.