20262 Commits

Author SHA1 Message Date
Koakuma
0464512f2e stage2: sparc64: Implement airShlWithOverflow 2022-09-14 16:57:31 -07:00
Koakuma
de17fe66a5 stage2: sparc64: Tidy up binOp and enable more operations
sub, mul, addwrap, subwrap, mulwrap, shr, shr_exact
2022-09-14 16:57:31 -07:00
Koakuma
ab3d3b260b stage2: sparc64: Add airClz/airCtz placeholder 2022-09-14 16:57:31 -07:00
Koakuma
b9897c3b84 stage2: sparc64: Implement airMulOverflow for <= 32 bits 2022-09-14 16:57:31 -07:00
Koakuma
844d3a5a74 stage2: sparc64: Fix SPARCv9 shift opcodes encoding 2022-09-14 16:57:31 -07:00
Koakuma
2263bba6cd stage2: sparc64: Skip Sema-failing tests for now 2022-09-14 16:57:31 -07:00
Koakuma
61265fba04 stage2: sparc64: Implement airBinop for bool_and/or 2022-09-14 16:57:31 -07:00
Koakuma
4fc6df9f62 stage2: sparc64: Implement airTagName 2022-09-14 16:57:31 -07:00
Koakuma
f01867f78e stage2: sparc64: Implement airWrapOptional 2022-09-14 16:57:31 -07:00
Koakuma
b6307144c0 stage2: sparc64: Implement airPtrToInt 2022-09-14 16:57:31 -07:00
Koakuma
2c9ab03b0b stage2: sparc64: Add airCmpLtErrorsLen placeholder 2022-09-14 16:57:31 -07:00
Koakuma
5b0134e3ed stage2: sparc64: Change branch_link Mir field definition 2022-09-14 16:57:31 -07:00
Koakuma
64b61f0740 stage2: sparc64: Add airFloatToInt & airIntToFloat placeholder 2022-09-14 16:57:31 -07:00
Andrew Kelley
17596c79a9 stage2: fix compile error merge conflict
3250b20ceabea044bd4c7b1653d76d7069840058 had a silent merge conflict
with master branch; fixed now.
2022-09-14 16:41:53 -07:00
Jan Philipp Hafer
8cab0762d8 place zig-cache directory next to build.zig
* search upwards, if no build.zig is found
* if this fails or any error occurs, fallback to global zig-cache

Closes #11672
2022-09-14 19:39:25 -04:00
Manlio Perillo
3250b20cea src/print_env: print the native target
Add the native target triple to the zig env command output.

The target triple is formatted the same way as it is done in the
zig targets command.
2022-09-14 19:28:47 -04:00
Andrew Kelley
1d041d3a10
Merge pull request #11664 from vincenzopalazzo/macros/docs
docs: add missed docs for some language feature like `defer` and `errdefer`
2022-09-14 19:26:28 -04:00
Andrew Kelley
0931dda9a9
Merge pull request #11663 from matu3ba/utf16
std.unicode: add utf16 byte length and codepoints counting routines
2022-09-14 19:25:15 -04:00
Andrew Kelley
d7a0fe67b3 disable spuriously failing test on Windows
See tracking issue #12844
2022-09-14 16:12:55 -07:00
Andrew Kelley
d834b18011
Merge pull request #11633 from SpexGuy
Remove `std.testing.zig_exe_path` in favor of `ZIG_EXE` environment variable
2022-09-14 18:02:21 -04:00
Andrew Kelley
85b10eb07c ZIG_EXE envirnoment variable instead of testing build options
No longer introduce build options for tests. Instead, ZIG_EXE
environment variable is added to any invocation of `zig run` or `zig
test`.

The end result of this branch is the same: there is no longer a
mandatory positional command line argument when invoking zig test
binaries directly.
2022-09-14 14:56:45 -07:00
Martin Wickham
5523e2061b Move std.testing.zig_exe_path into build options 2022-09-14 14:42:58 -07:00
Andrew Kelley
61aaef0b07 std: re-enable test case for fixed bug
The miscompilation in question has been fixed upstream in LLVM 14.

closes #9879
2022-09-13 18:36:39 -07:00
Andrew Kelley
68f2d6cb24 std: remove workaround for fixed bug
The miscompilation in question has been fixed upstream in LLVM 13.

closes #8117
2022-09-13 18:20:18 -07:00
Andrew Kelley
0a89624d59 stage2: support being built in ReleaseSafe mode 2022-09-13 18:08:59 -07:00
Veikka Tuominen
349d78a443 validate number literals in AstGen 2022-09-13 20:26:04 -04:00
Andrew Kelley
716d9237cb Merge remote-tracking branch 'origin/llvm15'
Upgrade to LLVM 15
2022-09-13 15:39:19 -07:00
Andrew Kelley
fda6d44778 zig cc: do not enable the cache for link operations
This commit makes `zig cc` match the equivalent behavior of
`zig build-exe` with regards to caching. That is - it will cache
individual .c to .o compilations (with the usual exceptions), but will
always repeat the linking process so that incremental linking has a
chance to happen.

Perhaps a future enhancement will provide a way to get the old behavior,
but I suspect this new behavior will be preferred by everyone, because
it is closer to what C compilers do. Note that the old behavior can be
obtained by switching to `zig build-exe` instead of `zig cc` and using
the `--enable-cache` parameter.

