27479 Commits

Author SHA1 Message Date
dweiller
b7eb59fc14 fix x86_64 crashes for switch_block_err_union
This change only emits the unwrap_errunion_err instruction if the error
capture is actually used in a branch.
2024-01-09 14:42:12 +11:00
dweiller
adcaad6d91 sema: fix err union switch with inferred empty error sets 2024-01-09 14:42:12 +11:00
dweiller
2fa69cce72 sema: allow maybeErrorUnwrap to handle err_union_code 2024-01-09 14:42:12 +11:00
dweiller
a175a64384 sema: implement runtime switch_block_err_union 2024-01-09 14:42:12 +11:00
dweiller
6bf319ebbb sema: extract runtime switch AIR generation to function 2024-01-09 14:42:12 +11:00
dweiller
ae19f699ab sema: implement switch_block_err_union on comptime operands 2024-01-09 14:42:12 +11:00
dweiller
2cf648fba7 astgen: use switch_block_err_union 2024-01-09 14:42:12 +11:00
dweiller
b784f64a6e sema: refactor error set switch logic 2024-01-09 14:42:11 +11:00
dweiller
4136097566 zir: add switch_block_err_union 2024-01-09 14:42:11 +11:00
dweiller
063d55c504 zir: remove unused zir as instruction 2024-01-09 14:42:11 +11:00
Andrew Kelley
8c9efc95a1 langref: update target section
* remove outdated information
* add new information

