Commit graph

424 commits

Author SHA1 Message Date
Andrew Kelley
9adcc31ca3 update tools and other miscellaneous things to new APIs 2025-08-30 00:48:50 -07:00
Andrew Kelley
79f267f6b9 std.Io: delete GenericReader
and delete deprecated alias std.io
2025-08-29 17:14:26 -07:00
Andrew Kelley
f7884961c2 update more to avoid GenericWriter 2025-08-28 18:30:57 -07:00
mlugg
a31950aa57 std.debug: remove @frameAddress() "UAF"
We can't call `@frameAddress()` and then immediately `return`! That
invalidates the frame. This *usually* isn't a problem, because the stack
walk `next` call will *probably* have a stack frame and it will
*probably* be at the exact same address, but neither of those is a
guarantee. On powerpc, presumably some unfortunate inlining was going
on, so this frame was indeed invalidated when we started walking frames.

We need to explicitly pass `@frameAddress` into any function which will
return before we actually walk the stack. Pretty simple patch.

Resolves: #24970
2025-08-28 10:56:11 +01:00
Andrew Kelley
ef14c73245 Compilation: remove last instance of deprecatedReader
This also makes initStreaming preemptively disable file size checking.
2025-08-16 14:46:20 -07:00
Andrew Kelley
2201f74d7f disable failing test on windows
tracked by #24867
2025-08-15 13:34:19 -07:00
Alex Rønne Petersen
6317417fe1
test: enable tsan test for x86_64-netbsd 2025-08-14 08:25:50 +02:00
Alex Rønne Petersen
662303d7e7
Merge pull request #24734 from Rexicon226/tsan-fix 2025-08-13 08:57:52 +02:00
Andrew Kelley
749f10af49 std.ArrayList: make unmanaged the default 2025-08-11 15:52:49 -07:00
David Rubin
826b33863f test: add a standalone test for compiling tsan 2025-08-11 03:02:54 +02:00
Alex Rønne Petersen
7ee6dab39f Revert "Sema: Stop adding Windows implib link inputs for extern "..." syntax."
This reverts commit b461d07a54.

After some discussion in the team, we've decided that this is too disruptive,
especially because the linker errors are less than helpful. That's a fixable
problem, so we might reconsider this in the future, but revert it for now.
2025-08-06 06:15:13 +02:00
Alex Rønne Petersen
a5f891d0b3
Merge pull request #24562 from h57624paen/fix-win-spawn-double-normalize
std.process.Child: fix double path normalization in spawnWindows
2025-08-03 11:19:10 +02:00
Ivan
dea3ed7f59
build: fix error in standalone test when using --release
Co-authored-by: Carl Åstholm <carl@astholm.se>
2025-07-28 08:10:23 +01:00
Carl Åstholm
154bd2fd05 Migrate from deprecated Step.Compile APIs 2025-07-26 12:06:43 +02:00
Ryan Liptak
0f4106356e child_process standalone test: Test spawning a path with leading ..
Also check that FileNotFound is consistently returned when the path is missing.

The new `run_relative` step will test spawning paths like:

    child_path: ../84385e7e669db0967d7a42765011dbe0/child
    missing_child_path: ../84385e7e669db0967d7a42765011dbe0/child_intentionally_missing
2025-07-26 01:35:15 -04:00
lumanetic
afa66f6111 std.process.Child: fix double path normalization in spawnWindows
besides simply being redundant work, the now removed normalize call would cause
spawn to errantly fail (BadPath) when passing a relative path which traversed
'above' the current working directory. This case is already handled by leaving
normalization to the windows.wToPrefixedFileW call in
windowsCreateProcessPathExt
2025-07-26 01:34:19 -04:00
Andrew Kelley
9e11727c7c
Merge pull request #23340 from castholm/pass-null-to-b-dependency
Add support for passing null, string literals, enum lists and more to `b.dependency()`
2025-07-25 18:00:46 -07:00
Andrew Kelley
f1576ef14c objcopy: delete most of it
this code is not up to zig project standards

