34040 Commits

Author SHA1 Message Date
Andrew Kelley
77e839e283 std.io.Reader: fix streamDelimiter and streamDelimiterEnding 2025-07-07 22:43:51 -07:00
Andrew Kelley
1d763c8b29 std: formatted printing no longer prints type names
for structs, enums, and unions.

auto untagged unions are no longer printed as pointers; instead they are
printed as "{ ... }".

extern and packed untagged unions have each field printed, similar to
what gdb does.

also fix bugs in delimiter based reading
2025-07-07 22:43:51 -07:00
Andrew Kelley
7eae26d608 delete bad behavior test
behavior tests must not depend on std.io
2025-07-07 22:43:51 -07:00
Andrew Kelley
0e37ff0d59 std.fmt: breaking API changes
added adapter to AnyWriter and GenericWriter to help bridge the gap
between old and new API

make std.testing.expectFmt work at compile-time

std.fmt no longer has a dependency on std.unicode. Formatted printing
was never properly unicode-aware. Now it no longer pretends to be.

Breakage/deprecations:
* std.fs.File.reader -> std.fs.File.deprecatedReader
* std.fs.File.writer -> std.fs.File.deprecatedWriter
* std.io.GenericReader -> std.io.Reader
* std.io.GenericWriter -> std.io.Writer
* std.io.AnyReader -> std.io.Reader
* std.io.AnyWriter -> std.io.Writer
* std.fmt.format -> std.fmt.deprecatedFormat
* std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape
* std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape
* std.fmt.fmtSliceHexLower -> {x}
* std.fmt.fmtSliceHexUpper -> {X}
* std.fmt.fmtIntSizeDec -> {B}
* std.fmt.fmtIntSizeBin -> {Bi}
* std.fmt.fmtDuration -> {D}
* std.fmt.fmtDurationSigned -> {D}
* {} -> {f} when there is a format method
* format method signature
  - anytype -> *std.io.Writer
  - inferred error set -> error{WriteFailed}
  - options -> (deleted)
* std.fmt.Formatted
  - now takes context type explicitly
  - no fmt string
2025-07-07 22:43:51 -07:00
Andrew Kelley
0b3f0124dc std.io: move getStdIn, getStdOut, getStdErr functions to fs.File
preparing to rearrange std.io namespace into an interface

how to upgrade:

std.io.getStdIn() -> std.fs.File.stdin()
std.io.getStdOut() -> std.fs.File.stdout()
std.io.getStdErr() -> std.fs.File.stderr()
2025-07-07 22:43:51 -07:00
Nameless
7c42517151 os: fix missing and incorrect msghdr definitions
Macos uses the BSD definition of msghdr

All linux architectures share a single msghdr definition. Many
architectures had manually inserted padding fields that were endian
specific and some had fields with different integers. This unifies all
architectures to use a single correct msghdr definition.
2025-07-07 22:43:51 -07:00
Andrew Kelley
9f27d770a1 std.io: deprecated Reader/Writer; introduce new API 2025-07-07 22:43:51 -07:00
Andrew Kelley
fc2c1883b3
Merge pull request #24362 (remove async, await, usingnamespace)
remove `async` and `await` keywords; remove `usingnamespace`
2025-07-08 07:41:39 +02:00
Alex Rønne Petersen
9e49652757 llvm: Revert #17963 (workaround for #16392) 2025-07-08 02:50:15 +02:00
Andrew Kelley
4ba0e7d424 update zig1.wasm
necessary because to pass `zig fmt --check` we need to use the canonical
identifier syntax, which means changing `.@"async"` to `.async` which
previous zig1 is unable to parse.
2025-07-07 13:39:48 -07:00
Andrew Kelley
34f64432b0 remove usingnamespace from the language
closes #20663
2025-07-07 13:39:48 -07:00
Andrew Kelley
aa52bb8327 zig fmt 2025-07-07 13:39:16 -07:00
Andrew Kelley
a59c35cbf8 build.zig: bump maxrss for behavior tests 2025-07-07 13:39:16 -07:00
Andrew Kelley
40d11cc25a remove async and await keywords
Also remove `@frameSize`, closing #3654.

While the other machinery might remain depending on #23446, it is
settled that there will not be `async`/ `await` keywords in the
language.
2025-07-07 13:39:16 -07:00
Alex Rønne Petersen
31e46be743 std.c: Use __sigemptyset14 for sigemptyset on NetBSD
Closes #24344.
2025-07-07 12:14:58 +02:00
Alex Rønne Petersen
9a1e754a58 compiler-rt: Implement __clear_cache() for mips-netbsd 2025-07-07 09:05:07 +02:00
Alex Rønne Petersen
5209e7e458 compiler-rt: Export __emutls_get_address for OpenHarmony 2025-07-07 07:23:24 +02:00
Alex Rønne Petersen
b5cc658ab4 llvm: Use emulated TLS when appropriate for the target
Closes #24236.
2025-07-07 07:23:24 +02:00
Alex Rønne Petersen
c96c913bab
Merge pull request #24352 from alexrp/wasi-emulated-libs
`wasi`: Build emulated libraries into `libc.a`
2025-07-07 03:42:51 +02:00
jaune
ef8db03d52 std.posix.accept: add WSAENOTSOCK 2025-07-07 00:26:21 +02:00
Alex Rønne Petersen
2bf9ff1b42
wasi: Fix libwasi-emulated-process-clocks build
Might have been broken in 05d8b565ad1a1d6c0c1e93dc47f1d828043fcafc.
2025-07-06 20:49:19 +02:00
Alex Rønne Petersen
1f1082e36d
wasi: Build emulated libraries into libc.a
This matches what we do for small helper libraries like this in MinGW-w64. It
simplifies the compiler a bit, and also means the build system doesn't have to
treat these library names specially.