closes #17032
closes #17044
2024-01-08 18:48:10 -07:00
Ali Chraghi
0e856da224 add type safety to ZIR for null terminated strings 2024-01-08 16:33:33 -08:00
Andrew Kelley
deed19496a
Merge pull request #16650 from wooster0/hexdump
general-use std.debug.hexdump for printing hexdumps
2024-01-08 16:25:15 -08:00
Andrew Kelley
4cf08932b5
Merge pull request #16109
Update mingw-w64 to latest git commit
2024-01-08 16:13:14 -08:00
Carl Åstholm
9c8c9b7cc8 Build: Use LazyPath for version scripts 2024-01-09 01:47:54 +02:00
Amir Alawi
4cbf74bd9b
fix std.fs.Dir.makePath silent failure (#16878)
std.fs.dir.makePath silently failed if one of the items in the path already exists. For example:

cwd.makePath("foo/bar/baz")
Silently failing is OK if "bar" is already a directory - this is the intended use of makePath (like mkdir -p). But if bar is a file then the subdirectory baz cannot be created - the end result is that makePath doesn't do anything which should be a detectable error because baz is never created.

The existing code had a TODO comment that did not specifically cover this error, but the solution for this silent failure also accomplishes the TODO task - the code now stats "foo" and returns an appropriate error. The new code also handles potential race condition if "bar" is deleted/permissions changed/etc in between the initial makeDir and statFile calls.
2024-01-08 15:58:14 -05:00
Andrew Kelley
ed410b9c1e lift artificial restriction on minimum glibc version
Fixes a regression introduced in
c22d1c00a8825f60e7b01b97c6f73cbc21ca8257.

See #17769
2024-01-08 13:43:10 -07:00
Andrew Kelley
e92cc155fd CI: update aarch64-windows tarball
Contains the mingw upgrade to use ucrt.
2024-01-08 12:05:37 -07:00
Andrew Kelley
9a4a74eb65 mingw: remove pow.c from aarch64-windows mingw builds
I observed a duplicate symbol linker error; pow was defined both by
mingwex.lib and ucrtbase.dll.
2024-01-08 11:53:06 -07:00
Andrew Kelley
046f7550df CI: update windows tarballs for mingw upgrade
The tarballs have to be rebuilt because now we want to use the ucrt.
2024-01-08 11:52:38 -07:00
Andrew Kelley
f5ed441ddb mingw: add the build logic for the previous commit
Separate commits for the zig logic and the copied files.
2024-01-08 11:52:38 -07:00
Andrew Kelley
9df0177f33 mingw: add the mingw stdio functions back
We would rather use the ucrt for these, but sometimes dependencies on
the mingw stdio functions creep in. 仕方ない.

The cost is only paid if they are used; otherwise the symbols are
garbage-collected at link time.
2024-01-08 11:52:38 -07:00
Andrew Kelley
99922c2708 Compilation: only add __MSVCRT_VERSION__ for -lc
prevents it from being defined twice when building mingw-w64 libs.
2024-01-08 11:52:38 -07:00
Andrew Kelley
089ebeb873 update-mingw tool: add config.h to whitelist 2024-01-08 11:52:38 -07:00
Andrew Kelley
6405d37d9f add config.h 2024-01-08 11:52:38 -07:00
Andrew Kelley
7b3afc880b Compilation: add definition to prefer ucrt for windows C/C++ files
This makes C/C++ files when targeting mingw-w64 choose to depend on ucrt
for stdio.
2024-01-08 11:52:38 -07:00
Andrew Kelley
e2a8fe721d mingw: add comments so that I don't regress this code later
Martin Storsjö kindly took the time to discuss things at length with me,
and the results are that this status quo is correct. I added comments so
that I don't think it should be changed later.
2024-01-08 11:52:38 -07:00
Andrew Kelley
3f4c73ae93 mingw: update from msvcrt to ucrt 2024-01-08 11:52:38 -07:00
Andrew Kelley
c26bace606 mingw-w64: update CRT files to latest git commit
Upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

* adds ucrtbase.def.in
* mingwex: replace mingw crt files with ucrt files
* adds missing mingw-w64 ucrt files

The rules that govern which set of files are included or excluded is
contained in the logic for tools/update_mingw.zig
2024-01-08 11:52:38 -07:00
Andrew Kelley
491b460e0a add tool for updating mingw crt files 2024-01-08 11:52:38 -07:00
Andrew Kelley
9346cd38e8 update mingw-w64 headers to latest git commit
Upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

Martin Storsjö suggested synchronizing with git snapshots rather than
waiting for tagged releases. Let's try this for a few releases of Zig
and see how we like it.

These headers were configured with `--with-default-msvcrt=ucrt`.

See related issue #18477.
2024-01-08 11:52:37 -07:00
Jeremy Volkman
8fd15c6ca8 Use a fixed chunk size when calculating MachO UUID 2024-01-08 10:23:07 +01:00
Andrew Kelley
25d2e7fce0 fixups from previous commit
* rename the functions
* make the other function public and give it a better name
* interact with stderr_mutex
* std lib test coverage
2024-01-08 00:21:57 -07:00
Wooster
ad7a09d95a std.testing.expectEqualSlices: some improvements
This mainly replaces ChunkIterator with std.mem.window and also
prints \n, \r, \t using Unicode symbols instead of periods because
they're common non-printable characters.
This same code exists in std.debug.hexdump.
At some point maybe this code could be exposed through a public
function. Then we could reuse the code in both places.
2024-01-08 00:13:21 -07:00
Wooster
dfc4d618dd general-use std.debug.hexdump for printing hexdumps
Recently, when I've been working with structures of data that is not
directly in RAM but rather laid out in bytes somewhere else,
it was always very useful to print out maybe the next 50 bytes or the
previous 50 bytes or so to see what's ahead or before me.
I would usually do this with a quick
`std.debug.print("{any}\n", .{bytes});` or something but the output is
not as nice obviously.
2024-01-08 00:13:06 -07:00
Scott Schwarz
f5978181e4
langref: reword Hello World section (#18458)
closes #14347
2024-01-08 01:32:26 -05:00
Andrew Kelley
3176fdc0b9
Merge pull request #18470 from castholm/typeInfo-sentinels
Make `@typeInfo` return null-terminated strings
2024-01-07 22:28:24 -08:00
Eric Eastwood
2115d7d1be Add approxEqAbs support for comptime_float 2024-01-07 22:23:06 -08:00
Veikka Tuominen
faeb0ef032 llvm: optional slices cannot be passed in parts when they allowzero
Closes #18428
2024-01-08 06:57:06 +02:00
Andrew Kelley
3f6e651d5a remove tool: update-license-headers
This tool is not needed since license headers were removed in
d29871977f97b50fe5e3f16cd9c68ebeba02a562.
2024-01-07 17:02:17 -07:00
Veikka Tuominen
5031519b73
Merge pull request #18362 from ExpidusOS/fix/compiler-rt-codemodel
Compilation: pass code model to buildOutputFromZig
2024-01-08 01:33:34 +02:00
Carl Åstholm
01b48e9381 InternPool: Fix rare buffer overflow when initializing aggregate with sentinel 2024-01-07 21:46:52 +01:00
Carl Åstholm
92458094c8 Fix failing type reifications 2024-01-07 16:27:50 +01:00
Carl Åstholm
c8fa767f08 Work around stage1 not yet returning null-terminated @typeInfo strings
These changes can be reverted the next time stage1 is updated.
2024-01-07 16:21:08 +01:00
Carl Åstholm
a02bd81760 Make @typeInfo return null-terminated strings
Changes the types of `std.builtin.Type` `name` fields from `[]const u8`
to `[:0]const u8`, which should make them easier to pass to C APIs
expecting null-terminated strings.

This will break code that reifies types using `[]const u8` strings, such
as code that uses `std.mem.tokenize()` to construct types from strings
at comptime. Luckily, the fix is simple: simply concatenate the
`[]const u8` string with an empty string literal (`name ++ ""`) to
explicitly coerce it to `[:0]const u8`.

Co-authored-by: Krzysztof Wolicki <der.teufel.mail@gmail.com>
2024-01-07 15:35:18 +01:00
Tristan Ross
22598ef35f std.Build: pass code model in various compile steps 2024-01-06 18:33:24 -08:00
Tristan Ross
c78b6564df Compilation: pass code model in buildOutputFromZig 2024-01-06 18:33:24 -08:00
Veikka Tuominen
804cee3b93 categorize behavior/bugs/<issueno>.zig tests 2024-01-06 16:49:41 -08:00
Andrew Kelley
282ff8d3bd
Merge pull request #18453 from squeek502/makepath-parent-components
Add more `Dir.makePath` tests and document how `..` is handled in sub_path
2024-01-06 16:47:39 -08:00
Ryan Liptak
51946f5adc Dir.makePath: Document/test platform differences around .. component handling
Closes #18452
2024-01-05 17:56:31 -08:00