tracked by #24522

oh, and fix not adjusting buffer seek position in std.fs.File.Reader
2025-07-21 12:32:37 -07:00
Carl Åstholm
ca57115da7 Support passing std.zig.BuildId to b.dependency() 2025-07-20 18:28:36 +02:00
Carl Åstholm
2c1a349fb9 Support passing enum slices to b.dependency() 2025-07-20 18:28:36 +02:00
Carl Åstholm
fd5eba9358 Coerce slice-like arguments passed to b.dependency()
You can now pass string literals as options.
2025-07-20 18:28:36 +02:00
Carl Åstholm
5380e81924 Support passing null to b.dependency()
Both null literals and optionals are supported.
2025-07-20 18:28:36 +02:00
Carl Åstholm
00bc72b5ff Add standalone test case for passing options to dependencies 2025-07-20 18:28:36 +02:00
Carl Åstholm
b92b55ab8e Update test build.zig.zon files to conform to the new manifest rules 2025-07-20 18:28:36 +02:00
Andrew Kelley
76d04c1662 zig fmt 2025-07-16 10:27:39 -07:00
Alex Rønne Petersen
11a49868a1
test: actually build the tools! 2025-07-16 06:38:53 +02:00
dweiller
94e0c85b6b update dump-cov for alignment and writergate changes 2025-07-15 23:57:56 +02:00
Linus Groh
eb37552536 Remove numerous things deprecated during the 0.14 release cycle
Basically everything that has a direct replacement or no uses left.

Notable omissions:

- std.ArrayHashMap: Too much fallout, needs a separate cleanup.
- std.debug.runtime_safety: Too much fallout.
- std.heap.GeneralPurposeAllocator: Lots of references to it remain, not
  a simple find and replace as "debug allocator" is not equivalent to
  "general purpose allocator".
- std.io.Reader: Is being reworked at the moment.
- std.unicode.utf8Decode(): No replacement, needs a new API first.
- Manifest backwards compat options: Removal would break test data used
  by TestFetchBuilder.
- panic handler needs to be a namespace: Many tests still rely on it
  being a function, needs a separate cleanup.
2025-07-11 08:17:43 +02:00
Andrew Kelley
d8e26275f2 update standalone and incremental tests to new API 2025-07-07 22:43:53 -07:00
Andrew Kelley
0e37ff0d59 std.fmt: breaking API changes
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-07 22:43:51 -07:00
Andrew Kelley
34f64432b0 remove usingnamespace from the language
closes #20663
2025-07-07 13:39:48 -07:00
Andrew Kelley
aa52bb8327 zig fmt 2025-07-07 13:39:16 -07:00
Alex Rønne Petersen
b461d07a54 Sema: Stop adding Windows implib link inputs for extern "..." syntax.
Closes #23971.
2025-07-06 01:00:18 +02:00
Alex Rønne Petersen
b739fec841
test: Disable stack_iterator test on riscv64-linux
https://github.com/ziglang/zig/issues/24310
2025-07-01 23:03:15 +02:00
Alex Rønne Petersen
1fcabe0bfc
test: Only run coff_dwarf test on aarch64, x86, x86_64
This will just fail if run on architectures like riscv64.
2025-07-01 23:03:15 +02:00
Matthew Lugg
75d0ec9c04
Merge pull request #24227 from mlugg/misc-build-stuff
`std.Build`: more miscellaneous bits
2025-06-20 10:28:38 +01:00
mlugg
a02a2219ee
standalone: add accidentally-excluded test 2025-06-20 00:24:57 +01:00
Jacob Young
917640810e Target: pass and use locals by pointer instead of by value
This struct is larger than 256 bytes and code that copies it
consistently shows up in profiles of the compiler.
2025-06-19 11:45:06 -04:00
mlugg
36499c251c std.Build.Step.Run: prefix relative path arguments with './'
This is necessary in two cases:

* On POSIX, the exe path (`argv[0]`) must contain a path separator
* Some programs might treat a file named e.g. `-foo` as a flag, which
  can be avoided by passing `./-foo`

