aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
AgeCommit message (Collapse)Author
2024-07-13Compile: Pass the default --zig-lib-dir along to child processeskcbanner
main: print the self_exe_path when `findZigLibDirFromSelfExe` fails in all cases
2024-07-13Args including and after `--` get passed to build runner directlyKrzysztof Wolicki
2024-07-12zig build: add a --debug-target CLI flagAndrew Kelley
it's not advertised in the usage and only available in debug builds of the compiler. Makes it easier to test changes to the build runner that might affect targets differently.
2024-07-12integrate Compile steps with file watchingAndrew Kelley
Updates the build runner to unconditionally require a zig lib directory parameter. This parameter is needed in order to correctly understand file system inputs from zig compiler subprocesses, since they will refer to "the zig lib directory", and the build runner needs to place file system watches on directories in there. The build runner's fanotify file watching implementation now accounts for when two or more Cache.Path instances compare unequal but ultimately refer to the same directory in the file system. Breaking change: std.Build no longer has a zig_lib_dir field. Instead, there is the Graph zig_lib_directory field, and individual Compile steps can still have their zig lib directories overridden. I think this is unlikely to break anyone's build in practice. The compiler now sends a "file_system_inputs" message to the build runner which shares the full set of files that were added to the cache system with the build system, so that the build runner can watch properly and redo the Compile step. This is implemented for whole cache mode but not yet for incremental cache mode.
2024-07-12delete dead CLI usage code from main.zigAndrew Kelley
2024-07-07InternPool: implement and use thread-safe list for extra and limbsJacob Young
2024-07-07Zcu: introduce `PerThread` and pass to all the functionsJacob Young
2024-07-06zig ld: handle -v linker argAikawa Yataro
The "-v" argument is the same as "--version", but the linker should not exit after the version is printed.
2024-07-04Zcu: extract permanent state from FileAndrew Kelley
Primarily, this commit removes 2 fields from File, relying on the data being stored in the `files` field, with the key as the path digest, and the value as the struct decl corresponding to the File. This table is serialized into the compiler state that survives between incremental updates. Meanwhile, the File struct remains ephemeral data that can be reconstructed the first time it is needed by the compiler process, as well as operated on by independent worker threads. A key outcome of this commit is that there is now a stable index that can be used to refer to a File. This will be needed when serializing error messages to survive incremental compilation updates.
2024-06-22rename src/Module.zig to src/Zcu.zigAndrew Kelley
This patch is a pure rename plus only changing the file path in `@import` sites, so it is expected to not create version control conflicts, even when rebasing.
2024-06-20Merge pull request #20299 from mlugg/the-great-decl-splitMatthew Lugg
The Great Decl Split (preliminary work): refactor source locations and eliminate `Sema.Block.src_decl`.
2024-06-20Parse WASM linker flags as base 10, like clangAlex Ambrose
Resolves #19536
2024-06-19add error message for `-fno-llvm` `-flld`David Rubin
We plan to remove all dependency on LLD either way, so this will not be a supported usecase.
2024-06-15Sema: eliminate Block.src_declmlugg
🦀 src_decl is gone 🦀 This commit eliminates the `src_decl` field from `Sema.Block`. This change goes further to eliminating unnecessary responsibilities of `Decl` in preparation for its major upcoming refactor. The two main remaining reponsibilities had to do with namespace types: `src_decl` was used to determine their line number and their name. The former use case is solved by storing the line number alongside type declarations (and reifications) in ZIR; this is actually more correct, since previously the line number assigned to the type was really the line number of the source declaration it was syntactically contained within, which does not necessarily line up. Consequently, this change makes debug info for namespace types more correct, although I am not sure how debuggers actually utilize this line number, if at all. Naming types was solved by a new field on `Block`, called `type_name_ctx`. In a sense, it represents the "namespace" we are currently within, including comptime function calls etc. We might want to revisit this in future, since the type naming rules seem to be a bit hand-wavey right now. As far as I can tell, there isn't any more preliminary work needed for me to start work on the behemoth task of splitting `Zcu.Decl` into the new `Nav` (Named Addressable Value) and `Cau` (Comptime Analysis Unit) types. This will be a sweeping change, impacting essentially every part of the pipeline after `AstGen`.
2024-06-02Replace YES_COLOR with CLICOLOR_FORCECarl Ã…stholm
Instead of introducing YES_COLOR, a completely new standard, into the mix it might make more sense to instead tag along with the CLICOLOR_FORCE env var, which dates back to at least 2000 with FreeBSD 4.1.1 and which is supported by tools like CMake. <https://bixense.com/clicolors/>
2024-06-02zig run: finish progress node before executing childAndrew Kelley
also lock stderr for good measure. it's generally a good idea to lock stderr when you are spawning and waiting for a child that inherits stderr.
2024-05-29rename zig-cache to .zig-cacheAndrew Kelley
closes #20077
2024-05-27CLI: actually fix translate-c creating root progress node twiceAndrew Kelley
7281cc1d839da6e84bb76fadb2c1eafc22a82df7 did not solve the problem because even when Node.index is none, it still counts as initializing the global Progress object. Just use a normal zig optional, and all is good.
2024-05-27zig build: respect --color argumentAndrew Kelley
`--color off` now disables the CLI progress bar both in the parent process and the build runner process.
2024-05-27fix zig translate-c creating root progress node twiceAndrew Kelley
2024-05-27CLI: add missing call to root progress node end()Andrew Kelley
cleans up unwanted "LLVM Emit Object" being left on the screen
2024-05-27zig build: give a root progress nameAndrew Kelley
Now it's more clear when zig is building the build script vs building the actual project.
2024-05-27zig build: lock stderr while executing the build runnerAndrew Kelley
2024-05-27main: avoid creating multiple std.Progress instancesAndrew Kelley
2024-05-27update the codebase for the new std.Progress APIAndrew Kelley
2024-05-26std: restructure child process namespaceAndrew Kelley
2024-05-11`zig fetch`: resolve branch/tag names to commit SHA (#19941)Christofer Nolander
* Revert "Revert "Merge pull request #19349 from nolanderc/save-commit"" This reverts commit 6ca4ed5948d8eaab28fc5e3706aeb1b113a210af. * update to new URI changes, rework `--save` type * initialize `latest_commit` to null everywhere
2024-05-10Revert "Merge pull request #19349 from nolanderc/save-commit"Andrew Kelley
This reverts commit 7fa2357d0586cef742bf691d69a6cffdd353b496, reversing changes made to cb77bd672c3b398e3c5f6be80af03243bf8638e3.
2024-05-10Merge pull request #19349 from nolanderc/save-commitAndrew Kelley
`zig fetch`: resolve branch/tag names to commit SHA
2024-05-09handle visionos target OS tag in the compilerJakub Konka
* rename .xros to .visionos as agreed in the tracking issue * add support for VisionOS platform in the MachO linker
2024-05-08add a debug subcommand for printing LLVM integer type alignmentAndrew Kelley
Useful when debugging why upgrading from LLVM 17 to 18 caused C ABI regressions. Turns out LLVM 18 does the following insane thing: ```diff -[nix-shell:~/dev/zig/build-llvm17]$ stage4/bin/zig llvm-ints i386-linux-musl +[nix-shell:~/src/zig/build-llvm18]$ stage4/bin/zig llvm-ints i386-linux-musl LLVMABIAlignmentOfType(i1) == 1 LLVMABIAlignmentOfType(i8) == 1 LLVMABIAlignmentOfType(i16) == 2 LLVMABIAlignmentOfType(i32) == 4 LLVMABIAlignmentOfType(i64) == 4 -LLVMABIAlignmentOfType(i128) == 4 -LLVMABIAlignmentOfType(i256) == 4 +LLVMABIAlignmentOfType(i128) == 16 +LLVMABIAlignmentOfType(i256) == 16 ```
2024-05-08add detect-cpu subcommand for debugging CPU featuresAndrew Kelley
This brings back `detectNativeCpuWithLLVM` so that we can troubleshoot during LLVM upgrades. closes #19793
2024-05-03introduce std.process.raiseFileDescriptorLimitAndrew Kelley
2024-05-03add std.Thread.Pool.spawnWgAndrew Kelley
This function accepts a WaitGroup parameter and manages the reference counting therein. It also is infallible. The existing `spawn` function is still handy when the job wants to further schedule more tasks.
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.
2024-04-18std.Build: revert --host-target, --host-cpu, --host-dynamic-linkerAndrew Kelley
This is a partial revert of 105db13536b4dc2affe130cb8d2eee6c97c89bcd. As we learned from Void Linux packaging, these options are not actually helpful since the distribution package manager may very well want to cross-compile the packages that it is building. So, let's not overcomplicate things. There are already the standard options: -Dtarget, -Dcpu, and -Ddynamic-linker. These options are generally provided when the project generates machine code artifacts, however, there may be a project that does no such thing, in which case it makes sense for these options to be missing. The Zig Build System is a general-purpose build system, after all.
2024-04-07Update usages of `fmtId`/`isValidId`Carl Ã…stholm
`{}` for decls `{p}` for enum fields `{p_}` for struct fields and in contexts following a `.` Elsewhere, `{p}` was used since it's equivalent to the old behavior.
2024-04-06fix number of arguments preallocation in zig jit subcommandJosh Wolfe
crash repo: `zig std 1 2 3 4 5` (in a debug build)
2024-03-30cbe: rewrite `CType`Jacob Young
Closes #14904
2024-03-27mingw: support -municodeElaine Gibson
2024-03-22Merge pull request #19388 from ziglang/cache-dedupAndrew Kelley
cache system file deduplication
2024-03-21move Package.Path to std.Build.Cache.PathAndrew Kelley
2024-03-21main: set subsystem version from target windows versionElaine Gibson
2024-03-21`zig fetch`: resolve ref to commit by defaultChristofer Nolander
Stores the original ref as a query parameter in the URL so that it is possible to automatically check the upstream if there are any newer commits. Also adds a flag which opts-out of the new behaivour, restoring the old.
2024-03-19fix compilation failures found by CIAndrew Kelley
2024-03-19compiler: fix wrong detection of rlimitAndrew Kelley
related to #19352
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-03-18`zig fetch`: resolve branch/tag names to commit SHAChristofer Nolander
2024-03-17Revert "back out the build_runner.zig moving change"Jacob Young
This reverts commit 1a01151a4e1e83826d6911c929210aabcaed36e9 in preparation for a zig1.wasm update.
2024-03-14reduce garbage for repeated `zig cc -` callsMotiejus Jakštys
Context: user provides `-` to read from stdin instead of a file. Before: it would create a file in $ZIG_LOCAL_CACHE_DIR/tmp/ for each invocation and leave it there. After: it hashes the file contents and renames the file to the hash. Result: repeated invocations of `zig cc` do not cause so much trash to be created.