Commit graph

596 commits

Author SHA1 Message Date
Andrew Kelley
1eb729b9b9 Reapply "build: Don't check parent directories for git tag"
This reverts commit 7e0c25eccd.

The `--git-dir` argument is relative to the `-C` argument, making this
patch OK after all.

I added a comment to go along with this since I found it confusing.

Apologies for the revert.
2025-03-08 12:34:13 -08:00
Andrew Kelley
7e0c25eccd Revert "build: Don't check parent directories for git tag"
This reverts commit 21620f3c65.

This breaks running `zig build` from subdirectories.
2025-03-08 11:15:44 -08:00
LN Liberda
21620f3c65 build: Don't check parent directories for git tag
Sometimes Zig is built not from a git repository (e.g. from tarball), but inside another git repository (e.g. distro package repository). Make sure that the version check tries to parse a tag of Zig, and not of a parent directory.
2025-03-08 17:54:50 +00:00
Jan200101
013a228960 std.Build: add build-id option 2025-03-07 10:59:02 +01:00
Andrew Kelley
05937b362a start the 0.15.0 release cycle 2025-03-04 14:31:32 -08:00
Alex Rønne Petersen
481b7bf3f0
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:

* It's not immediately obvious to a reader whether target.isDarwin() means the
  same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
  functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
  this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
  Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.
2025-02-17 19:18:19 +01:00
Andrew Kelley
ea1ce2df9b
Merge pull request #22808 from ziglang/fast-gpa
introduce std.heap.SmpAllocator
2025-02-08 04:54:38 -08:00
Andrew Kelley
8453fb09a2 build: bump max_rss of std lib tests to 5G 2025-02-07 23:35:31 -08:00
Andrew Kelley
7360be19a4 compiler: use std.heap.smp_allocator
In main, now this allocator is chosen by default when compiling without
libc in ReleaseFast or ReleaseSmall, and not targeting WebAssembly.
2025-02-07 14:41:49 -08:00
Jacob Young
fa9b0fa6d3 x86_64: rewrite most of the remaining float ops 2025-02-06 16:14:53 -05:00
Matthew Lugg
317722b37b
Merge pull request #20271 from MasonRemaley/zon
ZON
2025-02-03 16:38:35 +00:00
Alex Rønne Petersen
e61acd8eb5
Merge pull request #22713 from mikdusan/openbsd
openbsd: fix stage3 link
2025-02-03 17:34:55 +01:00
Mason Remaley
13c6eb0d71
compiler,std: implement ZON support
This commit allows using ZON (Zig Object Notation) in a few ways.

* `@import` can be used to load ZON at comptime and convert it to a
  normal Zig value. In this case, `@import` must have a result type.
* `std.zon.parse` can be used to parse ZON at runtime, akin to the
  parsing logic in `std.json`.
* `std.zon.stringify` can be used to convert arbitrary data structures
  to ZON at runtime, again akin to `std.json`.
2025-02-03 09:14:37 +00:00
Michael Dusan
127b0921ba
openbsd: fix stage3 link
- llvm requires libexecinfo which has conflicting symbols with libc++abi
- workaround is to link c++abi dynamically
2025-02-01 12:16:21 -05:00
Jacob Young
4c5abe5ac6 x86_64: rewrite vector @intCast 2025-01-31 23:09:58 -05:00
Alex Rønne Petersen
015a5e1982 std.Build: Make ofmt part of standardTargetOptions(). 2025-01-25 20:39:10 +01:00
Alex Rønne Petersen
35e804bfb8
wasm2c: Implement nontrapping_fptoint support. 2025-01-22 20:56:30 +01:00
Alex Rønne Petersen
ea1502974d
wasm: Add a nontrapping_bulk_memory_len0 feature.
This will mainly be used when targeting our wasm2c implementation which has no
problem with zero-length bulk memory operations, as a non-standard extension.
2025-01-22 20:56:28 +01:00
Alex Rønne Petersen
280ced66eb
std.Target: Define and use lime1 as the baseline CPU model for WebAssembly.
See: https://github.com/WebAssembly/tool-conventions/pull/235