Rather than detecting these two cases, just always include the prefix;
there's no harm in it.

Also, if the cwd is specified, include it in the manifest. If the user
has set the cwd of a Run step, it is clearly because this affects the
behavior of the executable somehow, so that cwd path should be a part of
the step's manifest.

Resolves: #24216
2025-06-18 22:45:05 +01:00
Matthew Lugg
850655f06b
Merge pull request #24205 from mlugg/misc-build-stuff
`std.Build`: some miscelleanous bits
2025-06-17 19:58:10 +01:00
mlugg
8aab222ffb Compilation: add missing link file options to cache manifest
Also add a standalone test which covers the `-fentry` case. It does this
by performing two reproducible compilations which are identical other
than having different entry points, and checking whether the emitted
binaries are identical (they should *not* be).

Resolves: #23869
2025-06-17 15:33:50 +01:00
mlugg
f3c0555975
std.Build: introduce ConfigHeader.getOutputDir, small refactor
`std.Build.Step.ConfigHeader` emits a *directory* containing a config
header under a given sub path, but there's no good way to actually
access that directory as a `LazyPath` in the configure phase. This is
silly; it's perfectly valid to refer to that directory, perhaps to
explicitly pass as a "-I" flag to a different toolchain invoked via a
`Step.Run`. So now, instead of the `GeneratedFile` being the actual
*file*, it should be that *directory*, i.e. `cache/o/<digest>`. We can
then easily get the *file* if needed just by using `LazyPath.path` to go
"deeper", which there is a helper function for.

The legacy `getOutput` function is now a deprecated alias for
`getOutputFile`, and `getOutputDir` is introduced.

`std.Build.Module.IncludeDir.appendZigProcessFlags` needed a fix after
this change, so I took the opportunity to refactor it a little. I was
looking at this function while working on ziglang/translate-c yesterday
and realised it could be expressed much more simply -- particularly
after the `ConfigHeader` change here.

I had to update the test `standalone/cmakedefine/` -- it turns out this
test was well and truly reaching into build system internals, and doing
horrible not-really-allowed stuff like overriding the `makeFn` of a
`TopLevelStep`. To top it all off, the test forgot to set
`b.default_step` to its "test" step, so the test never even ran. I've
refactored it to follow accepted practices and to actually, like, work.
2025-06-17 11:55:36 +01:00
mlugg
5c8b92db7f
tests: do not require absolute paths from the build system
File arguments added to `std.Build.Step.Run` with e.g. `addFileArg` are
not necessarily passed as absolute paths. It used to be the case that
they were as a consequence of an unnecessary path conversion done by the
frontend, but this no longer happens, at least not always, so these
tests were sometimes failing when run locally. Therefore, the standalone
tests must handle cwd-relative CLI paths correctly.
2025-06-13 15:46:43 +01:00
Jacob Young
37f763560b x86_64: fix switch dispatch bug
Also closes #23902
2025-06-06 23:42:15 -07:00
mlugg
f28ef7ee29 tests: extern threadlocals require LLVM
This is a current limitation of our self-hosted linkers.
2025-06-06 23:42:15 -07:00
Jacob Young
cdba1d591a test-cli: port build options test to new build system API
Since we need testing for passing `--build-file` and `--cache-dir`
together anyway, use it to test the disabled build options test.
2025-05-20 23:02:51 -04:00
Alex Rønne Petersen
b27c5fbbde
Merge pull request #23913 from alexrp/netbsd-libc
Support dynamically-linked NetBSD libc when cross-compiling
2025-05-20 07:46:08 +02:00
Matthew Lugg
23c817548b
Merge pull request #23836 from mlugg/incr-fixes
Incremental fixes, refactor `Zcu.File`
2025-05-20 03:25:19 +01:00
tjog
ad1e09eab0 libfuzzer test: use proper cache dir logic 2025-05-19 04:03:16 +02:00
mlugg
e26c326996
tests: remove incorrect import 2025-05-18 17:10:04 +01:00