aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-12-24delete aro dependencysans-aroAndrew Kelley
translate-c is moving towards a package provided by the build system (#20630). The repository https://github.com/ziglang/translate-c/ implements C translation using Aro. This commit deletes the Aro implementation of C translation from the Zig repository, leaving only the Clang implementation. The other dependency on Aro is for the preprocessor. This must move to `std.zig.Preprocessor`, be untangled from Aro, and independently maintained. There must also be added a Preprocessor Build Step, which this commit does not do. Furthermore, the preprocessor must be exposed as a zig compiler JIT command rather than always being compiled into the compiler. This will reduce binary size and time spent waiting for zig to build.
2024-12-23Merge pull request #22280 from jacobly0/stage2-ppAndrew Kelley
lldb: add more stage2 pretty printers
2024-12-23Merge pull request #22225 from alexrp/libc-linux-os-versionAlex Rønne Petersen
Attach minimum Linux versions to provided libcs + incorporate ABI in `VersionRange.default()`
2024-12-22compiler: Print more information when failing to provide libc.Alex Rønne Petersen
2024-12-20lldb: add pretty printer for cau and nav indicesJacob Young
2024-12-20lldb: add pretty printer for intern pool indicesJacob Young
2024-12-19Dwarf: remove redundant debug infoJacob Young
2024-12-19Module: keep frame pointer in ReleaseSmall on x86wooster0
On x86 and x86_64 keeping the frame pointer usually reduces binary size, even for simple programs: ``` ~$ cat x.zig pub fn main() void { @import("std").debug.print("hello", .{}); } ~$ zig build-exe x.zig -target x86_64-linux -OReleaseSmall -fno-omit-frame-pointer && wc -c x 5168 x ~$ zig build-exe x.zig -target x86_64-linux -OReleaseSmall -fomit-frame-pointer && wc -c x 5216 x ``` ``` ~$ cat x.zig pub fn main() void { @import("std").debug.print("hello", .{}); } ~$ zig build-exe x.zig -target x86-linux -OReleaseSmall -fno-omit-frame-pointer && wc -c x 3400 x ~$ zig build-exe x.zig -target x86-linux -OReleaseSmall -fomit-frame-pointer && wc -c x 3556 x ``` A bigger benchmark is the Zig compiler: With no changes to anything on master branch: ``` $ zig build -Dno-lib -Dno-langref --zig-lib-dir lib -Doptimize=ReleaseSmall $ wc -c zig-out/bin/zig 10698792 zig-out/bin/zig ``` Adding `.omit_frame_pointer = false` in `addCompilerStep` in `build.zig`: ``` $ zig build -Dno-lib -Dno-langref --zig-lib-dir lib -Doptimize=ReleaseSmall $ wc -c zig-out/bin/zig 10155744 zig-out/bin/zig ```
2024-12-19Zcu: allow `node_offset_var_decl_*` source location for function declarationsmlugg
2024-12-19compiler: disallow `align` etc annotations on comptime-only globalsmlugg
This includes function aliases, but not function declarations. Also, re-introduce a target check for function alignment which was inadvertently removed in the prior commit.
2024-12-18compiler: disallow `callconv` etc from depending on function parametersmlugg
Resolves: #22261
2024-12-18compiler: move `RuntimeIndex` to `Sema`mlugg
Just a small refactor.
2024-12-17Zir: store declaration column number so Dwarf doesn't need to load the ASTmlugg
Resolves: #21227
2024-12-17InternPool: fix typoJacob Young
2024-12-17Dwarf: deleting bad code until I remember what it doesJacob Young
2024-12-17Dwarf: fix data races by reading from ZIRJacob Young
2024-12-17Merge pull request #22252 from jacobly0/dwarf-deduped-structsAndrew Kelley
Dwarf: preserve deduped struct navs
2024-12-17Merge pull request #22251 from alexrp/remove-cudaAndrew Kelley
`zig cc`: Remove broken CUDA C/C++ support.
2024-12-16Merge pull request #22250 from mlugg/zon-astMatthew Lugg
compiler: introduce ZonGen and make `ast-check` run it for ZON inputs
2024-12-16Dwarf: include comptime-only values in debug infoJacob Young
2024-12-16InternPool: we have pointer subtraction now!Jacob Young
2024-12-16Dwarf: preserve deduped struct navsJacob Young
Previously, if multiple navs owned the same type due to being the same zir node and having the same captures, they would overwrite each other. Now, the navs codegenned later emit a decl alias to the first one.
2024-12-16compiler: introduce ZonGen and make `ast-check` run it for ZON inputsmlugg
Currently, `zig ast-check` fails on ZON files, because it tries to interpret the file as Zig source code. This commit introduces a new verification pass, `std.zig.ZonGen`, which applies to an AST in ZON mode. Like `AstGen`, this pass also converts the AST into a more helpful format. Rather than a sequence of instructions like `Zir`, the output format of `ZonGen` is a new datastructure called `Zoir`. This type is essentially a simpler form of AST, containing only the information required for consumers of ZON. It is also far more compact than `std.zig.Ast`, with the size generally being comparable to the size of the well-formatted source file. The emitted `Zoir` is currently not used aside from the `-t` option to `ast-check` which causes it to be dumped to stdout. However, in future, it can be used for comptime `@import` of ZON files, as well as for simpler handling of files like `build.zig.zon`, and even by other parts of the Zig Standard Library. Resolves: #22078
2024-12-16std.c.darwin.posix_spawn: fix signaturemlugg
And change corresponding signature in `DarwinPosixSpawn`.
2024-12-16compiler: add some missing `const`smlugg
The previous commit exposed some missing `const` qualifiers in a few places. These mutable slices could have been used to store invalid values into memory!
2024-12-16Sema: disallow unsafe in-memory coercionsmlugg
The error messages here aren't amazing yet, but this is an improvement on status quo, because the current behavior allows false negative compile errors, so effectively miscompiles. Resolves: #15874
2024-12-16Merge pull request #22245 from mlugg/zir-no-doc-commentsMatthew Lugg
compiler: remove doc comments from Zir
2024-12-16mingw: Fix CFLAGS for winpthreads.Alex Rønne Petersen
It should not use the CRT ones, and it also needs a few flags of its own that I forgot to add in #22156. Follow-up fix for #10989.
2024-12-15Merge pull request #22233 from jacobly0/fix-relocsAndrew Kelley
Elf.Atom: fix truncated dyn abs relocs
2024-12-15compiler: remove doc comments from Zirmlugg
This code was left over from the legacy Autodoc implementation. No component of the compiler pipeline actually requires doc comments, so it is a waste of time and space to store them in ZIR.
2024-12-15Sema: disallow runtime stores to pointers with comptime-only element typesmlugg
2024-12-15Sema: do not allow coercing undefined to opaque typesmlugg
2024-12-15zig cc: Remove broken CUDA C/C++ support.Alex Rønne Petersen
2024-12-14Elf: fix shdr size getting out of sync with the actual sizeJacob Young
2024-12-14Elf.Atom: fix truncated dyn abs relocsJacob Young
2024-12-15Merge pull request #22224 from alexrp/cc-argsAlex Rønne Petersen
`Compilation`: Clean up `addCCArgs()` + some minor improvements
2024-12-14ensure `InstMap` capacity before remapping error codeDavid Rubin
2024-12-14Merge pull request #22222 from ianprime0509/git-sha256Andrew Kelley
zig fetch: add support for SHA-256 Git repositories
2024-12-14mingw: Update sources list to dcd7fefc703fb4b12187235386900d34cc13fdc5.Alex Rønne Petersen
2024-12-14Compilation: Clean up addCCArgs().Alex Rønne Petersen
The goal of this commit is to get rid of some "unused command line argument" warnings that Clang would give for various file types previously. This cleanup also has the side effect of making the order of flags more understandable, especially as it pertains to include paths. Since a lot of code was shuffled around in this commit, I recommend reviewing the old and new versions of the function side-by-side rather than trying to make sense of the diff.
2024-12-13zig fetch: support SHA-256 Git repositoriesIan Johnson
Closes #21888
2024-12-13Remove copy of `HashedWriter`Ian Johnson
It was added to the standard library in #18733.
2024-12-13Fix undefined behavior in package extraction codeCarl Åstholm
2024-12-13Add compiler internals testsCarl Åstholm
There are several test decls inside `/src` that are not currently being tested and have bitrotted as a result. This commit revives those tests and adds the `test-compiler-internals` set of tests which tests everything reachable from `/src/main.zig`.
2024-12-13Compilation: Use Clang dependency file for preprocessed assembly files.Alex Rønne Petersen
2024-12-13Compilation: Use a better canonical file extension for header files.Alex Rønne Petersen
2024-12-13Compilation: Override Clang's language type for header files.Alex Rønne Petersen
Clang seems to treat them as linker input without this.
2024-12-13Compilation: Improve classification of various C/C++/Objective-C files.Alex Rønne Petersen
2024-12-13Merge pull request #22035 from alexrp/unwind-fixesAlex Rønne Petersen
Better unwind table support + unwind protection in `_start()` and `clone()`
2024-12-11std.Build.Cache.hit: work around macOS kernel bugAndrew Kelley
The previous commit cast doubt upon the initial report about macOS kernel behavior, identifying another reason that ENOENT could be returned from file creation. However, it is demonstrable that ENOENT can be returned for both cases: 1. create file race 2. handle refers to deleted directory This commit re-introduces the workaround for the file creation race on macOS however it does not unconditionally retry - it first tries again with O_EXCL to disambiguate the error condition that has occurred.