25823 Commits

Author SHA1 Message Date
Andrew Kelley
5d92cc8cf6 skip all mips tests due to LLVM 17 regressions
Tracked by #16846
2023-09-19 09:37:53 -07:00
Andrew Kelley
5b8af7a2a9 skip regressed LLVM 17 std lib test on powerpc
Tracked by #16951
2023-09-19 09:37:53 -07:00
Andrew Kelley
66312c0b51 clang: -fno-sanitize=function workaround
It is very common, and well-defined, for a pointer on one side of a C ABI
to have a different but compatible element type. Examples include:

- `char*` vs `uint8_t*` on a system with 8-bit bytes
- `const char*` vs `char*`
- `char*` vs `unsigned char*`

Without this flag, Clang would invoke UBSAN when such an extern
function was called.

Might be nice to file an upstream issue and find out if there is a more
precise way to disable the problematic check.
`-fsanitize-cfi-icall-generalize-pointers` looks promising according to
the documentation, but empirically it does not work.
2023-09-19 09:37:53 -07:00
Andrew Kelley
75b8b21cc1 CI: update bootstrap tarballs to latest
Updates llvm libraries to 17.0.0rc3 which contain bug fixes that
affected the zig test suite.
2023-09-19 09:37:53 -07:00
Andrew Kelley
9e21e16f6d re-enable passing behavior test
See #16797 - it was fixed in the most recent LLVM 17 release candidate.
2023-09-19 09:37:53 -07:00
Andrew Kelley
1df4efc4bc disable failing wasm linking tests
These started failing after the LLVM 17 upgrade.

See tracking issues #16937 and #16938
2023-09-19 09:37:53 -07:00
Andrew Kelley
3acf0f637e disable failing mips tests due to LLVM 17 regressions
tracked by #16846
2023-09-19 09:37:53 -07:00
Andrew Kelley
cd6a236279 libcxx: update for llvm 17.0.0rc3 2023-09-19 09:37:53 -07:00
Jacob Young
8a9f8a1d77 behavior: disable another test regressed by LLVM 17 for mips
Tracked by #16846
2023-09-19 09:37:53 -07:00
Jacob Young
401de6dd2f compiler_rt: fix arm hard-float f16 abi
Closes #16848
2023-09-19 09:37:53 -07:00
Jacob Young
17e3fcc3a5 compiler_rt: fight off @as invasion
Importantly, fixes incorrectly annotated types in `__aeabi_?2h`.
2023-09-19 09:37:52 -07:00
Jacob Young
d65318847f compiler_rt: fix fp sub being optimized to call itself
Closes #16844
Reduces #16846
2023-09-19 09:37:52 -07:00
Andrew Kelley
8219711063 disable behavior tests regressed by LLVM 17
See #16844
See #16845
See #16846
See #16848
2023-09-19 09:37:50 -07:00
Jacob Young
b1b155feac llvm: update riscv floating-point c abi for LLVM 17 2023-09-19 09:37:32 -07:00
Jacob Young
d7daf7c203 start: workaround for LLVM 17 regression
Tracking issue #16799
2023-09-19 09:37:32 -07:00
Jacob Young
39f1d96a2f behavior: disable test that regressed with LLVM 17
Tracking issue #16797
2023-09-19 09:37:32 -07:00
Jacob Young
3506bc61b7 llvm: update data layout computation to LLVM 17 2023-09-19 09:37:32 -07:00
Jacob Young
cad594372e llvm: update address space definitions to LLVM 17 2023-09-19 09:37:32 -07:00
Andrew Kelley
749b88c7f3 CI: enable for llvm17 branch 2023-09-19 09:37:32 -07:00
Andrew Kelley
0bd1058d5a CI: update x86_64-linux tarball 2023-09-19 09:37:32 -07:00
Andrew Kelley
78e95e1062 update LLVM static library list to 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:32 -07:00
Jacob Young
05e01301b0 Builder: further constant select cleanup 2023-09-19 09:37:32 -07:00
Andrew Kelley
8366d53499 zig cc: update clang CLI data to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:32 -07:00
Andrew Kelley
5d4439cc3e libcxx: update to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8

This adds the flag `-D_LIBCPP_PSTL_CPU_BACKEND_SERIAL`. A future
enhancement could possibly pass something different if there is a
compelling parallel implementation. That libdispatch one might be worth
looking into.
2023-09-19 09:37:31 -07:00
Andrew Kelley
9ddfacd8e6 libcxxabi: update to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Andrew Kelley
571a4c86c3 libunwind: update to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Andrew Kelley
6a07b7024a LLVM: update backend to LLVM 17
* LLVMConstSelect is removed (see
   https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179)
 * a couple functions use uint64_t instead of int now which means we
   no longer need `@intCast`.

release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Andrew Kelley
62a12e0631 LLVM 17 std lib updates and fixes
* some manual fixes to generated CPU features code. in the future it
   would be nice to make the script do those automatically. I suspect
   the sm_90a thing is a bug in LLVM.
 * add liteos to various target OS switches. I know nothing about this
   OS; someone will need to work specifically on support for this OS
   when the time comes to support it properly in zig.
 * while waiting for the compiler, I went ahead and made more
   conservative choices about when to use `inline` in std/Target.zig
2023-09-19 09:37:31 -07:00
Andrew Kelley
1861036f3b update C language headers to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Andrew Kelley
3ed40b1140 update CPU features to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Andrew Kelley
1c7adf5064 update zig_clang C++ API wrapper bindings to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Andrew Kelley
cd8234c3ba update for LLVM 17 new target data
New OSs:
* UEFI
* LiteOS

New ABI:
* OpenHOS

