7499 Commits

Author SHA1 Message Date
Andrew Kelley
38840e2e58 build system: follow-up enhancements regarding LazyPath
* introduce LazyPath.cwd_relative variant and use it for --zig-lib-dir. closes #12685
* move overrideZigLibDir and setMainPkgPath to options fields set once
  and then never mutated.
* avoid introducing Build/util.zig
* use doc comments for deprecation notices so that they show up in
  generated documentation.
* introduce InstallArtifact.Options, accept it as a parameter to
  addInstallArtifact, and move override_dest_dir into it. Instead of
  configuring the installation via Compile step, configure the
  installation via the InstallArtifact step. In retrospect this is
  obvious.
* remove calls to pushInstalledFile in InstallArtifact. See #14943
* rewrite InstallArtifact to not incorrectly observe whether a Compile
  step has any generated outputs. InstallArtifact is meant to trigger
  output generation.
* fix child process evaluation code handling of `-fno-emit-bin`.
* don't store out_h_filename, out_ll_filename, etc., pointlessly. these
  are all just simple extensions appended to the root name.
* make emit_directory optional. It's possible to have nothing outputted,
  for example, if you're just type-checking.
* avoid passing -femit-foo/-fno-emit-foo when it is the default
* rename ConfigHeader.getTemplate to getOutput
* deprecate addOptionArtifact
* update the random number seed of Options step caching.
* avoid using `inline for` pointlessly
* avoid using `override_Dest_dir` pointlessly
* avoid emitting an executable pointlessly in test cases

