Commit graph

9004 commits

Author SHA1 Message Date
Jacob Young
af0668d6c2 Build.Cache: fix UAF during unhit 2024-03-24 18:28:16 +00:00
Marc Tiehuis
091aa54a3e fix comptime float formatting
Closes #19379
Closes #18046
2024-03-24 10:23:48 +02:00
Ben Sinclair
e90583f5d1 std.fmt.fmtIntSize{Bin,Dec}: Don't add .0... to bytes
These are the fundamental units so they can't have decimal places.
2024-03-24 01:15:22 +02:00
Jacob Young
2dd74cd312 haiku: debitrot 2024-03-23 18:11:32 +01:00
Jacob Young
a7282d0910 WasmAllocator: fix safety panic during OOM 2024-03-23 11:32:37 +01:00
Jacob Young
ff7ca4b70f Build.Cache: fix UAF during unhit 2024-03-23 11:32:37 +01:00
Jakub Konka
640acf8625
Merge pull request #19396 from ziglang/coff-stdlib
lib/std/coff: port more definitions
2024-03-23 11:22:49 +01:00
Jakub Konka
86c4c33d2c lib/std/coff: add ImportHeader, and Relocation metadata 2024-03-22 15:12:11 +01:00
Jakub Konka
2326f0e53b lib/std/coff: add undocumented machine type ARM64EC 2024-03-22 15:05:32 +01:00
Jakub Konka
541e3a03ec lib/std/coff: allow for unhandled enum values 2024-03-22 14:04:17 +01:00
regeliv
13a9d94a80 Change std.os.exit to std.process.exit 2024-03-22 15:01:02 +02:00
Andrew Kelley
d8bb139da4
Merge pull request #19390 from ziglang/valgrind
make the behavior tests run almost valgrind clean
2024-03-22 02:04:48 -07:00
Andrew Kelley
a2651cbc82
Merge pull request #19388 from ziglang/cache-dedup
cache system file deduplication
2024-03-22 01:13:43 -07:00
Andrew Kelley
950359071b std.Build.Cache: bump manifest_file_size_max to 100M
Some users are hitting this limit. I think it's primarily due to not
deduplicating (solved in the previous commit) but this seems like a
better limit regardless.
2024-03-21 19:56:47 -07:00
Andrew Kelley
2f4bbd6c63 std.Build.Cache: use an array hash map for files
Rather than an ArrayList. Provides deduplication.
2024-03-21 19:56:30 -07:00
Andrew Kelley
ebec7336e2 std.array_hash_map: remove meta context verification
The zig way is to let the compiler provide errors, rather than trying to
implement the compiler in the standard library.

