Commit graph

25369 commits

Author SHA1 Message Date
xdBronch
2826f78a61
suggest using else when '_' is used for exhaustive enums (#16583) 2023-07-28 22:28:55 -04:00
Andrew Kelley
bde6e075df
Merge pull request #16593 from jacobly0/c-abi
Fix various C ABI issues
2023-07-28 19:27:43 -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
Jacob Young
97ae2d2c29 c-abi: enable passing tests 2023-07-28 19:27:08 -04:00
Jacob Young
125b453c58 llvm: fix SysV C abi for structs smaller than two eightbytes
Closes #16038
Closes #16288
2023-07-28 19:27:08 -04:00
Jacob Young
c80609dfec Sema: don't reorder tuple fields
This conflicts with anon structs which can be in-memory coercible but
are never reordered.

Closes #16242
2023-07-28 19:27:08 -04:00
Jakub Konka
20f4216af5 macos: fix parsing of SDK version string into std.SemanticVersion 2023-07-28 21:13:56 +02:00
Niles Salter
6548331ec9 Doc nitpick
`slice[i]` should assert `len > i`
2023-07-28 10:30:32 -07:00
Loris Cro
e682d6eb29 autodoc: improve styling of new help dropdown 2023-07-28 17:00:07 +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
Andrew Kelley
e66190025f frontend: make fn calls byval; fix false positive isNonErr
This commit does two things which seem unrelated at first, but,
together, solve a miscompilation, and potentially slightly speed up
compiler perf, at the expense of making #2765 trickier to implement in
the future.

Sema: avoid returning a false positive for whether an inferred error set
is comptime-known to be empty.

AstGen: mark function calls as not being interested in a result
location. This prevents the test case "ret_ptr doesn't cause own
inferred error set to be resolved" from being regressed. If we want to
accept and implement #2765 in the future, it will require solving this
problem a different way, but the principle of YAGNI tells us to go ahead
with this change.

Old ZIR looks like this:

  %97 = ret_ptr()
  %101 = store_node(%97, %100)
  %102 = load(%97)
  %103 = ret_is_non_err(%102)

New ZIR looks like this:

  %97 = ret_type()
  %101 = as_node(%97, %100)
  %102 = ret_is_non_err(%101)

closes #15669
2023-07-27 10:12:08 -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
Andrew Kelley
0f21d3d4d1 LLVM: always add argument attributes to calls
These are needed for correctness. There's no reason to only add them for
function pointers.

closes #16290
2023-07-27 00:49:25 -07:00
Andrew Kelley
c3364b372f
Merge pull request #16572 from ziglang/stage1-test-coverage
add behavior test coverage for stage1 issues
2023-07-26 23:38:28 -07:00
zhaozg
47388feec6 build: update cmake_minimum_required to 3.5
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.
2023-07-26 22:41:43 -07:00
Jacob Young
7201e69454 AstGen: fix missing deferred ref
Closes #16524
2023-07-26 22:19:30 -07:00
kcbanner
78449b6d98 debug: skip unwind error printing on platforms that don't have_ucontext 2023-07-26 22:10:22 -04:00
Andrew Kelley
d28f24d1d1 add behavior test for defer assign
closes #10591
2023-07-26 19:02:02 -07:00
Andrew Kelley
407d91f7a7 add behavior test for switch nested break
closes #10196
2023-07-26 19:02:02 -07:00
Andrew Kelley
9d3363fee9 add behavior test for bitcast packed struct twice
closes #9914
2023-07-26 19:02:02 -07:00
Andrew Kelley
508294e9be add behavior test for comptime ptrcast packed struct
closes #9912
2023-07-26 19:02:02 -07:00
Andrew Kelley
2936602566 add behavior test for union with 128 bit integer
closes #9871
2023-07-26 19:02:02 -07:00
Andrew Kelley
87961237cf add behavior test for tail calls
closes #9703
2023-07-26 19:02:02 -07:00
kcbanner
661028a907 target: emit unwind tables if the platform supports unwinding 2023-07-26 20:58:29 -04:00
kcbanner
f2aab12a86 compilation: change compiler_rt to inherit strip and want_unwind_tables from the parent compilation 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
00d6a4da49 add behavior test for comptime array load
closes #8487
2023-07-26 17:21:20 -07: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
Jacob Young
f9717f87f5 llvm: fix data layout on ios
Closes #16549
2023-07-26 16:49:32 -07:00
Andrew Kelley
a707f380a5 llvm: disable LTO on C ABI tests
This required disabling some failing tests. See #14908
2023-07-26 11:07:11 -07:00
Jakub Konka
f821543e4b
Merge pull request #16553 from ziglang/issue-11896
macho: fix parsing of TBDv3 dylib stubs
2023-07-26 18:22:59 +02:00
Jakub Konka
cb475aa161
Merge pull request #16563 from ziglang/issues-16308
macho: create export trie root explicitly with Trie.init rather than implicitly on first Trie.put
2023-07-26 18:22:43 +02: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
Jakub Konka
960e5c329a link-test: expect exit code of 0 for TBDv3 test 2023-07-26 14:11:49 +02:00
Jakub Konka
780f0b872a link-test: add test case for MachO bug 16308 2023-07-26 13:38:24 +02:00
Jakub Konka
59284a1085 macho: create export trie root explicitly with Trie.init 2023-07-26 13:37:37 +02:00
Jakub Konka
4ab595239f link-test: adjust TBDv3 test to handle x86_64-macos also 2023-07-26 11:22:43 +02:00
kcbanner
a8a2f2b58b Add --verbose-generic-instances to provide visibility on the number of generic function instantiations 2023-07-26 02:20:29 -07:00
Jakub Konka
5131d074d8 link-test: add test for TBDv3 updated parsing logic 2023-07-26 08:10:53 +02:00
Jakub Konka
3b3ce449e3 tapi: do not log errors using log.err 2023-07-26 08:10:52 +02:00
Jakub Konka
27f471860a macho: fix matching target triples for TBDv3 2023-07-26 08:10:52 +02:00