This is not *quite* using the same features as the spec'd lime1 model because
LLVM 19 doesn't have the level of feature granularity that we need for that.
This will be fixed once we upgrade to LLVM 20.

Part of #21818.
2025-01-22 03:01:05 +01:00
mlugg
b6abe1dbf7
compiler: make it easier to apply breaking changes to std.builtin
Documentation for this will be on the wiki shortly.

Resolves: #21842
2025-01-16 12:49:48 +00:00
Andrew Kelley
1afa6e260e build: respect -Duse-llvm option when doing behavior tests 2025-01-15 15:11:36 -08:00
Andrew Kelley
b36ea592b8 build.zig: make unit tests not use the full matrix 2025-01-10 06:03:57 -05:00
mlugg
6a837e64cf
compiler: bump stack size 32 MiB -> 46 MiB
Before the prior commit, the maximum comptime recursion depth on my
system was 4062. After the prior commit, it decreased to 2854. This
commit increases the compiler's stack size enough so that the recursion
depth limit is no less than it was before the `Sema.analyzeCall`
rewrite, preventing this from being a breaking change. Specifically,
this stack size increases my observed maximum comptime recursion depth
to 4105.
2025-01-10 05:41:21 +00:00
mlugg
93af1de050
build.zig: migrate from deprecated std.Build APIs 2024-12-18 01:48:55 +05:00
Carl Åstholm
b352595aa2 Add compiler internals tests
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-13 08:49:02 -05:00
Alex Rønne Petersen
1f95e3d9cd build.zig: Also set code model for loongarch32.
This issue applies to both loongarch32 and loongarch64.
2024-12-07 22:21:35 +01:00
Justin Braben
07cd488d42
Add build option to set tracy-callstack-depth in build.zig (#21990) 2024-11-29 12:13:06 -08:00
Alex Rønne Petersen
9d10246a80
test: Enable -Dtest-target-filter=... to work for test-debugger. 2024-11-24 22:11:17 +01:00
Alex Rønne Petersen
2a29381117
test: Enable -Dtest-target-filter=... to work for test-cases and test-translate-c. 2024-11-24 22:11:17 +01:00
Alex Rønne Petersen
9c7776a938
test: Enable -Dtest-target-filter=... to work for test-c-abi. 2024-11-24 22:11:17 +01:00
Jacob Young
41282e7fb2 build.zig: fix libc++ being a linker script 2024-11-17 00:55:36 -05:00
kcbanner
f2b81f57f4 build: increase max_rss to 7.8G 2024-11-05 10:03:04 -08:00
Krzysztof Wolicki
008acd0547
Replace tidy with superhtml as HTML validator (#21664)
Also add `$HOME/local/bin` to `PATH` in linux CI
2024-10-11 21:27:30 -07:00
mlugg
f60c045cef
tests: add test-incremental step
This is contained in the `test` step, so is tested by CI.

This commit also includes some enhancements to the `incr-check` tool to
make this work correctly.
2024-10-05 20:52:25 +01:00
Andrew Kelley
a3a8a266ef add missing clang and llvm library listings 2024-09-19 18:20:21 -07:00
YANG Xudong
c34cfe486d
loongarch: use medium code model for zig loongarch64 binary (#21153) 2024-08-31 20:59:24 -07:00
Jacob Young
ef11bc9899 Dwarf: rework self-hosted debug info from scratch
This is in preparation for incremental and actually being able to debug
executables built by the x86_64 backend.
2024-08-16 15:22:55 -04:00
Alex Rønne Petersen
927bc55629
build/test: Add a test-modules step for running all the per-target tests.
This is useful during porting work where you're mainly concerned with tests that
e.g. run under QEMU. Combine with the new -Dtest-target-filter for an even more
streamlined workflow.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen
b6009a7416
build/test: Add -Dtest-slow-targets and move mips module tests behind it.
The idea is that these tests are just too slow to include by default on a
contributor's local machine. If they want to run these, they need to opt in.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen
3b51b43dc8
build/test: Add -Dtest-target-filter for filtering module tests by target triple.
This is useful during porting work where you're not interested in running all
targets all the time while iterating on changes.
2024-08-14 07:03:23 +02:00
Alex Rønne Petersen
4a2b23c2be
build: Use the new b.addFail() for the update-mingw step.
This is precisely the kind of use case it was added for.
2024-08-14 07:03:23 +02:00
Jakub Konka
59733374ed build: bump max_rss since we link MachO in parallel now 2024-07-22 12:06:02 +02:00
Jacob Young
4f742c4cfc dev: introduce dev environments that enable compiler feature sets 2024-07-19 22:35:33 -07:00
Jakub Konka
d19aab2e87 macho: bump max rss by a slight margin 2024-07-18 09:13:09 +02:00
Andrew Kelley
ddc399440d build.zig: expose valgrind flag
Allows to enable Valgrind integrations in release builds, sometimes
useful in combination with tooling.
2024-07-16 23:07:34 -07:00
Andrew Kelley
a3c20dffae integrate Compile steps with file watching
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-12 00:14:08 -07:00
Andrew Kelley
d1c14f2f52 std.Build.Step.WriteFile: extract UpdateSourceFiles
This has been planned for quite some time; this commit finally does it.

Also implements file system watching integration in the make()
implementation for UpdateSourceFiles and fixes the reporting of step
caching for both.

WriteFile does not yet have file system watching integration.
2024-07-12 00:14:08 -07:00
mlugg
0e5335aaf5
compiler: rework type resolution, fully resolve all types
I'm so sorry.

This commit was just meant to be making all types fully resolve by
queueing resolution at the moment of their creation. Unfortunately, a
lot of dominoes ended up falling. Here's what happened:

* I added a work queue job to fully resolve a type.
* I realised that from here we could eliminate `Sema.types_to_resolve`
  if we made function codegen a separate job. This is desirable for
  simplicity of both spec and implementation.
* This led to a new AIR traversal to detect whether any required type is
  unresolved. If a type in the AIR failed to resolve, then we can't run
  codegen.
* Because full type resolution now occurs by the work queue job, a bug
  was exposed whereby error messages for type resolution were associated
  with the wrong `Decl`, resulting in duplicate error messages when the
  type was also resolved "by" its owner `Decl` (which really *all*
  resolution should be done on).
* A correct fix for this requires using a different `Sema` when
  performing type resolution: we need a `Sema` owned by the type. Also
  note that this fix is necessary for incremental compilation.
* This means a whole bunch of functions no longer need to take `Sema`s.
  * First-order effects: `resolveTypeFields`, `resolveTypeLayout`, etc
  * Second-order effects: `Type.abiAlignmentAdvanced`, `Value.orderAgainstZeroAdvanced`, etc

The end result of this is, in short, a more correct compiler and a
simpler language specification. This regressed a few error notes in the
test cases, but nothing that seems worth blocking this change.

Oh, also, I ripped out the old code in `test/src/Cases.zig` which
introduced a dependency on `Compilation`. This dependency was
problematic at best, and this code has been unused for a while. When we
re-enable incremental test cases, we must rewrite their executor to use
the compiler server protocol.
2024-07-04 21:01:42 +01:00
Andrew Kelley
1e9e29398a disable tidy validation for autodocs
tidy gives a false positive:

line 304 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.

I noticed that `--show-warnings no` still incorrectly causes exit code 1.
I was unable to find an alternative to tidy.
2024-06-17 00:10:35 -07:00
Andrew Kelley
651225c2d4 add -Denable-tidy flag and use it in the CI
Eliminates a TODO from the CI scripts; makes it easier to check validity
of html when working on the langref locally.
2024-06-17 00:10:35 -07:00