Commit graph

9923 commits

Author SHA1 Message Date
Michael Dusan
5ce40e61c6
bsd: debitrot AtomicOrder renames
- complete std.builtin.AtomicOrder renames that were missed from 6067d39522
2024-03-15 02:28:50 -04:00
Michael Dusan
cf4a2099e1
dragonfly: debitrot std.c 2024-03-15 02:28:50 -04:00
Elaine Gibson
6b38758594 coff: only store PDB basename 2024-03-14 18:56:02 -07:00
Michael Dusan
6724a524d4 bsd: add missing os.IFNAMESIZE
- based on system API value IF_NAMESIZE
- unblocks `zig test lib/std/std.zig`
2024-03-14 18:54:25 -07:00
Matthew Lugg
39459e78ad
Merge pull request #19273 from mlugg/incremental-some-more
compiler: more progress on incremental
2024-03-14 17:45:21 +00:00
Ahmed
5c8eda36d6 chore: Fix some typos 2024-03-14 19:43:24 +02:00
Andrew Kelley
bc5b094695 remove std.io.PeekStream
See #16114. This functionality should be added to bufferedReader
instead.
2024-03-14 07:48:47 -07:00
Luuk de Gram
0103c4bf78 std: make std.dwarf.FixedBufferReader public
Also fixes a compile-error as the field `is_64` no longer exists.
2024-03-14 02:57:46 -07:00
mlugg
00969062a9
compiler: detect duplicate test names in AstGen
There is no reason to perform this detection during semantic analysis.
In fact, doing so is problematic, because we wish to utilize detection
of existing decls in a namespace in incremental compilation.
2024-03-14 07:40:05 +00:00
Andrew Kelley
778ab767b1
Merge pull request #19258 from castholm/enums-eval-branch-quota
std.enums: Increase eval branch quotas
2024-03-13 18:50:12 -07:00
Jonathan Marler
32f602ad16
std.os.windows: handle OBJECT_NAME_INVALID in OpenFile (#19288)
It's been seen on Windows 11 (22H2) Build 22621.3155 that NtCreateFile
will return the OBJECT_NAME_INVALID error code with certain path names.
The path name we saw this with started with `C:Users` (rather than
`C:\Users`) and also contained a `$` character.  This PR updates our
OpenFile wrapper to propagate this error code as `error.BadPathName`
instead of making it `unreachable`.

see https://github.com/marler8997/zigup/issues/114#issuecomment-1994420791
2024-03-13 21:39:20 -04:00
Carl Åstholm
2008b14bc7 autodoc: Use code for keyboard events 2024-03-13 18:37:00 -07:00
pancelor
7a858257f2 remove math.lerp bounds for t
I think of lerp() as a way to change coordinate systems, essentially
remapping the input numberline onto a shifted+rescaled numberline. In
my mind the full numberline is remapped, not just the 0-1 segment.

An example of how this is useful: in a game, you can write:
`myPos = lerp(pos0, pos1, easeOutBack(u))`
for some `u` that changes from 0 to 1 over time.
(see https://easings.net/#easeOutBack)
This will animate `myPos` between `pos0` and `pos1`, overshooting the
goal position `pos1` in a nicely-animated way.
`easeOutBack(float)->float` is a pure function that overshoots 1,
and by combining it with `lerp()` we can remap coordinates in other
coordinate systems, making them overshoot in the same way.

However, this overshooting is only possible because `easeOutBack(t)`
sometimes exceeds the range 0-1 (e.g. `easeOutBack(0.5)` is 1.0877),
which is not allowed by the current `math.lerp` implementation.

This commit removes the asserts that prevented this use-case. Now, any
value can be inputted for t. For example, `lerp(10,20, 2.0)` will now
return 30, instead of throwing an assert error.
2024-03-13 18:35:07 -07:00
Andrew Kelley
ea8e9e668b
Merge pull request #19289 from ianic/issue_19052
compress.xz: fix slow running read loop
2024-03-13 18:32:50 -07:00
Adrià Arrufat
17bad9f886 Fix emscripten exports 2024-03-13 21:47:31 +01:00
Igor Anić
791c4491a7 compress.xz: remove unnecessary variable
`to_read.items.len is always zero when entering readBlock.
2024-03-13 18:43:36 +01:00
Igor Anić
54f882c4aa compress.xz: make reader loop little more readable
No need to do same error check on two places. First return all
uncompressed data then on last read check error.
2024-03-13 18:41:20 +01:00
Igor Anić
a21f9b6d8b compress.xz: remove copyForwards from tight loop
In the example from the issue #19052 to_read holds 213_315_584
uncompressed bytes. Calling read with small output results in many
shifts of that big buffer.
This removes need to shift to_read after each read.
2024-03-13 18:22:08 +01:00
Michael Dusan
22fd1851bd
zig libc: allow non-native targets
On macos, allow targets supported by the SDK. This then spawns `xcrun`
and correct paths are emitted for:

- x86_64-macos
- x86_64-ios
- x86_64-tvos
- x86_64-watchos
- x86_64-ios-macbi
- aarch64-macos
- aarch64-ios
- aarch64-tvos
- aarch64-watchos
- aarch64-ios-macbi

On platforms with android NDK, allow android targets. Example usage:

```
CC=/NDK/.../bin/aarch64-linux-android34-clang zig libc -target aarch64-linux-android
```
2024-03-13 02:17:28 -04:00
Frank Denis
153ba46a5b
{aegis,aes_gcm}: fix overflow with large inputs on 32-bit systems (#19270)
These systems write the number of *bits* of their inputs as a u64.

However if `@sizeOf(usize) == 4`, an input message or associated data
whose size is > 512 MiB could overflow.

On 64-bit systems, it is safe to assume that no machine has more than
2 EiB of memory.
2024-03-12 22:56:28 +00:00
Frank Denis
b8920bceb7
ml_kem.zig: inLen -> in_len (#19269)
Don't use camelCase for variable names, especially just for that one.
2024-03-12 19:52:06 +00:00
Andrew Kelley
da5b16f9e2
Merge pull request #19238 from dweiller/ring-buffer
std.RingBuffer: minor cleanup and doc improvements
2024-03-11 18:49:16 -07:00
Andrew Kelley
cb4e087fda
Merge pull request #19239 from jedisct1/ml-kem
std.crypto: add support for ML-KEM
2024-03-11 18:48:08 -07:00
Andrew Kelley
bd24e66379
Merge pull request #19229 from tiehuis/ryu-128
std.fmt: add ryu floating-point formatting implementation
2024-03-11 18:46:26 -07:00
Andrew Kelley
0c61466771
Merge pull request #19174 from squeek502/lazy-resinator
Lazily compile the `zig rc` subcommand and use it during `zig build-exe`, etc
2024-03-11 17:18:09 -07:00
Andrew Kelley
f60c24c73c
Merge pull request #19155 from ianic/tar_max_file_size
std.tar: error on insufficient buffers provided to iterator
2024-03-11 17:03:44 -07:00
Carl Åstholm
5be7e2c217 Avoid comptime concatenation in EnumFieldStruct 2024-03-12 00:53:40 +01:00
Carl Åstholm
44cd59a3ba Move big enum tests to a standalone test case 2024-03-12 00:53:09 +01:00
tinusgraglin
26e895e3dc math.big.int: fix incorrect bitAnd behavior 2024-03-11 16:52:03 -07:00
Carl Åstholm
0a931393c0 std.enums: Increase eval branch quotas 2024-03-12 00:01:38 +01:00
Tristan Ross
6067d39522
std.builtin: make atomic order fields lowercase 2024-03-11 07:09:10 -07:00
Tristan Ross
c260b4c753
std.builtin: make global linkage fields lowercase 2024-03-11 07:09:10 -07:00
Tristan Ross
aab84a3dec
std.builtin: make float mode fields lowercase 2024-03-11 07:09:10 -07:00
Tristan Ross
9d70d614ae
std.builtin: make link mode fields lowercase 2024-03-11 07:09:10 -07:00
Tristan Ross
099f3c4039
std.builtin: make container layout fields lowercase 2024-03-11 07:09:07 -07:00
Igor Anić
c974e19816 docs: make docs work with recent tar changes
It is no longer need to call skip if file content is not consumed. It is
handled internally now. File types are now same as in os.File.
2024-03-11 13:30:26 +01:00
Ryan Liptak
3f92cbef89 resinator: Fix auto-detected includes only being used during preprocessing
Also need to pass them to the .res compilation step, since files (cursors, icons, etc) can be found in the system include directories.
2024-03-11 05:06:17 -07:00
Ryan Liptak
c32e0d3000 Fix progress when multiple zig rc child processes are building resinator 2024-03-11 05:06:17 -07:00
Ryan Liptak
b16890e6dd ErrorBundle: Fix potential writes to stale/freed memory 2024-03-11 05:06:17 -07:00
Ryan Liptak
8799f7466d Report the progress of lazily building zig rc
jitCmd now takes a `server` option that will emit progress/errors via std.zig.Server when enabled.
2024-03-11 05:06:17 -07:00
Ryan Liptak
dc4b05894d ErrorBundle: Add support for reference traces in addOtherSourceLocation
Also adds a test for addBundleAsRoots, which uses addOtherSourceLocation.
2024-03-11 05:06:17 -07:00
Ryan Liptak
7c05330287 Integrate resinator errors with Zig using std.zig.Server and ErrorBundle
This takes the code that was previously in src/Compilation.zig to turn resinator diagnostics into Zig error bundles and puts it in resinator/main.zig, and then makes resinator emit the resulting error bundles via std.zig.Server (which is used by the build runner, etc). Also adds support for turning Aro diagnostics into ErrorBundles.
2024-03-11 05:06:16 -07:00
Ryan Liptak
52de2802c4 Lazily compile the zig rc subcommand and use it during zig build-exe
This moves .rc/.manifest compilation out of the main Zig binary, contributing towards #19063

Also:
- Make resinator use Aro as its preprocessor instead of clang
- Sync resinator with upstream
2024-03-11 05:06:16 -07:00
Igor Anić
0cca7e732e std.tar: fix broken public interface 2024-03-11 12:25:51 +01:00
Igor Anić
c4868b2bbc std.tar: use doctest
Make std.tar look better in docs. Remove from public interface what is
not necessary. Add comment to the public methods. Add doctest as usage
examples for iterator and pipeToFileSystem.
2024-03-11 12:25:03 +01:00
Igor Anić
a9e7abda20 std.tar: fix test hanging on windows
Problem was manifested only on windows with target `-target
aarch64-windows-gnu`.

I was creating new files but not closing any of them. Tmp dir cleanup
hangs looping in deleteTree forever.
2024-03-11 12:24:11 +01:00
Igor Anić
8ec990d6d7 disable test which is hanging on windows in ci
When this test is enabled something like:
`zig build test docs --zig-lib-dir .\lib\ -Dstatic-llvm -Dskip-non-native -Denable-symlinks-windows`
never finishes.

Those are failed runs from ci:
https://github.com/ziglang/zig/actions/runs/8137710393
https://github.com/ziglang/zig/actions/runs/8129619923
https://github.com/ziglang/zig/actions/runs/8125845128

Isolating that test and running it is not a problem. Running something
like `zig test .\lib\std\std.zig  --zig-lib-dir .\lib\` is fine.
2024-03-11 12:24:11 +01:00
Igor Anić
8cc35a0255 std.tar: fix path testing on windows
Fixing ci error: error:

'tar.test.test.pipeToFileSystem' failed: slices differ. first difference occurs at index 2 (0x2)

============ expected this output: =============  len: 9 (0x9)

2E 2E 2F 61 2F 66 69 6C  65                       ../a/file

============= instead found this: ==============  len: 9 (0x9)

2E 2E 5C 61 5C 66 69 6C  65                       ..\a\file

After #19136 dir.symlink changes path separtors to \ on windows.
2024-03-11 12:24:11 +01:00
Igor Anić
67336ca8c6 std.tar: fix build on 32 bit platform
Fixing error from ci:

std/tar.zig:423:54: error: expected type 'usize', found 'u64'
std/tar.zig:423:54: note: unsigned 32-bit int cannot represent all possible unsigned 64-bit values
2024-03-11 12:24:11 +01:00
Igor Anić
f5fd4691e5 std.tar: document iterator interface with example 2024-03-11 12:24:06 +01:00