Commit Graph

16148 Commits

Author SHA1 Message Date
Marc Tiehuis
149444723f std/math: Add test cases for #9901
Closes #9901.
Closes #9902.
2021-12-06 01:02:09 +13:00
Marc Tiehuis
e24398361d std/math: replace golang sin/cos/tan with musl sin/cos/tan 2021-12-06 01:02:09 +13:00
Michael Dusan
a1b79ea585 ci: linux: pass VERSION on_master_success
Cache the VERSION value for use with linux_on_mster_success.
This replaces 117c0460d3 .
2021-12-05 00:31:59 -08:00
Andrew Kelley
f7cbd92e6c Revert "Merge pull request #10270 from Luukdegram/behaviour-tests"
This reverts commit 725267f7c2, reversing
changes made to 2dae860de3.

This test is failing:

```zig
pub fn main() u8 {
    var e = foo();
    const i = e catch 69;
    return i;
}

fn foo() anyerror!u8 {
    return 5;
}
```

It's returning 69 instead of the expected value 5.
2021-12-04 21:55:50 -07:00
Michael Dusan
117c0460d3 ci: linux: pass VERSION on_master_success 2021-12-04 20:28:26 -08:00
joachimschmidt557
2f18c5955a stage2 ARM: Implement calling with stack parameters 2021-12-04 18:16:23 -08:00
Andrew Kelley
725267f7c2
Merge pull request #10270 from Luukdegram/behaviour-tests
Stage2: Initial behavior tests succeeding
2021-12-04 18:16:05 -08:00
Zapolsky Anton
2dae860de3
Added an explicit type for the termios constants (#10266)
Adds the `tcflag_t` type to the termios constants.
This is made to allow bitwise operations on the termios
constants without an integer cast, e.g.:

```zig
var raw = try std.os.tcgetattr(std.os.STDIN_FILENO);
raw.lflag &= std.os.linux.ECHO | std.os.linux.ICANON;
```
instead of

```zig
var raw = try std.os.tcgetattr(std.os.STDIN_FILENO);
raw.lflag &= ~@intCast(u32, std.os.linux.ECHO | std.os.linux.ICANON);
```

Contributes to #10181
2021-12-04 16:24:55 -05:00
matu3ba
282e2c714f
compiler_rt: add __ffssi2, __ffsdi2 and __ffsti2 (#10268)
See #1290
2021-12-04 16:23:33 -05:00
Andrew Kelley
daa3e0bbb4 ci: fix update-download-page and remove bashism 2021-12-04 14:20:46 -07:00
Luuk de Gram
74a5f4d848
wasm: Initial behavior tests succeeding
Note: This also fixes a memory leak for inferred error sets, and for usingnamespace
2021-12-04 21:17:17 +01:00
Luuk de Gram
b7fe958f44
wasm: Implement slice as return type and argument 2021-12-04 19:22:08 +01:00
Luuk de Gram
52fb044669
wasm: Implement trunc, fix sliceLen and write undefined 2021-12-04 19:22:08 +01:00
Luuk de Gram
96a4692f94
wasm: Correctly load slice value on stack 2021-12-04 19:22:08 +01:00
Luuk de Gram
1777fb25bc
wasm: Implement WrapErrorUnionErr(payload) 2021-12-04 19:22:07 +01:00
Andrew Kelley
e81fda9823 ci: make the on_master_success script fail on missing args 2021-12-03 20:34:54 -07:00
Michael Byrne
7e2fae10c9
Add documentation for sentinel-terminated slicing (#10010)
closes #9680
2021-12-03 20:37:48 -05:00
Andrew Kelley
2a0adef583
Merge pull request #9910 from mikdusan/dragonfly
dragonfly: port Thread.setname/getname
2021-12-03 17:29:55 -08:00
Andrew Kelley
36b6e95aa3
Merge pull request #9927 from vrischmann/fix-rlimit-resource
Fix rlimit_resource for MIPS and SPARC
2021-12-03 16:45:55 -08:00
Jakub Dupak
bb75f5d297 9944: make allocator the first argument (excl. self) 2021-12-03 16:42:59 -08:00
N00byEdge
9354ad8278 Add single section dumping and padding to InstallRawStep 2021-12-03 16:42:02 -08:00
Andrew Kelley
3311ef3262
Merge pull request #10006 from akovaski/riscv-default-abi
Default target-abi based on RISC-V extensions and user selectable -mabi/target-abi
2021-12-03 16:37:56 -08:00
Andrew Kelley
4c1a62326b stage2: use Target.Abi instead of introducing Target.TargetAbi
This branch introduced std.Target.TargetAbi when we already had
std.Target.Abi which was, unsurprisingly, already suited for this task.

Also pull out the -mabi= cc flag addition to the common area instead of
duplicating it for assembly and c files.
2021-12-03 17:33:20 -07:00
vole-dev
9ede943e07 turn off LTO by default for RISCV even in Release mode 2021-12-03 16:53:33 -07:00
vole-dev
ff38f56040 default mabi based on RISC-V extensions and -mabi build option
The target abi can also be set in build.zig via LibExeObjStep.target_abi

The value passed in is checked that it is a valid value in
std.Target.TargetAbi

The target abi is also validated against the target cpu
2021-12-03 16:53:33 -07:00
Andrew Kelley
84704ef43e stage1: LLVM code for @tagName not emitting null byte
Thanks LemonBoy for the patch.
2021-12-03 16:50:20 -07:00
Andrew Kelley
77fc9090d5 update CONTRIBUTING.md for zig build CLI changes 2021-12-03 16:17:40 -07:00
Jonathan Marler
7659229edc std.build.InstallRawStep: allow custom dest_dir
I'm working on a build.zig file where I'm leveraging InstallRawStep but I'd like to change the install dir.  This allows the install dir to be changd and also enhances InstallRawStep to add more options in the future by putting them into a struct with default values.  This also removes the need for an extra addInstallStepWithFormat function in build.zig.
2021-12-03 12:56:49 -08:00
Andrew Kelley
1cac99c90a
Merge pull request #10265 from ziglang/zig-build-executors
improve detection of how to execute binaries on the host
2021-12-03 02:33:56 -08:00
Andrew Kelley
dfa8ab1dc9 std.os.execve: handle EBADEXEC and EBADARCH
Observed on aarch64-macos when trying to execute an x86_64-macos
binary.
2021-12-02 21:24:37 -08:00
Andrew Kelley
f3edff439e improve detection of how to execute binaries on the host
`getExternalExecutor` is moved from `std.zig.CrossTarget` to
`std.zig.system.NativeTargetInfo.getExternalExecutor`.

The function also now communicates a bit more information about *why*
the host is unable to execute a binary. The CLI is updated to report
this information in a useful manner.

`getExternalExecutor` is also improved to detect such patterns as:
 * x86_64 is able to execute x86 binaries
 * aarch64 is able to execute arm binaries
 * etc.

Added qemu-hexagon support to `getExternalExecutor`.

`std.Target.canExecBinaries` of is removed; callers should use the more
powerful `getExternalExecutor` instead.

Now that `zig test` tries to run the resulting binary no matter what,
this commit has a follow-up change to the build system and docgen to
utilize the `getExternalExecutor` function and pass `--test-no-exec`
in some cases to avoid getting the error.

Additionally:

 * refactor: extract NativePaths and NativeTargetInfo into their own
   files named after the structs.
 * small improvement to langref to reduce the complexity of the `callconv`
   expression in a couple examples.
2021-12-02 21:51:14 -07:00
Andrew Kelley
0cd8710222 CLI: always try to exec binaries
Previously when using `zig run` or `zig test`, zig would try to guess
whether the host system was capable of running the target binaries. Now,
it will always try. If it fails, then Zig emits a helpful warning to
explain the probable cause.
2021-12-02 17:40:51 -07:00
Andrew Kelley
b24cbecdb2 zig build: promote qemu, wine, wasmtime, darling, and rosetta
from zig-specific options to generally recognized zig build options that
any project can take advantage of. See the updated usage text for more
details.
2021-12-02 15:46:22 -07:00
Andrew Kelley
cbd653e1d6 AstGen: expr-evaluate asm template expressions
See previous commit 1912ec0323 for more
context.

closes #10262
2021-12-02 14:35:35 -07:00
Ali Chraghi
005e869abd update function name in error 2021-12-02 12:35:17 -08:00
Matthew Borkowski
c98b020ce2 parse.zig: make chained comparison operators a parse error 2021-12-02 11:59:29 -08:00
Lee Cannon
fb9fcf5632 allocator: Move vtable into gen struct 2021-12-02 11:56:32 -08:00
Andrew Kelley
14b532ec85
Merge pull request #10122 from ziglang/x86_64-as-native-rosetta
Treat x86_64 tests as native under the Rosetta 2 on M1 Macs
2021-12-01 17:32:27 -08:00
Andrew Kelley
42db515665 disable failing @mulAdd behavior test for aarch64-macos
See #9900
2021-12-01 17:30:41 -08:00
Jakub Konka
cf4423bb33 Remove .disable_native for x86_64-macos as it's fixed now
Add `aarch64-macos-gnu` corresponding test case.

Fix rebase gone wrong.
2021-12-02 00:32:56 +01:00
Andrew Kelley
1912ec0323 AstGen: use null string to communicate non-string-literal asm
dd62a6d2e8 short-circuited the logic of
`asmExpr` by emitting ZIR for `@compileError("...")`. This caused false
positive "unreachable code" errors for stage1 when there was an
expression in the asm template.

This commit makes such cases instead go through logic of `asmExpr` like
normal, however the asm template is set to 0. This is then picked up in
Sema (part of stage2, not stage1) and reported as "assembly code must
use string literal syntax".
2021-12-01 16:24:44 -07:00
Jakub Konka
852841fd1f Make Rosetta availability declarative by the user
Like QEMU or Wine, you need to declare you want Rosetta
enabled for running tests/build artifacts via `-Denable-rosetta`
flag.
2021-12-02 00:22:09 +01:00
Jakub Konka
3e2f8233a8 Make Rosetta a new variant in ExternalExecutor enum
When running, check if Rosetta is available, otherwise, pass the
tests.
2021-12-02 00:22:09 +01:00
Jakub Konka
77c5208c77 Treat x86_64 tests as native under the Rosetta 2 on M1 Macs 2021-12-02 00:22:05 +01:00
Hiroaki Nakamura
0714832c21 Fix test for io_uring link_timeout
The old test "timeout_link_chain1" was ported from liburing test_timeout_link_chain1
509873c445/test/link-timeout.c (L539-L628)
However it turns out that both fails with EBADF (-9) on Linux kernel 5.4.

The this new test skips properly on Linux kernel 5.4
and passes on Linux kernel 5.11.
2021-12-01 14:30:33 -08:00
Andrew Kelley
70dcdcb73d std: remove double free in GPA
Merge conflict between
02a1f838e6
and
885c73f343
2021-12-01 15:19:29 -07:00
Jan Philipp Hafer
e4c053f047 compiler_rt: add __paritysi2, __paritydi2, __parityti2
- use Bit Twiddling Hacks: Compute parity in parallel
- test cases derived from popcount.zig
- tests: compare naive approach 10_000 times with random numbers created
  from naive seed 42
- compiler_rt.zig: sort by LLVM builtin order and add comments to improve structure

See #1290
2021-12-01 13:35:19 -08:00
Matthew Borkowski
02a1f838e6 gpa: fix leak in freeLarge and memory limit accounting in resize and resizeLarge 2021-12-01 13:34:53 -08:00
Andrew Kelley
8c36243136
Merge pull request #10254 from leecannon/allocgate-perf
Allocgate: fixups
2021-12-01 02:40:00 -08:00
Lee Cannon
67ec6e73fb
allocgate: use correct allocator in populateTestFunctions 2021-12-01 10:24:03 +00:00