Commit Graph

9829 Commits

Author SHA1 Message Date
Andrew Kelley
36060a774e fix namespacing of std.fs.Dir.Walker.Entry 2024-04-14 18:08:42 -07:00
Andrew Kelley
10106660e9 std.fs.Dir.Walker: maintain a null byte in path names 2024-04-14 17:59:43 -07:00
Jacob Young
60d5001ac8 wasi: change default os version to 0.1.0
This version represents "WASI Preview 1".

Closes #19581
2024-04-14 18:43:52 -04:00
Jacob Young
533f54c68e Target: cleanup 2024-04-14 15:33:46 -04:00
Frank Denis
e45bdc6bd6
std.crypto.pcurves.*: simpler, smaller, faster u64 addition with carry (#19644)
signature/s:

Algorithm        Before     After
---------------+---------+-------
ecdsa-p256        3707       4396
ecdsa-p384        1067       1332
ecdsa-secp256k1   4490       5147

Add ECDSA to the benchmark by the way.
2024-04-14 01:13:22 +02:00
Andrew Kelley
a59ad719d2 std.Build.Step.ConfigHeader: better error message 2024-04-13 05:14:08 -07:00
Andrew Kelley
54d1a529f6
Merge pull request #19637 from ziglang/http-host-port
std.http.Client: omit port in http host header sometimes
2024-04-13 03:39:35 -07:00
Андрей Краевский
7cc0e6d4cd
std: fix big int llshr to respect aliasing (#19612) 2024-04-13 03:06:23 -07:00
Andrew Kelley
0a3dff8125 Revert "std.http.Client: always omit port when it matches default"
This reverts commit db0a42b558c64eac2b4e41d02b078931b0c63af8, but keeps
the changes to std/Uri.zig.
2024-04-12 22:37:07 -07:00
Andrew Kelley
6deb3e3986 std.http.Client: always omit port when it matches default
This makes the host http header have the port if and only if it differs
from the defaults based on the protocol.

This is an alternate implementation that closes #19624.
2024-04-12 22:37:07 -07:00
Andrew Kelley
419753f45e std.http.Client: pass port to server based on user input
This makes the host http header have the port if and only if the URI
provided by the API user included it.

Closes #19624
2024-04-12 22:37:07 -07:00
Jacob Young
f1c0f42cdd cbe: fix optional codegen
Also reduce ctype pool string memory usage, remove self assignments, and
enable more warnings.
2024-04-13 01:35:20 -04:00
Andrew Kelley
10ff81c264
Merge pull request #19623 from ziglang/LazyPath
std.Build.LazyPath: upgrade API usages of source-relative path
2024-04-11 23:35:51 -07:00
Andrew Kelley
3bafc4400a std.debug.panic: pass the args
Why was this passing null? These values are available and useful.
2024-04-11 23:33:38 -07:00
Jeremia Dominguez
0ac15b9726 Document lazy dependency in init build.zig.zon
Also added the same description to doc/build.zig.zon.md
2024-04-11 14:56:07 -07:00
Brandon Black
271d896446 std.hash.crc: get rid of usingnamespace
This flips things around such that std/hash/crc.zig is generated
by the catalog-based generation tool, and the real code that used
to be in that file is moved out to std/hash/crc/impl.zig.  The
generated tests are moved to std/hash/crc/test.zig.  By going this
route, we eliminate the need for usingnamespace without changing
anything for callers of these interfaces.  The Crc32 tests are
simply added to the fixed part of the generated output and
compactified a bit.

This was the second-to-last usage of usingnamespace left in std.
2024-04-11 14:42:04 -07:00
leap123
786876c05e Fix stack iterator on UEFI
Don't know why UEFI wasn't excluded but freestanding is, probably an oversight since I want to have detailed debug info on my panic function on my Headstart bootloader.
2024-04-11 14:21:15 -07:00
Andrew Kelley
499a202a13 std.Build: revert the breaking changes only
The previous commit deleted the deprecated API and then made all the
follow-up changes; this commit reverts only the breaking API changes.
This commit can be reverted once 0.12.0 is tagged.
2024-04-11 14:09:58 -07:00
Andrew Kelley
b30ad74908 remove deprecated LazyPath.path union tag 2024-04-11 14:02:47 -07:00
andrewkraevskii
f7a76bdfe3 autodoc: fix tokenizer 2024-04-10 20:44:10 -07:00
Andrew Kelley
7fb5a0b18b introduce std.Build.path; deprecate LazyPath.relative
This adds the *std.Build owner to LazyPath so that lazy paths returned
from a dependency can be used in the application without friction or
footguns.

closes #19313
2024-04-10 15:02:20 -07:00
Jacob Young
c4587dc9f4 Uri: propagate per-component encoding
This allows `std.Uri.resolve_inplace` to properly preserve the fact
that `new` is already escaped but `base` may not be.  I originally tried
just moving `raw_uri` around, but it made uri resolution unmanagably
complicated, so I instead added per-component information to `Uri` which
allows extra allocations to be avoided when constructing uris with
components from different sources, and in some cases, deferring the work
all the way to when the uri is printed, where an allocator may not even
be needed.

Closes #19587
2024-04-10 02:11:54 -07:00
Andrew Kelley
215de3ee67
Merge pull request #19500 from ianic/package_filter_errors
package manager: filter unpack errors on paths excluded by manifest
2024-04-09 13:22:48 -07:00
Andrew Kelley
fc17402919
std.crypto.Certificate: support 3072 bits RSA certificate (#19591)
Used by musicbrainz.org API.
2024-04-09 12:16:45 -07:00
Frank Denis
9d27f34d04
crypto.sha3: implement constructions from NIST SP 800-185 (#19533)
https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-185.pdf

This adds useful standard SHA3-based constructions from the
NIST SP 800-185 document:

- cSHAKE: similar to the SHAKE extensible hash function, but
with the addition of a context parameter.
- KMAC: SHAKE-based authentication / keyed XOF
- TupleHash: unambiguous hashing of tuples

These are required by recent protocols and specifications.

They also offer properties that none of the currently available
constructions in the stdlib offer, especially the ability to safely
hash tuples.

Other keyed hash functions/XOFs will fall back to using HMAC, which
is suboptimal from a performance perspective, but fine from a
security perspective.
2024-04-09 12:16:19 -07:00
Igor Anić
3d5a9237f7 fetch: use empty string instead of null for root_dir
Make it consistent with Cache.Path sub_path.
Remove null check in many locations.
2024-04-09 15:00:22 +02:00
Jacob Young
7611d90ba0 InternPool: remove slice from byte aggregate keys
This deletes a ton of lookups and avoids many UAF bugs.

Closes #19485
2024-04-08 13:24:08 -04:00
Jacob Young
3f1f05011e haiku: fix abi and dynamic linker detection 2024-04-08 13:20:14 -04:00
Jacob Young
fcdb7027e9 haiku: fix linking issues 2024-04-08 13:20:14 -04:00
Jacob Young
0c83fa2fd0 haiku: fix directory iteration 2024-04-08 13:20:14 -04:00
Andrew Kelley
fbb38a7682 std.Build: fix regression in Step.ConfigHeader
Commit 0b7123f41d regressed the
`include_path` option of ConfigHeader which is intended to set the path,
including subdirectories, that C code would pass to an include
directive.

For example if it passes

    .include_path = "config/config.h",

Then the C code should be able to have

    #include "config/config.h"

This regressed https://github.com/andrewrk/nasm/ but this commit fixes
it.
2024-04-08 07:11:18 -07:00
Ian Johnson
6dcbad780c
Autodoc: fix Markdown indented lists (#19577)
Previously, indentation was not being handled correctly in some cases,
causing examples such as `std.json.WriteStream` to be rendered with
improper list nesting.

Additionally, some more test cases have been added to ensure
indentation (or lack of indentation) is handled correctly in some other
constructs.
2024-04-08 09:49:22 +00:00
Andrew Kelley
355cceebc7
Merge pull request #18920 from castholm/fmtId
`std.zig.fmtId`: conditionally escape primitives/`_` (breaking)
2024-04-07 19:22:35 -07:00
Andrew Kelley
1b27146792
Merge pull request #18590 from castholm/move-standalone-test-cases
std.Build: Remove `anonymousDependency`
2024-04-07 16:08:23 -07:00
Carl Åstholm
e5bf1a5d50 Make std.Build.dependencyInner private 2024-04-07 16:06:20 -07:00
Carl Åstholm
ef90d3af54 Remove std.Build.anonymousDependency 2024-04-07 16:06:19 -07:00
Carl Åstholm
09f1bbe11b std.Build: Remove unused c_std field
This field has not been referenced by compile steps since
e76ce2c1d0, all the way back in 2019.
To specify the language standard, pass `-std=[value]` as a regular
C flag instead.
2024-04-07 16:06:15 -07:00
Carl Åstholm
05126fc4c5 std.Build: add dependencyFromBuildZig 2024-04-07 15:54:30 -07:00
Andrew Kelley
e204a6edb8
Merge pull request #18988 from castholm/lazy-build-zig
std.Build: add `lazyImport` (`@import` for lazy dependencies)
2024-04-07 15:43:54 -07:00
Carl Åstholm
2465c328aa Use @TypeOf instead of std.meta in test_runner.zig
This might fix a CI failure for powerpc64le-linux-musl.
2024-04-07 21:16:29 +02:00
Carl Åstholm
eee5400b7d Account for dependency boundaries when duping headers
This is a temporary workaround that can be revered if/when 'path'
lazy paths are updated to encode which build root they are relative to.
2024-04-07 15:34:47 +02:00
Carl Åstholm
d99e44a157 Document added/updated functions
Also renames `addHeaders` to `addHeadersDirectory` for clarity.
2024-04-07 15:34:47 +02:00
Carl Åstholm
5af4e91e00 Oops, forgot to dupe installations in installLibraryHeaders
Added test coverage for `installLibraryHeaders`
2024-04-07 15:34:47 +02:00
Carl Åstholm
8ce3a8b604 WriteFile.addCopyDirectory should include all files by default 2024-04-07 15:34:47 +02:00
Carl Åstholm
e16db29887 Implement WriteFile.addCopyDirectory 2024-04-07 15:34:47 +02:00
Carl Åstholm
2c7be4f8dd Create an include tree of installed headers for dependent modules 2024-04-07 15:34:46 +02:00
Carl Åstholm
ce71eb31da Update addInstallHeaderFile to take a LazyPath 2024-04-07 15:34:46 +02:00
Carl Åstholm
ff0bec60b7 Remove dest_builder field from InstallDir/File
This is no longer needed after the installed headers refactoring.
2024-04-07 15:34:46 +02:00
Carl Åstholm
0b7123f41d std.Build: correct behavior of Step.Compile.installHeader
Previously, `Step.Compile.installHeader` and friends would incorrectly
modify the default `install` top-level step, when the intent was for
headers to get bundled with and installed alongside an artifact. This
change set implements the intended behavior.

This carries with it some breaking changes; `installHeader` and
`installConfigHeader` both have new signatures, and
`installHeadersDirectory` and `installHeadersDirectoryOptions` have been
merged into `installHeaders`.
2024-04-07 15:32:44 +02:00
Carl Åstholm
b381fb805c std.Build: add lazyImport (@import for lazy dependencies) 2024-04-07 15:30:19 +02:00
Carl Åstholm
9181ecd951 Sema: fix runtime call of inline fn with comptime-known comptime-only ret type 2024-04-07 15:07:55 +02:00
Carl Åstholm
4c393c7468 Update usages of fmtId/isValidId
`{}` for decls
`{p}` for enum fields
`{p_}` for struct fields and in contexts following a `.`

Elsewhere, `{p}` was used since it's equivalent to the old behavior.
2024-04-07 14:47:11 +02:00
Carl Åstholm
d8e7eda5f4 std.zig.fmtId: conditionally escape primitives/_
This is a breaking change.

This updates `std.zig.fmtId` to support conditionally escaping
primitives and the reserved `_` identifier via format specifiers:

- `{}`: escape invalid identifiers, identifiers that shadow primitives
  and the reserved `_` identifier.
- `{p}`: same as `{}`, but don't escape identifiers that
  shadow primitives.
- `{_}`: same as `{}`, but don't escape the reserved `_` identifier.
- `{p_}` or `{_p}`: only escape invalid identifiers.

(The idea is that `p`/`_` mean "allow primitives/underscores".)

Any other format specifiers will result in compile errors.

Additionally, `isValidId` now considers `_` a valid identifier. If this
distinction is important, consider combining existing uses of this
function with the new `isUnderscore` function.
2024-04-07 14:47:10 +02:00
Jakub Konka
96bc8f17cf lib/std/macho: update PLATFORM enum with VISIONOS tags 2024-04-06 22:21:57 +02:00
Josh Wolfe
9ab6d91067
zig std accepts --port and --no-open-browser (#19559) 2024-04-06 15:18:43 -04:00
Josh Wolfe
05b185811e
json.WriteStream.objectFieldRaw() (#19553) 2024-04-06 03:52:20 -04:00
Jakub Konka
23f729aec9
Merge pull request #19260 from mikdusan/macos-zippered
macos: add zippered support
2024-04-05 23:37:51 +02:00
Igor Anić
b1e70edd90 tar: find package root dir in pipeToFileSystem
While iterating over all files in tarball set root_dir in diagnostic if
there is single root in tarball. Will be used in package manager with
strip_components = 0 to find the root of the fetched package.
2024-04-03 19:44:51 +02:00
Igor Anić
b88ae8dbd8 std.tar: implement executable bit only 2024-04-02 14:02:43 -07:00
Michael Lynch
2a7cedfeb9 Refactor ArrayList replaceRange tests 2024-04-02 13:46:51 -07:00
Igor Anić
254c05a9e1 io_uring: simplify copy_cqe logic
First copy as much as we can in this cycle. If there is more needed
wrap and start from the buffer 0 position.
2024-03-31 23:57:16 +02:00
Igor Anić
704660c81a io_uring: fix copy_cqes logic 2024-03-31 23:52:46 +02:00
Igor Anić
631c28c9e3 io_uring: add failing test
For issue: #19451
2024-03-31 23:51:40 +02:00
Jacob Young
fb192df4f2 cbe: fix uncovered bugs 2024-03-30 20:50:48 -04:00
Jacob Young
eb723a4070 Update uses of @fieldParentPtr to use RLS 2024-03-30 20:50:48 -04:00
Jacob Young
17673dcd6e AstGen: use RLS to infer the first argument of @fieldParentPtr 2024-03-30 20:50:48 -04:00
Jacob Young
e409afb79b Update uses of @fieldParentPtr to pass a pointer type 2024-03-30 20:50:48 -04:00
Jacob Young
5a41704f7e cbe: rewrite CType
Closes #14904
2024-03-30 20:50:48 -04:00
Jacob Young
6f10b11658 cbe: fix bugs revealed by an upcoming commit
Closes #18023
2024-03-30 20:50:48 -04:00
Marc Tiehuis
aff71c6132 implement ryu 64-bit backend
The 64-bit backend supports printing all floats up to 64-bits. The
128-bit continues to be used for larger values.

This backend is approximately ~3x faster. Code size is a little smaller
in the full table case and much smaller if using the samll tables.

The implementation uses the same code-paths, parameterized by a set of
tables and their pow5 implementations. We continue to use the same
rounding/formatting mechanisms. Initially I explored a separate
implementation, as upstream does this and has specific optimizations for
these paths but for simplicity we don't. The performance loss is small
enough at this point and keeping them combined keeps them in sync.

Closes #19264.
2024-03-29 22:15:17 -07:00
Jakub Konka
fb9673f208 lib/std/coff: add ImportNameType.NAME_EXPORTAS variant 2024-03-29 20:34:28 +01:00
Sean
a2df84d0ff
std.math: rework modf
- Changed `modf_result` to `Modf` to better fit naming conventions
- Reworked `modf` to be far simpler and support all floating point types (as well as vectors) (I have done benchmarks and can confirm that the performance is roughly equivalent to the old implementation)
- Added more descriptive tests for modf
- Deprecated `modf32_result` and `modf64_result` in favor of `Modf(f32)` and `Modf(f64)` respectively
2024-03-29 09:33:57 +00:00
Andrew Kelley
3661133f98
Merge pull request #19399 from ypsvlq/mingw
mingw: support -municode
2024-03-28 14:16:30 -07:00
Veikka Tuominen
0588595128 std.PackedInt: remove workaround for stage1 bug
Closes #7635
2024-03-28 15:24:01 +02:00
Ian Johnson
3fb6bb1449 std-docs: include builtin module in sources.tar
Now that `-femit-docs` includes all modules, including the builtin
module, in the generated source tarball, it makes sense to apply the
same logic to the std-docs server. std-docs constructs its own tarball,
so a different approach is needed to achieve the same end result.
2024-03-28 00:30:42 -04:00
Ryan Liptak
4e428415e5 Build.Step.Compile: Add mingw_unicode_entry_point field
Corresponds to the `-municode` CLI flag
2024-03-27 10:06:06 +00:00
Elaine Gibson
add74427b9 mingw: support -municode 2024-03-27 10:05:57 +00:00
Jacob Young
71d878ba50 std.zig: remove extraneous newlines in log messages 2024-03-27 01:55:42 -04:00
Jacob Young
77ff6bc656 haiku: fix poll definitions 2024-03-27 01:55:42 -04:00
David Rubin
341857e5cd make addCSourceFiles assert options.files are relative 2024-03-26 14:03:39 +02:00
Prokop Randáček
055023efb4
valgrind client request wrappers take const pointers (#19237)
* valgrind client request wrappers take const pointers

* require zero terminated strings in valgrind wrappers
2024-03-26 14:00:13 +02:00
Veikka Tuominen
59203cb4f2
Merge pull request #19385 from markus-oberhumer-forks/improve-old-glibc-versions
Improve old glibc versions
2024-03-26 13:56:07 +02:00
Luis Cáceres
29e41c6850 std.Build: dupe provided paths for Step.Fmt.create() 2024-03-26 13:54:24 +02:00
Andrew Kelley
405502286d
Merge pull request #19414 from mlugg/comptime-mutable-memory-yet-again
compiler: implement analysis-local comptime-mutable memory
2024-03-25 16:32:18 -07:00
Andrew Kelley
abadad4640
Merge pull request #19402 from ianprime0509/markdown-autolinks
Autodoc: hyperlink URLs in text
2024-03-25 15:36:37 -07:00
Andrew Kelley
32b4d85605
Merge pull request #19406 from jacobly0/haiku
haiku: get a cross-compiled compiler working
2024-03-25 15:33:51 -07:00
HydroH
ef31d8f48f
autodoc: better indentation handling when rendering source code (#19422)
Closes #19293
2024-03-25 18:20:15 -04:00
mlugg
9c3670fc93
compiler: implement analysis-local comptime-mutable memory
This commit changes how we represent comptime-mutable memory
(`comptime var`) in the compiler in order to implement the intended
behavior that references to such memory can only exist at comptime.

It does *not* clean up the representation of mutable values, improve the
representation of comptime-known pointers, or fix the many bugs in the
comptime pointer access code. These will be future enhancements.

Comptime memory lives for the duration of a single Sema, and is not
permitted to escape that one analysis, either by becoming runtime-known
or by becoming comptime-known to other analyses. These restrictions mean
that we can represent comptime allocations not via Decl, but with state
local to Sema - specifically, the new `Sema.comptime_allocs` field. All
comptime-mutable allocations, as well as any comptime-known const allocs
containing references to such memory, live in here. This allows for
relatively fast checking of whether a value references any
comptime-mtuable memory, since we need only traverse values up to
pointers: pointers to Decls can never reference comptime-mutable memory,
and pointers into `Sema.comptime_allocs` always do.

This change exposed some faulty pointer access logic in `Value.zig`.
I've fixed the important cases, but there are some TODOs I've put in
which are definitely possible to hit with sufficiently esoteric code. I
plan to resolve these by auditing all direct accesses to pointers (most
of them ought to use Sema to perform the pointer access!), but for now
this is sufficient for all realistic code and to get tests passing.

This change eliminates `Zcu.tmp_hack_arena`, instead using the Sema
arena for comptime memory mutations, which is possible since comptime
memory is now local to the current Sema.

This change should allow `Decl` to store only an `InternPool.Index`
rather than a full-blown `ty: Type, val: Value`. This commit does not
perform this refactor.
2024-03-25 14:49:41 +00:00
Simon Brown
5c628312b1
std.enums: fix EnumSet.init and EnumMap.init for non-exhaustive enums 2024-03-24 22:29:27 +00:00
Jacob Young
af0668d6c2 Build.Cache: fix UAF during unhit 2024-03-24 18:28:16 +00:00
Jacob Young
879ea2710f reduce: fix compile errors
Regressed by c11b6adf13.
2024-03-24 17:29:39 +01: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
Ian Johnson
ad34ed5a63 Autodoc: recognize Markdown links in plain text
This extension to the typical `<>` Markdown autolink syntax allows
HTTP(S) links to be recognized in normal text without being delimited by
`<>`. This is the most natural way to write links in text, so it makes
sense to support it and allow documentation comments to be written in a
more natural way.
2024-03-22 20:53:25 -04:00
Ian Johnson
d3ca9d55d9 Autodoc: implement Markdown autolinks
Closes #19265

This commit implements support for Markdown autolinks delimited by angle
brackets. The precise syntax accepted is documented in the doc comment
of `markdown.zig`.
2024-03-22 20:03:32 -04: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
43edd53c33
Merge pull request #19365 from ziglang/update-mingw-w64
Update mingw-w64 and add Win32 def files
2024-03-20 17:33:56 -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
f47e92ca0d mingw-w64: update to latest master
upstream commit 0bac2d3cdb122dadcdee90009f7e24a69d56939f
2024-03-20 11:26:09 -07:00
Andrew Kelley
25fb6de83c mingw-w64: update to reflect latest tool changes
upstream commit dddccbc3ef50ac52bf00723fd2f68d98140aab80

closes #18968
2024-03-20 11:23:51 -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
e646e01161 Revert "back out the build_runner.zig moving change"
This reverts commit 1a01151a4e in
preparation for a zig1.wasm update.
2024-03-17 03:06:39 +01: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
Stephen Gregoratto
69175ad62f Windows: Add wrappers for GetCurrent(Process|Thread) via NT_TIB
This is how they've been implemented in `kernel32` since NT 3.1.
2024-03-16 23:37:50 +11:00
Stephen Gregoratto
9532f72937 Windows: Replace CreatePipe with ntdll implementation
This implementation is now a direct replacement for the `kernel32` one.
New bitflags for named pipes and other generic ones were added based on
browsing the ReactOS sources.

`UNICODE_STRING.Buffer` has also been changed to be nullable, as
this is what makes the implementation work.
This required some changes to places accesssing the buffer after a
`SUCCESS`ful return, most notably `QueryObjectName` which even referred
to it being nullable.
2024-03-16 23:37:50 +11:00
Igor Anić
3ea1276eeb
io_uring: ring mapped buffers (#17806)
* io_uring: ring mapped buffers

Ring mapped buffers are newer implementation of ring provided buffers, supported
since kernel 5.19. Best described in Jens Axboe [post](https://github.com/axboe/liburing/wiki/io_uring-and-networking-in-2023#provided-buffers)

This commit implements low level io_uring_*_buf_ring_* functions as mostly
direct translation from liburing. It also adds BufferGroup abstraction over those
low level functions.

* io_uring: add multishot recv to BufferGroup

Once we have ring mapped provided buffers functionality it is possible to use
multishot recv operation. Multishot receive is submitted once, and completions
are posted whenever data arrives on the socket. Received data are placed in a
new buffer from buffer group.

Reference: [io_uring and networking in 2023](https://github.com/axboe/liburing/wiki/io_uring-and-networking-in-2023#multi-shot)

Getting NOENT for cancel completion result, meaning:
  -ENOENT
    The request identified by user_data could not be located.
    This could be because it completed before the cancelation
    request was issued, or if an invalid identifier is used.

https://man7.org/linux/man-pages/man3/io_uring_prep_cancel.3.html
https://github.com/ziglang/zig/actions/runs/6801394000/job/18492139893?pr=17806

Result in cancel/recv cqes are different depending on the kernel.
on older kernel (tested with v6.0.16, v6.1.57, v6.2.12, v6.4.16)
  cqe_cancel.err() == .NOENT
  cqe_crecv.err() == .NOBUFS
on kernel (tested with v6.5.0, v6.5.7)
  cqe_cancel.err() == .SUCCESS
  cqe_crecv.err() == .CANCELED
2024-03-15 22:34:31 -04:00
Andrew Kelley
ce4245f873
Merge pull request #19312 from mikdusan/bsd-debitrot
bsd: debitrot
2024-03-15 16:59:05 -07:00