I played around with this and found the compile errors to be easier to
comprehend without this logic.
2024-03-21 19:40:56 -07:00
Andrew Kelley
1e46e36eac std.array_hash_map: enhance doc comments
- more readable in markdown
- remove confusing stuff
- linkification
- rewording
- move parameter documentation to parameter documentation
2024-03-21 17:54:58 -07:00
Andrew Kelley
7bc0b74b6d move Package.Path to std.Build.Cache.Path 2024-03-21 16:16:47 -07:00
Andrew Kelley
8778dc4bb2 extract std.Build.Cache.Directory into separate file 2024-03-21 16:11:59 -07:00
Andrew Kelley
54c08579e4
Merge pull request #19348 from jedisct1/wasi-threads-compfix
Unbreak support for WASI threads
2024-03-21 15:13:15 -07:00
Sean
f32723a237
Update frexp.zig (#19370)
1. Entirely rewrote frexp with generics, reducing the implementation to a single function and enabling parameters of types f80 and f16
2. Expanded upon the tests, making them more descriptive and comprehensive, and automatically generating the test bodies for each floating point type
3. Added a doctest for frexp
2024-03-21 18:08:52 -04:00
Andrew Kelley
4dc50151c4 std.mem.indexOfSentinel: valgrind integration
this code returns false positives in Valgrind, so we fall back to the
other implementation when running in valgrind.

see #17717
2024-03-21 15:01:57 -07:00
Andrew Kelley
33428fc6aa std.mem.indexOfScalarPos: valgrind integration
this code returns false positives in Valgrind, so we fall back to the
other implementation when running in valgrind.

see #17717
2024-03-21 14:35:37 -07:00
Andrew Kelley
afa0834195 add std.debug.inValgrind
This is like `@inComptime` but for the Valgrind virtual machine.

Related #17717
2024-03-21 14:35:08 -07:00
Andrew Kelley
12191c8a22 std: promote tests to doctests
Now these show up as "example usage" in generated documentation.
2024-03-21 14:11:46 -07:00
Andrew Kelley
5ae838d105 std: remove one layer of redundant parse_float namespace
there are still more, though.

This provides a doctest for the `parseFloat` function.
2024-03-21 14:08:54 -07:00
Andrew Kelley
c5bd19e45e std.Build.addTest: add doc comments
closes #15009
2024-03-21 14:02:58 -07:00
Marc Tiehuis
31791ae15b rename ryu128 -> format_float
Symmetry with parse_float and to hide the implementation from the user.
Additionally, we expose the entire namespace and provide some aliases so
everything is available to a user.

Closes #19366
2024-03-21 17:10:41 +02:00
Michael Ortmann
afdc41cfd6 std.os.windows: add POLL.IN and POLL.OUT 2024-03-21 17:08:50 +02:00
Igor Anić
e831313b10 std.io: remove BufferedTee
Introduced in  #19032 as a fix for #18967.
Not needed any more after #19253.
2024-03-20 21:05:35 -07:00
Andrew Kelley
4bc18c52f7 std.hash_map: fix pointer lock safety false positive
closes #19358
2024-03-20 17:14:52 -07:00
Michael Dusan
e4ed63f138 bsd: followup to std.posix extraction from std.os
netbsd fix:
- `Futex.zig:542:56: error: expected error union type, found 'c_int'`

openbsd fix:
- `emutls.zig:10:21: error: root struct of file 'os' has no member named 'abort'`
- `Thread.zig:627:22: error: expected 6 argument(s), found 5`
2024-03-20 14:06:35 -07:00
Andrew Kelley
cba1555104 std: don't do BYOS at the POSIX API layer
This was a mistake from day one. This is the wrong abstraction layer to
do this in.

My alternate plan for this is to make all I/O operations require an IO
interface parameter, similar to how allocations require an Allocator
interface parameter today.
2024-03-20 00:38:44 -07:00
Andrew Kelley
5d389535e8 std: fix inconsistent errno size on linux
Now it's always u16
2024-03-20 00:36:41 -07:00
Andrew Kelley
8c94950c24 fix compilation failures found by CI 2024-03-19 16:18:18 -07:00
Andrew Kelley
cd62005f19 extract std.posix from std.os
closes #5019
2024-03-19 11:45:09 -07:00
Frank Denis
9b454a8ce2 WASI-thread: panic if no allocator is given 2024-03-19 13:11:33 +01:00
Andrew Kelley
c52a2c338d std.Build.Step.Run: documentation for addFileArg and friends
Someone on IRC got these functions mixed up, and it sure would have been
helpful to have these docs in the first place, eh?
2024-03-18 23:52:52 -07:00
Frank Denis
c470016743 Unbreak support for WASI threads 2024-03-18 16:51:41 +01:00
Andrew Kelley
cbeab678a5
Merge pull request #19325 from Vexu/dynlib
std: adjust DynLib API
2024-03-17 20:19:51 -07:00
Reokodoku
1206604262
Implementing structs and better enums in build options 2024-03-18 02:46:54 +00:00
Jacob Young
c11b6adf13 Ast: fix comptime destructure
A preceding `comptime` keyword was being ignored if the first
destructure variable was an expression.
2024-03-17 15:23:16 -07:00
Veikka Tuominen
e6f74b78ef std: define error set of toPosixPath 2024-03-17 09:06:54 +02:00
Jacob Young
d10c52c194 AstGen: disallow alignment on function types
A pointer type already has an alignment, so this information does not
need to be duplicated on the function type.  This already has precedence
with addrspace which is already disallowed on function types for this
reason.  Also fixes `@TypeOf(&func)` to have the correct addrspace and
alignment.
2024-03-17 03:06:17 +01:00
Leo Emar-Kar
f88a971e4f
std.fmt: fix incorrect rounding on 0 precision of a decimal 2024-03-16 23:38:46 +00:00
Veikka Tuominen
ec2465542c std: adjust DynLib API
The cross-platform functions now use an error set that contains all possible errors on every platform.
2024-03-17 01:20:08 +02:00
Andrew Kelley
242ab81112
std: introduce pointer stability locks to hash maps (#17719)
This adds std.debug.SafetyLock and uses it in std.HashMapUnmanaged by
adding lockPointers() and unlockPointers().

This provides a way to detect when an illegal modification has happened and
panic rather than invoke undefined behavior.
2024-03-16 18:45:10 -04:00
Jari Vetoniemi
7628785983 std: use expectError in dynamic_library tests 2024-03-16 23:27:36 +02:00
Jari Vetoniemi
59e9f529df std: do not use inferred errors in dynamic_library
The error unions for WindowsDynLib and ElfDynLib do not contain all the possible errors.
So user code that relies on DynLib.Error will fail to compile.
2024-03-16 23:27:36 +02:00
Stephen Gregoratto
67df3ded68 Windows: make FILE_INFO_BY_HANDLE_CLASS a tagged enum
Fixes a TODO referencing the ancient issue #305.
2024-03-16 23:37:50 +11:00