Closes #24325.
2025-07-06 20:05:18 +02:00
Alex Rønne Petersen
97ecb6c551 compiler: Disable self-hosted x86_64 backend on NetBSD
https://github.com/ziglang/zig/issues/24341
2025-07-06 19:50:29 +02:00
Alex Rønne Petersen
b461d07a54 Sema: Stop adding Windows implib link inputs for extern "..." syntax.
Closes #23971.
2025-07-06 01:00:18 +02:00
Alex Rønne Petersen
044ccf4138 test: More cleanup of Windows targets in the module test matrix
It's kind of unclear what `*-windows-none` actually means, but as far as LLVM is
concerned, it's equivalent to `*-windows-msvc`. For clarity, only test
`*-windows-msvc` and `*-windows-gnu`. #20690 will clean this situation up
eventually.

Also ensure coverage of `link_libc = true` and `link_libc = false` for both.
2025-07-05 04:05:34 +02:00
Alex Rønne Petersen
fc993945a9
Merge pull request #24335 from kada49/common-impl-libc-floor 2025-07-05 03:18:31 +02:00
Silver
be20f97eb9 Update TracyAllocator to new allocator API 2025-07-05 00:24:40 +02:00
Alex Rønne Petersen
9a8f1f675b start: Only issue fninit for x86(_64)-windows
Closes #24263.
2025-07-04 20:09:20 +02:00
David Senoner
b78751051f
delete superfluous assembly libc floor implementations 2025-07-04 20:05:18 +02:00
David Senoner
3124f700c7
delete superfluous libc floor implementations 2025-07-04 12:54:31 +02:00
Alex Rønne Petersen
9ef4bdf234 test: Respect various test skip options in test-cases 2025-07-03 22:18:12 +02:00
Brandon Black
aa1556156e std.posix.getsockopt: set option length correctly
Fixes #24293
2025-07-03 09:41:26 +02:00
Andrew Kelley
31bc6d5a9d
Merge pull request #24322 from ziglang/delete-dead-backends
delete abandoned backends
2025-07-03 04:57:25 +02:00
Andrew Kelley
e126e5592d compiler: delete dead x86 bits file 2025-07-02 15:03:26 -07:00
Andrew Kelley
5ae2428d52 compiler: change canonical path for backend ABI source files 2025-07-02 15:01:50 -07:00
Andrew Kelley
a13f0d40eb compiler: delete arm backend
this backend was abandoned before it was completed, and it is not worth
salvaging.
2025-07-02 14:50:41 -07:00
Andrew Kelley
20a543097b compiler: delete aarch64 backend
this backend was abandoned before it was completed, and it is not worth
salvaging.
2025-07-02 14:42:20 -07:00
Andrew Kelley
80a9b8f326 compiler: delete powerpc backend stub
nobody is currently working on this
2025-07-02 14:35:13 -07:00
Alex Rønne Petersen
edf785db0f
Merge pull request #24302 from alexrp/riscv
Native RISC-V bootstrap and test fixes
2025-07-02 04:15:10 +02:00
Alex Rønne Petersen
8e511e031f
std.crypto.salsa20: Disable some tests on RISC-V with vector support
https://github.com/ziglang/zig/issues/24299
2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
1c9d9b70ec
std.bit_set: Disable IntegerBitSet decltest on RISC-V with vector support
https://github.com/ziglang/zig/issues/24300
2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
9f064dff47
langref: runtime_shrExact_overflow does not work as expected on RISC-V
https://github.com/ziglang/zig/issues/24304
2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
b739fec841
test: Disable stack_iterator test on riscv64-linux
https://github.com/ziglang/zig/issues/24310
2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
1f2e3b39ae
test: Disable vector division operators on RISC-V with vector support
https://github.com/ziglang/zig/issues/24301
2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
1fcabe0bfc
test: Only run coff_dwarf test on aarch64, x86, x86_64
This will just fail if run on architectures like riscv64.
2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
80c3de40b3
test: Properly limit glibc_compat versions based on the host 2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
3d7fb4f204
std.zig.system.linux: Add detection for some extra RISC-V CPUs 2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
fd2d4507c8
std.os.linux: Define ucontext_t and mcontext_t for RISC-V
Closes #24239.
2025-07-01 23:03:13 +02:00
Ivan Stepanov
ee6d19480d spirv: fix signed overflow detection for safe subtraction
The overflow check for safe signed subtraction was using the formula (rhs < 0) == (lhs > result). This logic is flawed and incorrectly reports an overflow when the right-hand side is zero.
For the expression 42 - 0, this check evaluated to (0 < 0) == (42 > 42), which is false == false, resulting in true. This caused the generated SPIR-V to incorrectly branch to an OpUnreachable instruction, preventing the result from being stored.

Fixes #24281.
2025-07-01 19:26:21 +02:00
Alex Rønne Petersen
07114e6bc6
llvm: Disable the machine outliner pass on RISC-V 2025-07-01 18:16:40 +02:00