Commit graph

17075 commits

Author SHA1 Message Date
Andrew Kelley
5c6679922d CBE: avoid depending on std.io.Writer.count 2025-07-09 09:32:07 -07:00
Andrew Kelley
bc2cf0c173 eliminate all uses of std.io.Writer.count except for CBE 2025-07-09 09:32:07 -07:00
Andrew Kelley
c1c49a7d1c C backend: fix bitcasting regression 2025-07-08 15:15:08 -07:00
Jacob Young
720cd43fc1 cbe: fix code header being omitted from the output 2025-07-07 22:43:53 -07:00
Andrew Kelley
a983f5b90f wasm backend: memcpy and memmove are the same
both lower to memory.fill operation, which are allowed to overlap
2025-07-07 22:43:53 -07:00
Andrew Kelley
911cd2611f Sema: fix unintentional extra @compileLog newline 2025-07-07 22:43:53 -07:00
Andrew Kelley
26659c862f update compiler unit tests to new API 2025-07-07 22:43:53 -07:00
Andrew Kelley
d8e26275f2 update standalone and incremental tests to new API 2025-07-07 22:43:53 -07:00
Andrew Kelley
f2ad3bcc1c fix 32-bit compilation 2025-07-07 22:43:53 -07:00
Andrew Kelley
7e2a26c0c4 std.io.Writer.printValue: rework logic
Alignment and fill options only apply to numbers.

Rework the implementation to mainly branch on the format string rather
than the type information. This is more straightforward to maintain and
more straightforward for comptime evaluation.

Enums support being printed as decimal, hexadecimal, octal, and binary.

`formatInteger` is another possible format method that is
unconditionally called when the value type is struct and one of the
integer-printing format specifiers are used.
2025-07-07 22:43:53 -07:00
Andrew Kelley
5378fdb153 std.fmt: fully remove format string from format methods
Introduces `std.fmt.alt` which is a helper for calling alternate format
methods besides one named "format".
2025-07-07 22:43:53 -07:00
Andrew Kelley
4ccc6f2b57 compiler: fix remaining build failures 2025-07-07 22:43:53 -07:00
Andrew Kelley
9c8aef55b4 std.fmt.format: use {t} for tag name rather than {s}
prevents footgun when formatted type changes from string to enum
2025-07-07 22:43:52 -07:00
Andrew Kelley
30c2921eb8 compiler: update a bunch of format strings 2025-07-07 22:43:52 -07:00
Andrew Kelley
d09b99d043 C backend: fix compilation errors 2025-07-07 22:43:52 -07:00
Andrew Kelley
f409457925 compiler: fix a bunch of format strings 2025-07-07 22:43:52 -07:00
Andrew Kelley
494819be91 cbe: reapply writer changes 2025-07-07 22:43:52 -07:00
Andrew Kelley
6963a1c7b9 C backend: prepare for merge 2025-07-07 22:43:52 -07:00
Andrew Kelley
6314e6f238 compiler: fix a bunch of format strings 2025-07-07 22:43:52 -07:00
Andrew Kelley
d5c97fded5 compiler: fix a bunch of format strings 2025-07-07 22:43:52 -07:00
Andrew Kelley
3afc6fbac6 std.zig.llvm.Builder: update format API 2025-07-07 22:43:52 -07:00
Andrew Kelley
ec3b5f0c74 compiler: upgrade various std.io API usage 2025-07-07 22:43:52 -07:00
Andrew Kelley
756a2dbf1a compiler: upgrade various std.io API usage 2025-07-07 22:43:52 -07:00
Andrew Kelley
941bc37193 compiler: update all instances of std.fmt.Formatter 2025-07-07 22:43:52 -07:00
Andrew Kelley
49be02e6d7 MachO: revert unfinished changes 2025-07-07 22:43:52 -07:00
Andrew Kelley
c8fcd2ff2c MachO: update to new std.io APIs 2025-07-07 22:43:52 -07:00
Andrew Kelley
f71d97e4cb update compiler source to new APIs 2025-07-07 22:43:52 -07:00
Andrew Kelley
fac5fe57be std.io.Writer.Allocating: rename interface to writer 2025-07-07 22:43:52 -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
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
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
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
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
Alex Rønne Petersen
2bf9ff1b42
wasi: Fix libwasi-emulated-process-clocks build
Might have been broken in 05d8b565ad.
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
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
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
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