Commit graph

8102 commits

Author SHA1 Message Date
David Rubin
938efe4aab compiler-rt: fix f80 ceil/floor optimization
Our implementation did the classic add-sub rounding trick `(y = x +/- C =+ C - x)`
with `C = 1 / eps(T) = 2^(mantissa - 1)`. This approach only works for values whose
magnitude is below the rounding capacity of the constant. For a 64-bit mantissa
(like f80 has), `C = 2^63` only rounds for `|x| < 2^63`. Before we allowed this to
be ran on `e < bias + 64` aka `|x| < 2^64`. And because it isn't large enough,
we lose a bit to rounding.

For reference, the musl implementation does the same thing, using `mantissa - 1`:
https://git.musl-libc.org/cgit/musl/tree/src/math/ceill.c#n18
where `LDBL_MANT_DIG` is 64 for `long double` on x86.

This commit also combines the floor and ceil implementations into one generic one.
2026-01-08 00:45:52 +01:00
Andrew Kelley
5e5b328dac test-standalone: update cases from posix.getrandom 2026-01-07 11:03:37 -08:00
Andrew Kelley
1f1381a866 update API usage of std.crypto.random to io.random 2026-01-07 11:03:36 -08:00
Alex Rønne Petersen
e226df2ed5 Merge pull request 'add OpenBSD libc cross-compilation support' (#30064) from alexrp/zig:openbsd into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/30064
Reviewed-by: Andrew Kelley <andrewrk@noreply.codeberg.org>
2026-01-06 16:12:54 +01:00
Ryan Liptak
52141fe85f standalone tests: Delete all ad hoc TmpDir instances, use the build system instead 2026-01-05 20:41:18 +01:00
Alex Rønne Petersen
00dc4d000f
test: add openbsd targets to module test matrix 2026-01-05 16:50:46 +01:00
Alex Rønne Petersen
d0ad76c03c
update_openbsd_libc: add tool for updating openbsd libc startup code 2026-01-05 16:50:44 +01:00
Jacob Young
ac64c75876 Dwarf: implement pointers to more comptime values
Closes #30600
Closes #30602
2026-01-05 11:24:48 +01:00
Andrew Kelley
b4dbe483a7 std.Build: adjust temp files API
Remove the RemoveDir step with no replacement. This step had no valid
purpose. Mutating source files? That should be done with
UpdateSourceFiles step. Deleting temporary directories? That required
creating the tmp directories in the configure phase which is broken.
Deleting cached artifacts? That's going to cause problems.

Similarly, remove the `Build.makeTempPath` function. This was used to
create a temporary path in the configure place which, again, is the
wrong place to do it.

Instead, the WriteFile step has been updated with more functionality:

tmp mode: In this mode, the directory will be placed inside "tmp" rather
than "o", and caching will be skipped. During the `make` phase, the step
will always do all the file system operations, and on successful build
completion, the dir will be deleted along with all other tmp
directories. The directory is therefore eligible to be used for
mutations by other steps. `Build.addTempFiles` is introduced to
initialize a WriteFile step with this mode.

mutate mode: The operations will not be performed against a freshly
created directory, but instead act against a temporary directory.
`Build.addMutateFiles` is introduced to initialize a WriteFile step with
this mode.

`Build.tmpPath` is introduced, which is a shortcut for
`Build.addTempFiles` followed by `WriteFile.getDirectory`.

* give Cache a gpa rather than arena because that's what it asks for
2026-01-04 17:23:45 -08:00
Andrew Kelley
854c076ff7 std.Io.Threaded: improve posix spawning
* avoid unreachable when the OS does something unexpected
* make waiting for the fork/exec error report cancelable
2026-01-04 00:27:09 -08:00
Andrew Kelley
e2c04a4651 fix some windows compilation errors 2026-01-04 00:27:09 -08:00
Andrew Kelley
2fee64ceb0 update init template for new main API 2026-01-04 00:27:09 -08:00
Andrew Kelley
e55fa3d525 fix two standalone tests on windows 2026-01-04 00:27:09 -08:00
Andrew Kelley
84da158afb test-stack-traces: update to new main API 2026-01-04 00:27:09 -08:00
Andrew Kelley
1070c2a71a rename env_map to environ_map
For naming consistency with `std.process.Environ.Map`.
2026-01-04 00:27:09 -08:00
Andrew Kelley
f25de4c7a2 fix native path lookup on macOS 2026-01-04 00:27:08 -08:00
Andrew Kelley
4afed3e9ef test-standalone: update the rest of the cases to new API 2026-01-04 00:27:08 -08:00
Andrew Kelley
bf74827ddb test-standalone: update more cases to new main API 2026-01-04 00:27:08 -08:00
Andrew Kelley
1b56686012 test-standalone: update cases to new main API 2026-01-04 00:27:08 -08:00
Andrew Kelley
f28802a9c6 zig libc: fix subcommand
This branch regressed the child process "run" mechanism because it
didn't pass the correct stdin, stdout, stderr values to process.spawn

Fixed now.
2026-01-04 00:27:08 -08:00
Andrew Kelley
960c512efd compiler: update std lib API usage 2026-01-04 00:27:08 -08:00
Andrew Kelley
f9585ad01f update tests and tools to new main API 2026-01-04 00:27:08 -08:00
Andrew Kelley
32af0f6154 std: move child process APIs to std.Io
this gets the build runner compiling again on linux

this work is incomplete; it only moves code around so that environment
variables can be wrangled properly. a future commit will need to audit
the cancelation and error handling of this moved logic.
2026-01-04 00:27:08 -08:00
Andrew Kelley
d6a1e73142 std: start wrangling environment variables and process args
this commit is unfinished. It marks a spot where I wanted to start
moving child process stuff below the std.Io.VTable
2026-01-04 00:27:07 -08:00
Ryan Liptak
e3f36d0d81 Fix a few standalone tests on Windows 2025-12-26 19:58:56 -08:00
Ryan Liptak
ec5c2d4ce3 Skip posix-specific standalone test on Windows 2025-12-26 19:58:56 -08:00
Ryan Liptak
447f80c0cc Delete test_symlink in standalone/posix, it's fully redundant
See readlink tests in std/fs/test.zig
2025-12-26 19:58:56 -08:00
Andrew Kelley
a7d2cb7045 test-incremental: ignore .swp files 2025-12-26 19:58:56 -08:00
Andrew Kelley
66da6773eb build: make test-incremental respect -Dtest-filter 2025-12-26 19:58:56 -08:00
Andrew Kelley
a72c411fdb disable self-hosted aarch64 tests
These can be re-enabled when the assertion failures in the backend are
fixed, which does not need to block this branch.
2025-12-26 19:58:56 -08:00
Andrew Kelley
2708a3c1ac fix the guess number game example 2025-12-23 22:40:17 -08:00
Andrew Kelley
c9a609a61a test-cases: disable self-hosted aarch64 backend coverage 2025-12-23 22:15:12 -08:00
Andrew Kelley
6dbc95fb1f update test cases 2025-12-23 22:15:12 -08:00
Andrew Kelley
fa79d34674 std: add changing cur dir back
There's a good argument to not have this in the std lib but it's more
work to remove it than to leave it in, and this branch is already
20,000+ lines changed.
2025-12-23 22:15:12 -08:00
Andrew Kelley
7788fd6233 update test API usage 2025-12-23 22:15:12 -08:00
Andrew Kelley
b45984ec80 test-incremental: respect the wine, qemu, etc build flags 2025-12-23 22:15:12 -08:00
Andrew Kelley
669dae140c test-standalone: fix most compilation errors 2025-12-23 22:15:12 -08:00
Andrew Kelley
6ece10f63d update test-link to new std.Io API 2025-12-23 22:15:12 -08:00
Andrew Kelley
33e302d67a update remaining calls to std.Io.Threaded.init 2025-12-23 22:15:12 -08:00
Andrew Kelley
70e19ea353 update more "realpath" callsites 2025-12-23 22:15:11 -08:00
Andrew Kelley
debf307594 update all incremental tests to new std API
they're still not passing on windows for some reason though
2025-12-23 22:15:11 -08:00
Andrew Kelley
77d2ad8c92 std: consolidate all instances of std.Io.Threaded into a singleton
It's better to avoid references to this global variable, but, in the
cases where it's needed, such as in std.debug.print and collecting stack
traces, better to share the same instance.
2025-12-23 22:15:11 -08:00
Andrew Kelley
7423d6a404 fix "hello world"
14K -> 57K
2025-12-23 22:15:11 -08:00
Andrew Kelley
6e0c7ed865 std: rename makeDir to createDir for consistency with createFile 2025-12-23 22:15:11 -08:00
Andrew Kelley
16f8af1b9a compiler: update various code to new fs API 2025-12-23 22:15:09 -08:00
Andrew Kelley
bee8005fe6 std.heap.DebugAllocator: never detect TTY config
instead, allow the user to set it as a field.

this fixes a bug where leak printing and error printing would run tty
config detection for stderr, and then emit a log, which is not necessary
going to print to stderr.

however, the nice defaults are gone; the user must explicitly assign the
tty_config field during initialization or else the logging will not have
color.

related: https://github.com/ziglang/zig/issues/24510
2025-12-23 22:15:08 -08:00
Andrew Kelley
4a53e5b0b4 fix a handful of compilation errors related to std.fs migration 2025-12-23 22:15:08 -08:00
Andrew Kelley
ebdbbd20ac update makeDir() sites to specify permissions 2025-12-23 22:15:08 -08:00
Andrew Kelley
3725f72293 update std.process.Child.run occurences to use io 2025-12-23 22:15:08 -08:00
Andrew Kelley
9e3bda5eff tests: close() -> close(io) 2025-12-23 22:15:08 -08:00