Commit Graph

29530 Commits

Author SHA1 Message Date
Andrew Kelley
455899668b
Merge pull request #20322 from ziglang/ci-tidy
add -Denable-tidy flag and use it in the CI
2024-06-17 05:41:09 -04:00
Andrew Kelley
1e9e29398a disable tidy validation for autodocs
tidy gives a false positive:

line 304 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.

I noticed that `--show-warnings no` still incorrectly causes exit code 1.
I was unable to find an alternative to tidy.
2024-06-17 00:10:35 -07:00
Andrew Kelley
651225c2d4 add -Denable-tidy flag and use it in the CI
Eliminates a TODO from the CI scripts; makes it easier to check validity
of html when working on the langref locally.
2024-06-17 00:10:35 -07:00
Andrew Kelley
fda2458f6a
Merge pull request #20321 from ziglang/build-system-fmt
enhance `std.Build.Step.Fmt` and use it more
2024-06-17 01:04:57 -04:00
Alex Rønne Petersen
2c373b0fb6 std.Target: Update known Windows 10/11 versions and build numbers. 2024-06-16 23:37:38 -04:00
Jacob Young
d208e59496 llvm: avoid debug info for naked function arguments
This is not supported by llvm.
2024-06-16 23:30:57 -04:00
Alex Rønne Petersen
6220c754cf std.Build: Add Step.Fail and addFail() function.
Closes #15373.
2024-06-16 23:13:12 -04:00
Alex Rønne Petersen
c533233f42 Revert "start: workaround for LLVM 17 regression"
This reverts commit d7daf7c203.

This is no longer needed with the LLVM 18 upgrade, and it was breaking PIE.

Closes #20306.
2024-06-16 23:11:08 -04:00
Andrew Kelley
cb1d1bdf59 make zig build test check for conforming formatting
There was already `zig build test-fmt` but now `zig build test` depends
on that one.

The CI scripts no longer need explicit logic since they already do
`zig build test`.
2024-06-16 19:31:59 -07:00
Andrew Kelley
eb8201afde std.Build.Step.Fmt: display non-conforming files
When in --check mode, and files are found to not conform, emit them
explicitly as step errors. Previously this stdout data was being
ignored.
2024-06-16 19:30:14 -07:00
Andrew Kelley
af7afbd08b std.Build.Step: split evalChildProcess into two functions
Now there is `captureChildProcess` which gives access to the
`std.process.Child.RunResult`, which is useful for accessing the stdout.

It also accepts and passes an optional `std.Progress.Node` to the child.
2024-06-16 19:29:05 -07:00
Andrew Kelley
42658de762 std.process.Child: run fn accepts std.Progress.Node
There was not a way to pass a progress node to this function until now.
2024-06-16 19:28:13 -07:00
Andrew Kelley
20e20f9238 std.Progress.Node: add none init value 2024-06-16 19:27:49 -07:00
Jacob Young
96501d3385 x86_64: get encoder tests passing again 2024-06-16 14:59:56 -04:00
Pavel Verigo
17f14e1d65 stage2-wasm: bit_reverse 2024-06-16 11:53:33 +02:00
Robin Voetter
8f27a43701
Merge pull request #20309 from Snektron/spirv-gpu-builtins
spirv: add support for GPU builtins
2024-06-16 08:42:35 +02:00
Robin Voetter
50a771a11e
spirv: add support for workItemId, workGroupId, workGroupSize 2024-06-16 01:00:13 +02:00
Marc Tiehuis
1b728e1834 std.float.parseFloat: fix large hex-float parsing
There were two primary issues at play here:
 1. The hex float prefix was not handled correctly when the stream was
    reset for the fallback parsing path, which occured when the mantissa was
    longer max mantissa digits.
 2. The implied exponent was not adjusted for hex-floats in this branch.

Additionally, some of the float parsing routines have been condensed, making
use of comptime.

closes #20275
2024-06-15 18:23:06 +02:00
Devin J. Pohly
ffb1a6d9a7 translate-c: fix translation of "ptr += uint"
The right-hand side was incorrectly cast to a pointer, since only signed
ints were being interpreted correctly as pointer arithmetic.