Closes #12317
2022-09-13 14:10:13 -07:00
Andrew Kelley
0a4cfb81bc Merge remote-tracking branch 'origin/master' into llvm15 2022-09-13 13:50:25 -07:00
Andrew Kelley
f9859c102d fix libc++ exceptions for musl targets
This reverts commit d31be31267523cadd6d59b52633f2d4a9758a3b4.

The problem was happening due to an LLVM bug exposed by having LTO
enabled for libunwind. The simple workaround is to disable LTO for
libunwind. It can be re-enabled in the future when the upstream bug
is fixed.

See #12828
2022-09-13 11:38:14 -07:00
Andrew Kelley
c25ce5bba0
Merge pull request #12820 from ziglang/pointless-discard-error
introduce compile error for pointless discards
2022-09-13 13:01:42 -04:00
Andrew Kelley
b2e94de358 add compile error test for pointless discards 2022-09-13 10:01:17 -07:00
Luuk de Gram
be94487029
Merge pull request #12823 from Luukdegram/wasm-linker
wasm-linker: misc improvements & cleanups
2022-09-13 17:42:51 +02:00
Andrew Kelley
cdb40936bd properly annotate nullability of ZigLLVMCreateDebugForwardDeclType
This bug manifested as a segfault in stage1 when calling this function.
The C++ code looks like this:

```c++
entry->llvm_di_type = ZigLLVMCreateDebugForwardDeclType(g->dbuilder,
    ZigLLVMTag_DW_structure_type(), full_name,
    import ? ZigLLVMFileToScope(import->data.structure.root_struct->di_file) : nullptr,
    import ? import->data.structure.root_struct->di_file : nullptr,
    line);
```

There is actually no problem here - what happened is that because
cross-language LTO was enabled between zig and c++ code, and because
Zig annotated the file parameter (3rd line) as being non-null, the C++
code assumed that parameter could not be null, and eagerly dereferenced
`import->...`, causing a segfault, since it was null.

I verified that this commit fixed the problem and I also verified this
hypothesis by disabling LTO and noticing that it indeed avoided the
problem.
2022-09-13 03:09:29 -07:00
Andrew Kelley
ebd082d3f6 remove pointless discards in test cases 2022-09-13 02:04:20 -07:00
Andrew Kelley
bec70a1a39 stage2: remove pointless discards from source code
Good riddance!
2022-09-13 02:04:20 -07:00
Andrew Kelley
f8a9bc57ce translate-c: lower discards differently
This makes translate-c lower discards as `_ = @TypeOf(foo);` to avoid
tripping the "pointless discard" error.

Ideally, translate-c would avoid emitting pointless discards, in which
case this commit can be reverted, however, that is a separate
enhancement.
2022-09-13 02:04:20 -07:00
Andrew Kelley
d31be31267 disable failing c++ test
See tracking issue #12828
2022-09-12 23:16:57 -07:00
Andrew Kelley
87819dba27 libunwind: compile with -std=c11
I noticed that the upstream cmake script does this now.
2022-09-12 23:16:38 -07:00
Andrew Kelley
7a941391d8 universal-libc: fix strncmp tests
The specification for this function is that it returns a positive value,
zero, or negative value, not that it returns the difference between
ascii values.
2022-09-12 22:32:15 -07:00
Andrew Kelley
78729c4939 update CI tarballs with libcxx fix
The main reason to update the CI tarballs is
f79824f946995a050c261ee96a08e31ccf00a112 which fixes an issue that
caused the CI to fail on all targets.
2022-09-12 21:25:49 -07:00
Andrew Kelley
2434cb6f06 cmake: add -Dversion-string flag to zig build command 2022-09-12 20:13:00 -07:00
Andrew Kelley
188902a710 Sema: introduce Type.ptrAlignmentAdvanced
I'm not sure why the other commits in this branch caused this fix to be
necessary. Also, there seems to be more fixes necessary before tests
will pass.
2022-09-12 18:13:24 -07:00
Andrew Kelley
f16855b9d7 remove pointless discards 2022-09-12 18:13:24 -07:00
Andrew Kelley
011663eea5 Merge remote-tracking branch 'origin/master' into llvm15 2022-09-12 16:11:18 -07:00
Andrew Kelley
01e89fec71 disable LLVM 15 regressed behavior test: "vector @splat"
See #12827
2022-09-12 16:02:31 -07:00
Andrew Kelley
f79824f946 libcxx: define _LIBCPP_ABI_VERSION and _LIBCPP_ABI_NAMESPACE
The changes from https://reviews.llvm.org/D119173 mean that __config no
longer defaults the libc++ ABI to 1, relying on external configuration.
This means Zig must provide the external configuration.

This fixes static libraries built with zig with -lc++ to have the
standard __1 namespace prefix, which had previously regressed in the
llvm15 branch.
2022-09-12 15:56:31 -07:00
Andrew Kelley
6e3bbba951 update CI tarballs for LLVM 15 2022-09-12 13:03:10 -07:00
Luuk de Gram
3edf8c7a6c
wasm-linker: reset file pointer for incremental
On each invocation of `flush()` the file pointer is moved.
This means that rather than overwriting the binary file,
we're appending to the file. With this commit, we're resetting
said pointer to '0' and overwrite the existing binary in incremental
mode.
2022-09-12 21:35:28 +02:00
Luuk de Gram
61f317e386
wasm-linker: rename self to descriptive name 2022-09-12 21:19:16 +02:00