25815 Commits

Author SHA1 Message Date
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
mlugg
28caaea093
AstGen: allow closure over known-runtime values within @TypeOf
AstGen emits an error when a closure over a known-runtime value crosses
a namespace boundary. This usually makes sense: however, this usage is
actually valid if the capture is within a `@TypeOf` operand. Sema
already has a special case to allow such closure within `@TypeOf` when
AstGen could not determine a value to be runtime-known. This commit
simply introduces analagous logic to AstGen to allow `var`s to cross
namespace boundaries within `@TypeOf`.
2023-09-17 12:41:11 +01:00
Andrew Kelley
f40f81cbfb
Merge pull request #16929 from truemedian/more-http
std.http: handle Expect: 100-continue, improve redirect logic, add Client.fetch for simple requests
2023-09-17 00:41:30 -07:00
dundargoc
5389af2c1c Fix minimum cmake version in README 2023-09-16 22:17:11 -07:00
Stephen Gutekanst
55f0d8b41c std: correct getcontext for Android bionic libc
I have updated Felix's ZigAndroidTemplate to work with the latest
version of Zig and we are exploring adding Android support to Mach engine.

`std.c.getcontext` is _referenced_ but not _used_, and Android's bionic libc
does not implement `getcontext`. `std.os.linux.getcontext` also cannot be
used with bionic libc, so it seems prudent to just disable this extern for now.

This may not be the perfect long-term fix, but I have a golden rebuttal to that:
before I was unable to compile Zig applications for Android, and now I can.

<img width="828" alt="image" src="https://github.com/hexops/mach/assets/3173176/1e29142b-0419-4459-9c8b-75d92f87f822">

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2023-09-16 14:22:09 -07:00
Krzysztof Wolicki
2651363c9d
autodoc: Implement various missing expressions in ex (#17129)
Co-authored-by: Loris Cro <kappaloris@gmail.com>
2023-09-16 17:38:06 +02:00
Krzysztof Wolicki
f2026e7dd6 autodoc: Implement builtin function rendering.
Implement unary ops handling.
Fix getType in main.js
Minor cleanup of builtin function handling.
2023-09-16 17:35:11 +02:00
Krzysztof Wolicki
9a326b22d5 autodoc: Fix styling of the navbar 2023-09-16 17:31:43 +02:00
Krzysztof Wolicki
da28379d6c autodoc: Remove unnecessary Expr tag 2023-09-16 17:30:49 +02:00