aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler/resinator
AgeCommit message (Collapse)Author
2025-11-20update resinator to Aro changesVeikka Tuominen
2025-11-15MemoryPool: add unmanaged variants and make them the defaultJustus Klausecker
2025-10-30std.debug.lockStderrWriter: also return ttyconfMatthew Lugg
`std.Io.tty.Config.detect` may be an expensive check (e.g. involving syscalls), and doing it every time we need to print isn't really necessary; under normal usage, we can compute the value once and cache it for the whole program's execution. Since anyone outputting to stderr may reasonably want this information (in fact they are very likely to), it makes sense to cache it and return it from `lockStderrWriter`. Call sites who do not need it will experience no significant overhead, and can just ignore the TTY config with a `const w, _` destructure.
2025-10-29resinator: update for Io APIAndrew Kelley
2025-10-29resinator: update for new Io APIsAndrew Kelley
2025-10-09- Move aroDiagnosticsToErrorBundle to compiler/util.zigkcbanner
2025-10-09- Rework translate-c to integrate with the build system (by outputing error ↵kcbanner
bundles on stdout) via --zig-integration - Revive some of the removed cache integration logic in `cmdTranslateC` now that `translate-c` can return error bundles - Fixup inconsistent path separators (on Windows) when building the aro include path - Move some error bundle logic from resinator into aro.Diagnostics - Add `ErrorBundle.addRootErrorMessageWithNotes` (extracted from resinator)
2025-10-02resinator: Update for std.coff changesRyan Liptak
2025-10-01resinator: Sync with upstream, fix an alignment problemRyan Liptak
2025-09-24resinator: work around error VARARGS not implemented for this compilerAndrew Kelley
2025-09-24resinator: fix compile errorsAndrew Kelley
2025-09-24resinator: Update for latest aroRyan Liptak
2025-08-31std.fmt: delete deprecated APIsAndrew Kelley
std.fmt.Formatter -> std.fmt.Alt std.fmt.format -> std.Io.Writer.print
2025-08-30update tools and other miscellaneous things to new APIsAndrew Kelley
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-08-28resinator: Complete the update to the new Reader/WriterRyan Liptak
2025-08-28resinator: some updates to avoid GenericWriterAndrew Kelley
These are some hastily made, untested changes to get things compiling again, since Ryan is working on a better upgrade patchset in the meantime.
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-08-08std.Io: remove BufferedWriterAndrew Kelley
2025-08-07std.Io: delete CountingWriterAndrew Kelley
2025-08-07resinator: a few more updates/fixesRyan Liptak
Just enough to get things working correctly again
2025-08-07resinator: just enough fixes to make it compileAndrew Kelley
2025-08-07std.Io: delete BufferedReaderAndrew Kelley
2025-07-20Merge pull request #24488 from ziglang/moreAndrew Kelley
std.zig: finish updating to new I/O API
2025-07-19std.zig: finish updating to new I/O APIAndrew Kelley
2025-07-19resinator: fix std.json API usageAndrew Kelley
2025-07-07update standalone and incremental tests to new APIAndrew Kelley
2025-07-07std.fmt: fully remove format string from format methodsAndrew Kelley
Introduces `std.fmt.alt` which is a helper for calling alternate format methods besides one named "format".
2025-07-07std.fmt: breaking API changesAndrew Kelley
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-07std.io: move getStdIn, getStdOut, getStdErr functions to fs.FileAndrew Kelley
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-07std.io: deprecated Reader/Writer; introduce new APIAndrew Kelley
2025-06-28resinator: Fix include directory detection when cross-compiling from certain ↵Ryan Liptak
host archs Previously, resinator would use the host arch as the target arch when looking for windows-gnu include directories. However, Zig only thinks it can provide a libc for targets specified in the `std.zig.target.available_libcs` array, which only includes a few for windows-gnu. Therefore, when cross-compiling from a host architecture that doesn't have a windows-gnu target in the available_libcs list, resinator would fail to detect the MinGW include directories. Now, the custom option `/:target` is passed to `zig rc` which is intended for the COFF object file target, but can be re-used for the include directory target as well. For the include directory target, resinator will convert the MachineType to the relevant arch, or fail if there is no equivalent arch/no support for detecting the includes for the MachineType (currently 64-bit Itanium and EBC). Fixes the `windows_resources` standalone test failing when the host is, for example, `riscv64-linux`.
2025-06-28resinator: Only preprocess when the input is an .rc fileRyan Liptak
2025-06-19Target: pass and use locals by pointer instead of by valueJacob Young
This struct is larger than 256 bytes and code that copies it consistently shows up in profiles of the compiler.
2025-05-13std.meta.intToEnum -> std.enums.fromIntwooster0
Also use an optional as the return type instead of an error code.
2025-04-27chore(std.mem): Rename `trimLeft` and `trimRight`Shun Sakai
Rename `trimLeft` to `trimStart`, and `trimRight` to `trimEnd`. `trimLeft` and `trimRight` functions remain as deprecated aliases for these new names.
2025-03-21Trick the meson build system into thinking `zig rc` is `rc.exe`Ryan Liptak
When determining the type of RC compiler, meson passes `/?` or `--version` and then reads from `stdout` looking for particular string(s) anywhere in the output. So, by adding the string "Microsoft Resource Compiler" to the `/?` output, meson will recognize `zig rc` as rc.exe and give it the correct options, which works fine since `zig rc` is drop-in CLI compatible with rc.exe. This allows using `zig rc` with meson for (cross-)compiling, by either: - Setting WINDRES="zig rc" or putting windres = ['zig', 'rc'] in the cross-file + This will work like rc.exe, so it will output .res files. This will only link successfully if you are using a linker that can do .res -> .obj conversion (so something like zig cc, MSVC, lld) - Setting WINDRES="zig rc /:output-format coff" or putting windres = ['zig', 'rc', '/:output-format', 'coff'] in the cross-file + This will make meson pass flags as if it were rc.exe, but it will cause the resulting .res file to actually be a COFF object file, meaning it will work with any linker that handles COFF object files Example cross file that uses `zig cc` (which can link `.res` files, so `/:output-format coff` is not necessary) and `zig rc`: ``` [binaries] c = ['zig', 'cc', '--target=x86_64-windows-gnu'] windres = ['zig', 'rc'] [target_machine] system = 'windows' cpu_family = 'x86_64' cpu = 'x86_64' endian = 'little' ```
2025-02-22zig rc: Add COFF object file creation for CMake cross-compilation use caseRyan Liptak
In #22522 I said: > RC="zig rc" will now work in combination with zig cc and CMake. Here's an example of cross-compiling a simple Windows GUI CMake project > > $ RC="zig rc" CC="zig cc --target=x86_64-windows-gnu" cmake .. -DCMAKE_SYSTEM_NAME=Windows -G Ninja However, I didn't realize that the time that this only works because of the `-G Ninja` part. When not using Ninja as the build tool, CMake adds a workaround for 'very long lists of object files' where it takes all object files and runs them through `ar` to combine them into one archive: https://github.com/Kitware/CMake/blob/4a11fd8dde745789f66d6500412d7f56607e9218/Modules/Platform/Windows-GNU.cmake#L141-L158 This is a problem for the Windows resource use-case, because `ar` doesn't know how to deal with `.res` files and so this object combining step fails with: unknown file type: foo.rc.res Only the linker knows what to do with .res files (since it has its own `.res` -> `.obj` ('cvtres') conversion mechanism). So, when using Ninja, this object file combining step is skipped and the .res file gets passed to the linker and everyone is happy. Note: When CMake thinks that its using `windres` as the Windows resource compiler, it will pass `-O coff` to windres which causes it to output a COFF object file instead of a `.res` file, which means that the `ar` step can succeed because it's only working on actual object files. --- This commit gives `zig rc` the ability to output COFF object files directly when `/:output-format coff` is provided as an argument. This effectively matches what happens when CMake uses `windres` for resource compilation, but requires the argument to be provided explicitly. So, after this change, the following CMake cross-compilation use case will work, even when not using Ninja as the generator: RC="zig rc /:output-format coff" CC="zig cc --target=x86_64-windows-gnu" cmake .. -DCMAKE_SYSTEM_NAME=Windows
2025-02-22zig build fmtAndrew Kelley
2025-02-10resinator: Fix some error message integrationRyan Liptak
Fixup for some of the changes in https://github.com/ziglang/zig/pull/22522
2025-01-17resinator: Sync with upstreamRyan Liptak
Note: This mostly matches resinator v0.1.0 rather than the latest master version, since the latest master version focuses on adding support for .res -> .obj conversion which is not necessary for the future planned relationship of zig and resinator (resinator will likely be moved out of the compiler and into the build system, a la translate-c). So, ultimately the changes here consist mostly of bug fixes for obscure edge cases.
2025-01-17resinator: Fix incorrect args being printed in cli diagnosticsRyan Liptak
2024-09-12Replace deprecated default initializations with decl literalsLinus Groh
2024-09-09sync Aro dependencyVeikka Tuominen
ref: adfd13c6ffb563b1379052b92f6ae4148b91cc12
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-08-27compiler,lib,test,langref: migrate `@setCold` to `@branchHint`mlugg
2024-07-28Condense and extend std.Treap's traversal functionalities. (#20002)Cheng Sheng
The core functionalities are now in two general functions `extremeInSubtreeOnDirection()` and `nextOnDirection()` so all the other traversing functions (`getMin()`, `getMax()`, and `InorderIterator`) are all just trivial calls to these core functions. The added two functions `Node.next()` and `Node.prev()` are also just trivial calls to these. * std.Treap traversal direction: use u1 instead of usize. * Treap: fix getMin() and getMax(), and add tests for them.
2024-06-13std: Convert deprecated aliases to compile errors and fix usagesRyan Liptak
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-05-27resinator: update to new progress APIAndrew Kelley
2024-05-03Rename Dir.writeFile2 -> Dir.writeFile and update all callsitesRyan Liptak
writeFile was deprecated in favor of writeFile2 in f645022d16361865e24582d28f1e62312fbc73bb. This commit renames writeFile2 to writeFile and makes writeFile2 a compile error.