Fixes #20285.
2024-06-15 18:19:33 +02:00
Pavel Verigo
7829be6ee0 stage2-wasm: enum bigint <= 128 bits 2024-06-15 11:28:16 +02:00
Peng Guanwen
82a934bb91 Fix futex2_waitv syscall
The syscall gives immediate compile error in zig 0.12. This fix that.
2024-06-13 16:51:13 -04:00
Ryan Liptak
8e155959ca posix.renameW: Handle DIRECTORY_NOT_EMPTY more generally
Before this commit, the DIRECTORY_NOT_EMPTY/FILE_IS_A_DIRECTORY/NOT_A_DIRECTORY statuses were assumed only to be possible when using `FILE_RENAME_INFORMATION_EX` and `FILE_RENAME_POSIX_SEMANTICS`, but that has empirically been shown to be false; a networked samba share can return the DIRECTORY_NOT_EMPTY status from `FILE_RENAME_INFORMATION` (which doesn't support `FILE_RENAME_POSIX_SEMANTICS`).

`FILE_IS_A_DIRECTORY` and `NOT_A_DIRECTORY` were not proven to be possible, but they were also moved to the outer switch just in case.

Fixes #19785
2024-06-13 10:50:46 -04:00
Krzysztof Wolicki
45c77931c2 Change deprecated b.host to b.graph.host in tests and Zig's build.zig 2024-06-13 10:49:06 -04:00
Ryan Liptak
76fb2b685b std: Convert deprecated aliases to compile errors and fix usages
Deprecated aliases that are now compile errors:

- `std.fs.MAX_PATH_BYTES` (renamed to `std.fs.max_path_bytes`)
- `std.mem.tokenize` (split into `tokenizeAny`, `tokenizeSequence`, `tokenizeScalar`)
- `std.mem.split` (split into `splitSequence`, `splitAny`, `splitScalar`)
- `std.mem.splitBackwards` (split into `splitBackwardsSequence`, `splitBackwardsAny`, `splitBackwardsScalar`)
- `std.unicode`
  + `utf16leToUtf8Alloc`, `utf16leToUtf8AllocZ`, `utf16leToUtf8`, `fmtUtf16le` (all renamed to have capitalized `Le`)
  + `utf8ToUtf16LeWithNull` (renamed to `utf8ToUtf16LeAllocZ`)
- `std.zig.CrossTarget` (moved to `std.Target.Query`)

Deprecated `lib/std/std.zig` decls were deleted instead of made a `@compileError` because the `refAllDecls` in the test block would trigger the `@compileError`. The deleted top-level `std` namespaces are:

- `std.rand` (renamed to `std.Random`)
- `std.TailQueue` (renamed to `std.DoublyLinkedList`)
- `std.ChildProcess` (renamed/moved to `std.process.Child`)

This is not exhaustive. Deprecated aliases that I didn't touch:
  + `std.io.*`
  + `std.Build.*`
  + `std.builtin.Mode`
  + `std.zig.c_translation.CIntLiteralRadix`
  + anything in `src/`
2024-06-13 10:18:59 -04:00
Andrew Kelley
4aa15440c7
Merge pull request #20268 from ziglang/keep-calm-and-continue-panicking 2024-06-13 00:21:12 -04:00
Andrew Kelley
5fc1f8a32b std.Thread.Mutex.Recursive: alternate implementation
This version is simpler. Thanks King!
2024-06-12 18:07:39 -07:00
Andrew Kelley
fad223d92e std.Progress: use a recursive mutex for stderr 2024-06-12 17:43:49 -07:00
Andrew Kelley
506b3f6db6 introduce std.Thread.Mutex.Recursive 2024-06-12 17:43:49 -07:00
Andrew Kelley
55a9ea250c std.debug: lock stderr mutex when panicking
The doc comments for this global said:
"Locked to avoid interleaving panic messages from multiple threads."

Huh? There's already a mutex for that, it's the stderr mutex. Lock that
one instead.
2024-06-12 17:09:07 -07:00
Ryan Liptak
0cef727e59 More precise error message for unencodable \u escapes
The surrogate code points U+D800 to U+DFFF are valid code points but are not Unicode scalar values. This commit makes the error message more accurately reflect what is actually allowed in `\u` escape sequences.

From https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf:

> D71 High-surrogate code point: A Unicode code point in the range U+D800 to U+DBFF.
> D73 Low-surrogate code point: A Unicode code point in the range U+DC00 to U+DFFF.
>
> 3.9 Unicode Encoding Forms
> D76 Unicode scalar value: Any Unicode code point except high-surrogate and low-surrogate code points.

Related: #20270
2024-06-12 16:49:00 -04:00
Andrew Kelley
44f4abf380
Merge pull request #20269 from ziglang/fix-progress-race 2024-06-12 13:20:14 -04:00
Andrew Kelley
727f1fa743 update update_cpu_features tool to latest std.Progress API
closes #20261
2024-06-11 15:24:57 -07:00
Andrew Kelley
4b776ae441 std.Progress: fix race assertion failure
A node may be freed during the execution of this loop, causing there to
be a parent reference to a nonexistent node. Without this assignment,
this would lead to the map entry containing stale data. By assigning
none, the child node with the bad parent pointer will be harmlessly
omitted from the tree.

Closes #20262
2024-06-11 15:24:57 -07:00
Robin Voetter
d9bd34fd05
Merge pull request #20247 from Snektron/spirv-vectors-v3
spirv: vectors v3
2024-06-11 08:21:04 +02:00
Robin Voetter
a567f3871e
spirv: improve shuffle codegen 2024-06-10 20:32:50 +02:00
Robin Voetter
a3b1ba82f5
spirv: new vectorization helper
The old vectorization helper (WipElementWise) was clunky and a bit
annoying to use, and it wasn't really flexible enough.

This introduces a new vectorization helper, which uses Temporary and
Operation types to deduce a Vectorization to perform the operation
in a reasonably efficient manner. It removes the outer loop
required by WipElementWise so that implementations of AIR instructions
are cleaner. This helps with sanity when we start to introduce support
for composite integers.

airShift, convertToDirect, convertToIndirect, and normalize are initially
implemented using this new method.
2024-06-10 20:32:49 +02:00
Robin Voetter
4e7159ae1d
spirv: remove OpCompositeConstruct workarounds
Now that we use POCL to test, we no longer need this 
2024-06-10 20:32:43 +02:00
Robin Voetter
4bd9d9b7e0
spirv: change direct vector child repr to direct
Previously the child type of a vector was always in indirect representation.
Concretely, this meant that vectors of bools are represented by vectors
of u8.

This was undesirable because it introduced a difference between vectorizable
operations with a scalar bool and a vector of bool. This commit changes the
representation to be the same for vectors and scalars everywhere.

Some issues arised with constructing vectors: it seems the previous temporary-
and-pointer approach does not work properly with vectors of bool. To work around
this, simply use OpCompositeConstruct. This is the proper instruction for this,
but it was previously not used because of a now-solved limitation in the
SPIRV-LLVM-Translator. It was not yet applied to Zig because the Intel OpenCL
CPU runtime does not have a recent enough version of the translator yet, but
to solve that we just switch to testing with POCL instead.
2024-06-10 20:32:43 +02:00
Robin Voetter
b9d738a5cf
spirv: disable tests that fail on pocl
Besides the Intel OpenCL CPU runtime, we can now run the
behavior tests using the Portable Computing Language. This
implementation is open-source, so it will be easier for us
to patch in updated versions of spirv-llvm-translator that
have bug fixes etc.
2024-06-10 20:32:34 +02:00
mlugg
d4bc64038c Zir: remove legacy error_set_decl variants
These instructions are not emitted by AstGen. They also would have no
effect even if they did appear in ZIR: the Sema handling for these
instructions creates a Decl which the name strategy is applied to, and
proceeds to never use it. This pointless CPU heater is now gone, saving
2 ZIR tags in the process.
2024-06-10 05:02:34 +01:00
Robin Voetter
44443b833b
build: inherit setExecCmd from test compile steps when creating run steps
This should fix #17756
2024-06-09 01:55:50 +02:00
Robin Voetter
fba6b7e4c2
spirv: fix error code encoding 2024-06-09 01:55:49 +02:00
Shane Peelar
ec337051a9 Fix slight deviation from spec in handling Elf*_Rela relative relocations
`Elf*_Rela` relocations store their argument in `r_addend`, including for `R_*_RELATIVE` relocations.  Unlike `Elf*_Rel` relocations, they are not applied as a delta to the destination virtual address.  Instead, they are computed from `base_address + r_addend` directly.
2024-06-08 16:02:47 -04:00
Andrew Kelley
7ae9d8089d
Merge pull request #19007 from rootbeer/glibc-c-test
test/link/glibc_compat: Add C test case for glibc versions
2024-06-08 15:57:35 -04:00
Gordon Cassie
24f28753e6
Document a few non-obvious variable assignments (#20213)
Provide examples of various initializations.
2024-06-08 12:39:11 -07:00
expikr
7cf6650663
autodoc: fix misaligned table header when alignment is default (#20220) 2024-06-08 12:37:07 -07:00
Ryan Liptak
65cad8ab13 Fix index-of-out-bounds when no versions are found in the sdk lib dir
The current code wrongly assumes that versions[0] will always exist after the iterateAndFilterByVersion call.
2024-06-08 15:36:21 -04:00
Igor Anić
45b62c4529 io_uring: don't assume completions order
We are posting two submission (zero copy send and receive) and then
reading two completions. There is no guarantee that those completions
will be in the order of submissions.
This test was expecting fist send completion then receive.
Fix is allowing them to come other way too.
2024-06-08 15:35:41 -04:00
Ekin Dursun
0ba64e9ce3 Add ECONNREFUSED to sendto 2024-06-08 15:35:00 -04:00
Michael Dusan
2cd536d7e8 libcxx: fix building when -fsingle-threaded
* Skip building libcxx mt-only source files when single-threaded.
* This change is required for llvm18 libcxx.
* Add standalone test to link a trivial:
    - mt-executable with libcxx
    - st-executable with libcxx
2024-06-08 15:34:19 -04:00