Also update the LLD driver API wrappers.
2023-09-19 09:37:30 -07:00
Andrew Kelley
dbf8fb7843 llvm-ar patch: update main function 2023-09-19 09:37:30 -07:00
Andrew Kelley
d123c70d5f clang patch: update main function 2023-09-19 09:37:30 -07:00
Andrew Kelley
68a338cc10 update ar and clang C++ files to LLVM 17 2023-09-19 09:37:30 -07:00
Andrew Kelley
3882ce4f4b update cmake files to LLVM 17 2023-09-19 09:37:26 -07:00
r00ster91
ee4ced9683 write function types consistently with a space before fn keyword
Currently, the compiler (like @typeName) writes it `fn(...) Type` but
zig fmt writes it `fn (...) Type` (notice the space after `fn`).
This inconsistency is now resolved and function types are consistently
written the zig fmt way. Before this there were more `fn (...) Type`
occurrences than `fn(...) Type` already.
2023-09-19 15:15:05 +03:00
Andrew Kelley
3e79315d19 x86 backend: don't read bogus safety flag
Safety is not a global flag that should be enabled or disabled for all
stores - it's lowered by the frontend directly into AIR instruction
semantics. The flag for this is communicated via the `store` vs
`store_safe` AIR instructions, and whether to write 0xaa bytes or not
should be decided in `airStore` and passed down via function parameters.

This commit is a step backwards since it removes functionality but it
aims our feet towards a better mountain to climb.
2023-09-19 00:43:21 -07:00
Jay Petacat
f91ff9a746 translate-c: Struct fields default to zero value
C99 introduced designated initializers for structs. Omitted fields are
implicitly initialized to zero. Some C APIs are designed with this in
mind. Defaulting to zero values for translated struct fields permits Zig
code to comfortably use such an API.

Closes #8165
2023-09-18 23:09:47 -07:00
Meghan Denny
5af5d87ad2 std: math.absInt: update docs to use fabs for floats 2023-09-18 21:44:56 +03:00
Daniel Guzman
4610360699 Return error.WouldBlock when connect returns .WSAEWOULDBLOCK 2023-09-18 04:25:52 -07:00
mlugg
9ea2076663 translate-c: prevent variable names conflicting with type names
This introduces the concept of a "weak global name" into translate-c.

translate-c consists of two passes. The first is important, because it
discovers all global names, which are used to prevent naming conflicts:
whenever we see an identifier in the second pass, we can mangle it if it
conflicts with any global or any other in-scope identifier.

Unfortunately, this is a bit tricky for structs, unions, and enums. In
C, these types are not represented by normal identifers, but by separate
tags - `struct foo` does not prevent an unrelated identifier `foo`
existing. In general, we want to translate type names to user-friendly
ones such as `struct_foo` and `foo` where possible, but we can't
guarantee such names will not conflict with real variable names.

This is where weak global names come in. In the initial pass, when a
global type declaration is seen, `struct_foo` and `foo` are both added
as weak global names. This essentially means that we will use these
names for the type *if possible*, but if there is another global with
the same name, we will mangle the type name instead. Then, when actually
translating the declaration, we check whether there's a "true" global
with a conflicting name, in which case we mangle our name. If the
user-friendly alias `foo` conflicts, we do not attempt to mangle it: we
just don't emit it, because a mangled alias isn't particularly helpful.
2023-09-18 14:12:33 +03:00
Banacial
d2a937838e
std.zig.c_translation.zig: fix L suffix with sized ints
Closes #15066
2023-09-18 13:27:32 +03:00
nikneym
ada02ac6fe wasi: update sock_recv and sock_send according to preview1 2023-09-18 00:27:27 -07:00
Andrew Kelley
c970dbdfec LLVM: cache LLVM struct field indexes
This is an optimization to avoid O(N) field index lookups. It's also
nicer in terms of DRY; the only tradeoff is memory usage.
2023-09-18 00:09:30 -07:00
Andrew Kelley
48e2ba3b3c
Merge pull request #17179 from mlugg/fix/translate-c
translate-c fixes
2023-09-17 13:54:35 -07:00
Ryan Liptak
bc626e8b89 Make std.os.getenv always a compile error on Windows
The _environ variable that is populated when linking libc on Windows does not support Unicode keys/values (or, at least, the encoding is not necessarily UTF-8). So, for Unicode support, _wenviron would need to be used instead. However, this means that the keys/values would be encoded as UTF-16, so they would need to be converted to UTF-8 before being returned by `os.getenv`. This would require allocation which is not part of the `os.getenv` API, so `os.getenv` is not implementable on Windows even when linking libc.

Closes https://github.com/ziglang/zig/issues/8456
2023-09-17 11:05:06 -07:00
Loris Cro
c1e94b28a3 autodoc: split json payload per field
this will make s3 re-enable compression for the stdlib's autodoc
and improve loading times (and data usage) for users

alongside this commit the deploy script for the official website is also
being updated
2023-09-17 18:23:21 +02:00
Loris Cro
33f3a4d840 autodoc: rename the doctest section in the frontend to 'Usage Examples' 2023-09-17 18:23:21 +02:00
mlugg
0fa8cf44f6
translate-c: do not translate macros which use arguments as struct/union/enum names
Consider this C macro:
```c
#define FOO(x) struct x
```

Previously, translate-c did not detect that the `x` in the body referred
to the argument, so wrongly translated this code as using the
nonexistent `struct_x`. Since undefined identifiers are noticed in
AstGen, this prevents the translated file from being usable at all.

translate-c now instead detects this case and emits an appropriate
compile error in the macro's place.
2023-09-17 12:41:11 +01:00