Removes forceBuild and forceEmit. Let's consider these additions separately.
Nearly all of the usage sites were suspicious.
2023-07-30 11:19:32 -07:00
Felix "xq" Queißner
f8386de7ae Tries to fix Windows DLL linking. 2023-07-30 11:18:50 -07:00
Felix "xq" Queißner
35d0a49db9 Introduces Compile.forceBuild() and Compile.forceEmit(…) 2023-07-30 11:18:50 -07:00
Felix (xq) Queißner
5c01818410 Introduces Compile.getEmittedX() functions, drops Compile.emit_X. Resolves #14971 2023-07-30 11:18:50 -07:00
Felix (xq) Queißner
ce95a3b153 Build.zig rename orgy (aka: #16353). Renames FileSource to LazyPath and removes functions that take literal paths instead of LazyPath. 2023-07-30 11:18:50 -07:00
Andrew Kelley
b8dda2dbe1
Merge pull request #16594 from squeek502/windows-sdk-com
windows_sdk.zig: Reinstate COM ISetupEnumInstances logic
2023-07-29 09:47:39 -07:00
Jacob Young
e8e9a4ac66 Build: use optionals again
Closes #14952
2023-07-28 21:43:07 -07:00
Ryan Liptak
8579f720b0 windows_sdk.zig: Reinstate COM ISetupEnumInstances logic
The C++ version of this code used this logic, and it turns out it is able to find some setups that the current registry/Vs7 methods cannot.

For example, if only the "Build Tools for Visual Studio" are installed but not Visual Studio itself, then only the ISetupEnumInstances method seems to find it.

Follow up to #15657, fixes a regression caused by moving from the C++ version to the Zig version
2023-07-28 19:19:32 -07:00
Zachary Raineri
423c1221f9 std.target | Remove comment referencing closed proposal
Removes a comment referencing #425 which has been closed
2023-07-28 19:02:48 -07:00
Zachary Raineri
6604952ec3 std.start | Remove unused import
Removes the unused import tlcsprng
2023-07-28 19:01:05 -07:00
Jakub Konka
20f4216af5 macos: fix parsing of SDK version string into std.SemanticVersion 2023-07-28 21:13:56 +02:00
techatrix
7e25fb4a43 add bound check on for and while nodes 2023-07-28 00:20:53 -07:00
Andrew Kelley
282cb5ee5d
Merge pull request #16559 from kcbanner/improve_compiler_rt_stack_trace
Unwinding follow up: Don't strip compiler_rt symbols, enable unwind tables on supported platforms
2023-07-27 11:07:10 -07:00
Josh Wolfe
8f2af35eaa std.json: WriteStream.print instead of writePreformatted 2023-07-27 10:23:58 -07:00
Ryan Liptak
49053cb1b4 Add fs.path.ComponentIterator and use it in Dir.makePath
Before this commit, there were three issues with the makePath implementation:

1. The component iteration did not 'collapse' consecutive path separators; instead, it would treat `a/b//c` as `a/b//c`, `a/b/`, `a/b`, and `a`.
2. Trailing path separators led to redundant `makeDir` calls, e.g. with the path `a/b/` (if `a` doesn't exist), it would try to create `a/b/`, then try `a/b`, then try `a`, then try `a/b`, and finally try `a/b/` again.
3. The iteration did not treat the root of a path specially, so on Windows it could attempt to make a directory with a path like `X:` for something like `X:\a\b\c` if the `X:\` drive doesn't exist. This didn't lead to any problems that I could find, but there's no reason to try to make a drive letter as a directory (or any other root path).

This commit fixes all three issues by introducing a ComponentIterator that is root-aware and handles both sequential path separators and trailing path separators and uses it in `Dir.makePath`. This reduces the number of `makeDir` calls for paths where (1) the root of the path doesn't exist, (2) there are consecutive path separators, or (3) there are trailing path separators

As an example, here are the makeDir calls that would have been made before this commit when calling `makePath` for a relative path like `a/b//c//` (where the full path needs to be created):

a/b//c//
a/b//c/
a/b//c
a/b/
a/b
a
a/b
a/b/
a/b//c
a/b//c/
a/b//c//

And after this commit:

a/b//c
a/b
a
a/b
a/b//c
2023-07-27 10:22:54 -07:00
Rohlem
7e1af51c4d std.coff: check strtab lengths against data length
Fixes illegal behavior. Invalid-length sections are now skipped in `Coff.getSectionByName`.
2023-07-27 10:21:12 -07:00
AnnikaCodes
775da34268
std.Uri: Don't double-escape escaped query parameters (#16043) 2023-07-27 13:18:48 -04:00
Michael Dusan
2dd7c6b268 linux: do not set stack size hard limit
At main startup, if the ELF auxiliary vector contains a stacksize value,
use it as a hint for the minimum stacksize required by the executable.

1. Never lower the hard-limit. Once a hard-limit is lowered, then it can
   never be increased (including child processes).

2. If hint exceeds hard-limit then clamp hint to hard-limit.

3. If soft-limit exceeds hint then do nothing.
2023-07-27 10:17:46 -07:00
Ryan Liptak
9a3adeea6e windows.OpenFile/DeleteFile: Add NetworkNotFound as a possible error
When calling NtCreateFile with a UNC path, if either `\\server` or `\\server\share` are not found, then the statuses `BAD_NETWORK_PATH` or `BAD_NETWORK_NAME` are returned (respectively).

These statuses are not translated into `error.FileNotFound` because they convey more information than the typical FileNotFound error. For example, if you were trying to call `Dir.makePath` with an absolute UNC path like `\\MyServer\MyShare\a\b\c\d`, then knowing that `\\MyServer\MyShare` was not found allows for returning after trying to create the first directory instead of then trying to create `a\b\c`, `a\b`, etc. when it's already known that they will all fail in the same way.
2023-07-27 09:35:29 -07:00
kcbanner
8b9627f01d test: add a test that verifies no debug handlers get pulled into compiler_rt
build: fix CheckObject checkNotPresent only checking a single line of the haystack
2023-07-27 10:31:52 -04:00
kcbanner
78449b6d98 debug: skip unwind error printing on platforms that don't have_ucontext 2023-07-26 22:10:22 -04:00
kcbanner
661028a907 target: emit unwind tables if the platform supports unwinding 2023-07-26 20:58:29 -04:00
kcbanner
a84826115f debug: print unwind errors if they occur on the first iteration, and differentiate between missing info and an actual unwind error in the message 2023-07-26 20:58:29 -04:00
Andrew Kelley
1aacfa7186
Merge pull request #16538 from kcbanner/fixup_unwind_perf_regression
Reducing compile time regression introduced by the new DWARF unwinder
2023-07-26 16:52:01 -07:00
Jim Price
584b062a30
Fix counting in SingleThreadedRwLock's tryLockShared (#16560)
Additionally we add RwLock to Thread.zig's list of tests
2023-07-26 08:19:52 -05:00
Andrew Kelley
71dfce31bb
Merge pull request #16548 from mlugg/feat/package-dl-progress
Display package download progress
2023-07-25 18:12:00 -07:00
Jacob G-W
3c08fe931a make @typeInfo not return private decls
fixes #10731
Thanks @nektro for previous work in #14878

This change creates a small breaking change:
It removes the `is_pub` field of a decl in `@typeInfo`
2023-07-25 16:19:08 -07:00
Lauri Tirkkonen
972e70b794 darwin: drop underscore from SIG._{BLOCK,UNBLOCK,SETMASK}
this makes them match decls in other OSes
2023-07-25 13:49:08 -07:00
Wooster
b5a471db3c ErrorBundle: remove extra newline
This is another minor change but still makes a visual difference and will reduce the amount you have to scroll in your terminal by a little bit.

Reasoning:
1. The `for (0..src.data.reference_trace_len)` loop will run at least once due to the `src.data.reference_trace_len > 0` check above.
2. In all 3 branches of the `if` in that `for` it will print something.
3. The 3 strings of all of those prints already end in `\n`.
Therefore, the extra `try stderr.writeByte('\n');` is unnecessary.
2023-07-25 11:05:14 -07:00
Zachary Raineri
dc98b001f3 std.os.linux | Fix sendmmsg function | Issue #16513
Closes #16513
2023-07-25 11:04:10 -07:00
Jan Philipp Hafer
32e78e239f re-enable test "fmt.parseFloat nan and inf" after llvm fix
Closes #12027.
2023-07-25 11:03:11 -07:00
xdBronch
737b366279 add error when passing a non-single-item pointer to allocator.destroy 2023-07-25 10:55:04 -07:00
kcbanner
8e4cc0ce5a dwarf: small code size reduction in expression runner 2023-07-25 10:28:03 -04:00
mlugg
06e50e9aa7
std.Progress: add optional unit to progress indicator 2023-07-25 13:51:22 +01:00
kcbanner
49fa3a987f reduce the number of duplicate instantiations due to differing stream parameters 2023-07-25 00:45:47 -04:00
kcbanner
ab2e0b927d switch to sortUnstable when sorting FDEs (~16ms improvement) 2023-07-24 23:27:05 -04:00
mllken
dc24835168 io_uring: let the OS choose a free local port for all tests
closes #14907
2023-07-24 20:12:41 -07:00
lockbox
9b56c7de79 Fix type mismatch for Reader.readIntoBoundedBytes (#16416)
- add unit test to verify .readIntoBoundedBytes behavior
- add unit test to verify .readBoundedBytes behavior
2023-07-24 17:32:06 -07:00
Validark
8b1976cab5 [priority_queue] Simplify sifting & fix edge case 2023-07-24 12:58:19 -07:00
Andrew Kelley
f8666d748d
Merge pull request #16516 from lacc97/std-crypto-certificate-parse-datetime
std.crypto.Certificate: fix timedate parsing
2023-07-24 10:56:38 -07:00
Dominic
559150e844
Xxhash perf (#15947)
Improvements for xxHash performance, both on small keys as well as large slices.

* std.hash: make benchmarks consistent for xxhash

There is some odd behaviour in the timings for the XXHash benchmarks
introduced in 879f0b9, specifically the changes to the allocation in
benchmarkHash. The problem is somewhere in the difference between
9628243 and 9362d61 (these are commit that were force-pushed over but
        can be found in PR #15917).

* std.hash: correctly calculate throughput in benchmark
* std.hash: add hashes per sec to small key output
* std.hash: add exact and small xxhash routines
* std.hash: add --small-only flag to benchmark
* std.hash.xxhash: extract stateless Accumulator type
* std.hash.xxhash: cleanup hash() and improve small key perf
* std.hash.xxhash: port xxhash64 changes to xxhash32
* std.hash: change benchmark --small-only flag to --include-array
2023-07-24 13:47:45 -04:00
Zachary Raineri
d82b359010 Use builtin inference over @as where possible 2023-07-24 10:23:51 -07:00
Andrew Kelley
77b96231a6
Merge pull request #15657 from BratishkaErik/windows-sdk-finder-port-to-zig
src/windows_sdk.cpp: port to Zig
2023-07-24 09:34:56 -07:00
kcbanner
d1ed1c167b simplify call frame instruction parser 2023-07-24 10:43:14 -04:00
Andrew Kelley
e8fa199602 std.Build.Step.Compile: getEmittedDocs API enhancements
* Allow calling it multiple times.
 * Rename it. Sorry, this is to coincide with #16353.
2023-07-24 02:37:25 -07:00
Andrew Kelley
575a7cccc0 CLI: delete dead option -femit-analysis
This used to do something with the old autodocs system. Now it does
nothing.
2023-07-24 02:37:25 -07:00
kcbanner
20ce7455b9 fixup inline switch 2023-07-24 02:07:59 -04:00
Jacob Young
c610cde1eb test: test for issues starting codegen on many targets
Specifically this is to make sure llvm data layout generation doesn't
regress.  The no emit bin is to allow testing targets that can't
currently be linked.  The commented out targets are ones that fail in
the linker anyway when no emit bin is passed.
2023-07-23 23:48:19 -04:00
Jacob Young
06af9cc101 llvm: fix datalayout generation for more targets
Closes #16482
2023-07-23 23:48:18 -04:00
Andrew Kelley
23a806102a Revert "zig fmt: additionally auto-fix @byteSwap (#16462)"
This reverts commit f31e114f633f5d57f6d09a616f5997d83949f641.

This commit was incorrect; `@byteSwap` was not modified during the
0.11.0 release cycle.
2023-07-23 20:30:34 -07:00