224 Commits
Author SHA1 Message Date
Masa Bence 87528630dd std: update more ArrayList usages to unmanaged 2026-10-22 20:09:32 +02:00
Jacob Young f08a8f0fc2 main: reimplement compiler debug flags
* Add `.llvmbc`/`.llvmir` to `ObjectFormat` for emitting unoptimized IR
* Replace `--verbose-air`, `--verbose-intern-pool`,
  `--verbose-generic-instances`, `--verbose-llvm-ir`, and
  `--verbose-llvm-bc` with various `--debug-log` scopes
  * `--debug-log illegal-air`: pre-legalized Air
  * `--debug-log legal-air`: post-legalized Air
  * `--debug-log air`: final Air with liveness
  * `--debug-log ip-stats`: InternPool statistics
  * `--debug-log ip-values`: InternPool values
  * `--debug-log ip-generic-instances`: InternPool generic instances
  * `--debug-log llvm-ir`: pre-optimized LLVM IR
  * `--debug-log opt-llvm-ir`: post-optimized LLVM IR
* Delete `--verbose-cimport` which does nothing
* Delete `--verbose-llvm-cpu-features` which is equivalent to looking at
  the outputs of `--show-builtin` and `--debug-log llvm-ir`
2026-10-21 10:04:01 -07:00
Ryan Liptak c27e685e63 Merge pull request 'std.zig.stringEscape: Escape invalid/disallowed UTF-8 sequences' (#36923) from squeek502/zig:string-escape-utf8 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36923
2026-09-28 22:23:47 +02:00
Jacob Young 00b59eb18a Runner: implement error reporting 2026-09-26 19:08:50 -04:00
Andrew Kelley d09c1aef02 maker: serialize compilation errors of configurer over the build protocol
serves an ErrorBundle as a configuration_failed message instead of
configuration message upon connection. at this point the protocol enters
an invalid state and the process will need to be restarted in order to
reconfigure. in the future, build server should outlive
reconfigurations.

closes #36389
2026-09-25 11:47:25 -07:00
Ryan Liptak 135cc6f89c std.zig.stringEscape: Escape invalid/disallowed UTF-8 sequences 2026-09-24 22:23:50 -07:00
Andrew Kelley 0334f14a13 compiler: update to new std.Build.Cache API 2026-09-16 13:12:47 -07:00
Andrew Kelley 48d6b1aa4a std.Build.Cache: rename addPathPost to addDiscoveredPath 2026-09-16 13:12:47 -07:00
Andrew Kelley d3231ad090 std.Build.Cache: get it compiling again 2026-09-16 13:12:46 -07:00
lg 39512c3e55 compiler: add support for patchable functions 2026-09-16 19:21:21 +02:00
Ryan Liptak e19a73c2d5 Fix std.zig.StringEscapeWriter drain function returning the wrong information
`drain` should return the number of bytes consumed from `data`

Fixes #36647
2026-08-28 00:26:13 +02:00
Andrew Kelley 7e012b4f7c std.Io.Writer: introduce {qf}
calls format function and then double quote escapes it
2026-08-20 17:35:12 -07:00
Andrew Kelley f37a910356 std.zig.stringEscape: relax the escaping rules
pass through everything except characters that have escapes in zig
language and ascii control characters.
2026-08-20 17:35:12 -07:00
Andrew Kelley 5a6c3aaedf remove some debug logs 2026-08-19 12:39:37 -07:00
Andrew Kelley e820cf38ed std.zig.Directories: fix deinit of build_root 2026-08-19 12:39:37 -07:00
Andrew Kelley 83d41cf04d add build_root to cache prefix directories 2026-08-19 12:39:36 -07:00
Andrew Kelley a06534d73a compiler: eliminate ZIG_DEBUG_MAKER
Just use ZIG_DEBUG_CMD the same as the other jit commands. Originally
this was working around a CI issue but that is no longer the case.
ZIG_DEBUG_MAKER is a new env var that didn't make it to any release tag
yet. Let's revert it to keep number of env vars more minimal.
2026-08-05 18:43:50 +02:00
Krzysztof Wolicki ab4028d579 Update usages of most deprecated APIs
In particular renames of `std.mem.indexOf` family to `std.mem.find`
and generic unmanaged containers
2026-08-05 03:40:30 +02:00
Andrew Kelley 5bf19f61ff Merge pull request 'Implement foundation of the build system protocol' (#36147) from Techatrix/zig:build-system-protocol into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36147
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-08-05 01:42:28 +02:00
mlugg c854c6577a Merge pull request 'Two tiny fmt simplifications' (#36361) from whatisaphone/zig:tiny-fmt-fixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36361
2026-08-01 23:43:20 +02:00
whatisaphone 9ef236bc11 Add env var to set zig build --summary 2026-08-01 23:40:39 +02:00
whatisaphone 159e4397fc Remove redundant case 2026-07-31 16:19:58 -04:00
Techatrix fb6ab7f564 std.zig.buildExeSubprocess: use multireader 2026-07-21 14:34:40 +02:00
Krzysztof Wolicki 8807e934d8 Remove things deprecated in 0.16.0 2026-07-21 07:57:01 +02:00
Justus Klausecker 69a26976ed zig fmt
Converts usages of `@intFromEnum` and `@enumFromInt` to instead use the
new `@backingInt` and `@fromBackingInt` builtins.
2026-07-17 23:30:26 +02:00
Justus Klausecker 9aeac329a2 Sema: require noreturn as backing integer of empty enums
Empty enums are uninstantiable, so their backing integer should be too.
This avoids a bunch of weird special cases during semantic analysis.

If you were previously using `enum {}`, your code should continue to work
fine.
If you were previously using `enum(uN) {}` (where `uN` is any integer type),
you'll probably want to use `enum(uN) { _ }` instead.
2026-07-17 00:02:41 +02:00
Isaac Freund 9953d7edca std.zig.AstSmith: delete (for now)
The current AstSmith is hand-written based on the formal PEG. However,
there is a significant impedance mismatch here since PEGs are a parser
specification not a language specification like CFGs. In other words,
it is not possible to directly translate an PEG into code that
efficiently generates all possible inputs recognized by the PEG.

Requirements for a new AstSmith:
1. Must be automatically generated based on the formal grammar
   specification.
2. Must have linear runtime.

The current AstSmith is handwritten and unfortunately does not exactly
match the formal grammar. Tests like this need to have a single source
of truth and also need to be maintainable so I consider automatic
generation non-negotiable.

I did attempt to write a tool that takes a PEG as input and outputs an
AstSmith implementation. However, I no longer believe it is possible
to do a direct translation from an arbitrary PEG to an efficient
AstSmith, the lookahead and ordered choice features have worst-case
exponential runtime.

Conceptually, PEGs are simple to translate into parsers while CFGs
are simple to translate in to generators or smiths. I believe the
path forward is to translate our PEG into a CFG and generate a smith
based on that. I consider that task out of scope for this branch though.
2026-07-08 15:49:17 +02:00
Isaac Freund 153fcc4e9c std.zig: expose parser oracle for external fuzzing 2026-07-08 11:48:58 +02:00
Isaac Freund 25dee862b4 std.zig.Ast: fuzz test against generated oracle
(currently broken/failing)
2026-07-08 11:48:57 +02:00
Andrew Kelley d5c83bafad std.zig.Directories.init: better error message 2026-07-01 20:03:17 -07:00
Andrew Kelley cc9463e457 Maker: avoid printing configure cmdline on compilation errors 2026-06-29 23:50:20 -07:00
Andrew Kelley 266ffd4133 Maker: build it in ReleaseSafe mode by default
also, introduce ZIG_VERBOSE_CMD for printing the child argv rather than
repurposing ZIG_DEBUG_CMD because the stderr output can be problematic
2026-06-29 23:50:20 -07:00
Andrew Kelley f7e36077e4 maker gets its own ZIG_DEBUG_MAKER env var
it can be useful to only set this and not the other one, or vice versa
2026-06-29 23:50:20 -07:00
Andrew Kelley 09f61b13b3 std.zig.buildExeSubprocess: remove log, return more info 2026-06-29 23:50:20 -07:00
Andrew Kelley b4b92c71e5 std.zig.buildExeSubprocess: fix memory management of file system inputs 2026-06-29 23:50:19 -07:00
Andrew Kelley c8dad46ced Maker: add configure file system inputs to configuration cache
also wire up progress node to child
2026-06-29 23:50:19 -07:00
Andrew Kelley 74168de68b Maker: fix lowering of build module on CLI 2026-06-29 23:50:19 -07:00
Andrew Kelley 98854a673e Maker: it's compiling again 2026-06-29 23:50:19 -07:00
Andrew Kelley 0c978ba957 WIP: migrate build and fetch commands to Maker process 2026-06-29 23:50:18 -07:00
kcbanner c7c1d65372 - Remove the compiler_rt_dyn_lib hack 2026-06-23 00:22:42 -04:00
Andrew Kelley c5d6277ace rename an internal environment variable 2026-06-22 16:53:16 -07:00
Krzysztof Wolicki 9e80795623 all: update to use new std.lang.Type definitions 2026-05-27 10:03:51 +01:00
Alan Cocanour 9c56550931 Respect environment variable preference for color in all zig commands
This makes all commands in the zig executable that support color
output respect the user's preference for color output based on the
NO_COLOR and CLICOLOR_FORCE environment variables. Setting color
preference via command line option still overrides preferences set via
environment variables.
2026-05-26 17:56:40 -07:00
Andrew Kelley bd1b47733b zig build: remove --build-runner CLI parameter
There is no concept of a "build runner" any more; it has been split in two:
configurer and maker.

Users of this feature will likely want to no longer override any logic, and
instead consume the configuration file produced by configurer.

If overriding one or the other of these is desired, the feature will need to be
re-introduced (as --override-maker or --override-configurer).
2026-05-25 18:54:36 -07:00
Andrew Kelley 9eb85c4e5e build system: track TODOs outside source code
related to #363
2026-05-25 18:54:36 -07:00
Andrew Kelley df8aaad058 maker: extract some pkg-config logic into reusable API 2026-05-25 18:54:36 -07:00
Andrew Kelley fb9118195e maker: implement pkg-config integration
featuring:
* better error reporting
* including PKG_CONFIG environment variable in `zig env`
* memoizing the output of `pkg-config --list-all`
2026-05-25 18:54:35 -07:00
Andrew Kelley ddabd57743 progress towards compiling zig's build script 2026-05-25 18:54:35 -07:00
Andrew Kelley 0f3471eb66 maker: finish porting over run step 2026-05-25 18:54:34 -07:00
Andrew Kelley dd51fc30f8 maker: finish migrating compile step make logic 2026-05-25 18:54:34 -07:00