Commit graph

9004 commits

Author SHA1 Message Date
Andrew Kelley
cd7960ea75 std: disable flaky tcp server test
Tracking issue: #18315
2023-12-19 12:01:09 -07:00
Carl Åstholm
4d9c4ab82c More accurate argv-to-command-line serialization when spawning child processes on Windows
The old implementation had a bug in it in that it didn't quote empty strings, but it also didn't properly follow the special quoting rules required for the first argument (the executable name). This new implementation serializes the argv correctly such that it can be parsed by the `CommandLineToArgvW` algorithm.
2023-12-18 23:58:26 +01:00
Carl Åstholm
13f78e24b8 Update ArgIterator on Windows to follow standard Windows parsing rules
This adds `ArgIteratorWindows`, which faithfully replicates the quoting and escaping behavior observed in `CommandLineToArgvW` and should make Zig applications play better with processes that abuse these quirks.
2023-12-18 22:55:46 +01:00
Artem Kolichenkov
90a19f7411
std.net: add explicit error sets for IP parsing
Inferred errors in switch statements prevented IP address parsing at comptime.
Adding explicit error sets fixes it.

Closes #18276
2023-12-16 16:15:51 +00:00
Carl Åstholm
779b8e2598 Expose -f(no-)formatted-panics to the build system 2023-12-16 04:08:05 +02:00
Jan Philipp Hafer
70664547ce std.net.test: cleanup socket stream 2023-12-15 21:15:35 +02:00
Jakub Konka
5d12622469 lib/std/Build/CheckObject: split dyld info into subsections for easier scoped testing 2023-12-13 13:53:05 +01:00
Jakub Konka
f26459e594 lib/std/Build/CheckObject: update all tests to new API 2023-12-13 12:06:25 +01:00
Jakub Konka
c4519d6bba lib/std/Build/CheckObject: implement for Wasm 2023-12-13 11:41:51 +01:00
Jakub Konka
92cca7fbf1 lib/std/Build/CheckObject: implement for ELF 2023-12-13 11:38:57 +01:00
Jakub Konka
2492488501 lib/std/Build/CheckObject: introduce scoped checks; implement for MachO 2023-12-13 11:22:46 +01:00
Jakub Konka
a38af5f542 lib/std/Build/CheckObject: fix parsing and dumping special dylib lookup values 2023-12-13 01:29:01 +01:00
loris
37458cc886 allow sqe entries up to 32768 2023-12-12 06:49:19 +02:00
Loris Cro
26e27f5f64 std.Build.Cache: add HexDigest type 2023-12-11 23:08:03 +01:00
Eric Eastwood
5c1428ea9d
Add getPtrConstAssertContains(...) for compatibility with a const std.EnumMap
This way people can use `const` with a `std.EnumMap`
and be able to `getPtrAssertContains(...)` like the
would with a mutable `var` instance.

Aligns with the existing `getPtr(...)`/`getPtrConst(...)`
methods.
2023-12-11 22:04:43 +00:00
Travis Staloch
5bbacb0c8c fmt.parseWithSign(): prevent edge case overflows
previously when T was smaller than 8 bits, it was possible for base
to overflow T (because base is a u8).  this patch prevents this by
accumulating into a U rather than T which is at least 8 bits wide.

this is the best way i could think of to maintain performance.  this
will only affect parsing of integers less than 8 bits by adding one
additional cast at return.  additionally, this patch may be slightly
slower to return an error for integers less than 8 bits which overflow
because it will accumulate a few more digits before the overflow check
at return.

* add tests which previously overflowed when they shouldn't have

closes #18157
2023-12-11 17:49:22 +02:00
xdBronch
a817e27c7d use linux.perf_event_open directly 2023-12-11 17:48:18 +02:00
Jakub Konka
5c0d58b71f
Merge pull request #18243 from ziglang/check-macho-more
lib/std/Build/CheckObject: dump more Mach-O info
2023-12-10 09:48:50 +01:00
Jakub Konka
a2d8e03931 lib/std/Build/CheckObject: dump Mach-O dyld_info_only bind, weak-bind and lazy-bind data 2023-12-10 00:50:52 +01:00
Jakub Konka
5bda88f9a3 lib/std/Build/CheckObject: dump Mach-O dyld_info_only rebase data 2023-12-10 00:14:53 +01:00
Jakub Konka
40952b4cdb lib/std/Build/CheckObject: dump Mach-O dyld_info_only exports data 2023-12-09 10:57:12 +01:00
Jakub Konka
eb70c8801e lib/std/Build/CheckObject: dump Mach-O symbol attributes 2023-12-09 09:38:23 +01:00
Veikka Tuominen
69195d0cd4 AstGen: add error for using inline loops in comptime only scopes 2023-12-08 16:54:32 -08:00
Jakub Konka
36981d46a3 lib/std/Build/CheckObject: dump Mach-O header 2023-12-08 20:31:45 +01:00
Carter Snook
d270020114
std.os.dl_iterate_phdr: remove u16 error cast 2023-12-08 16:10:33 +02:00
yunsh1
7e4177a4b1 fmt: Skip extra newline if doc_comment exists 2023-12-08 16:05:46 +02:00
Meghan Denny
6a12fd62c1 std: make std.unicode.initComptime() a comptime-known function
resolved a TODO :)
2023-12-08 15:59:17 +02:00
xdBronch
7a46c20a79 switch to mem.span
Co-authored-by: erikarvstedt <36110478+erikarvstedt@users.noreply.github.com>
2023-12-08 15:58:08 +02:00
xdBronch
e9bd10cfda add getName helper to inotify_event 2023-12-08 15:58:08 +02:00
Jakub Konka
56deb5b054 macho: rename flag to EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION 2023-12-06 23:29:08 +01:00
Jakub Konka
79316ee10b lib/std/macho: add missing LC defs and missing N_NO_DEAD_STRIP desc for nlists 2023-12-06 22:25:44 +01:00
Frank Denis
f276bb107e verify_buffer is not expected to be sentinel-terminated 2023-12-01 20:04:52 +01:00
Frank Denis
9831dc9e0c TLS: The 0x1306 TLS identifier was updated to TLS_AEGIS_256_SHA512
Following the recommendations from [1], the AEGIS specification
and the TLS registry [2] were updated to recommend SHA512 for the
traffic secrets.

[1] https://eprint.iacr.org/2023/913.pdf
[2] https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-4
2023-12-01 18:00:15 +01:00
Jacob Young
bf5ab54510 test: test with -fstrip and fix failures
Closes #17513
2023-12-01 04:34:50 +00:00
David Rubin
1e42a3de89
Remove all usages of std.mem.copy and remove std.mem.set (#18143) 2023-11-29 16:03:02 -05:00
tjog
22d7c7d295
std.debug: optimized printLineFromFileAnyOs (#18142)
* std.debug: optimized printLineFromFileAnyOs

Uses mem.indexOfScalar to speed line iteration instead of byte for byte.
Also prints the whole line in a single write (or up to a page size at a
time)

Closes #18099

* add test cases for printLineFromFileAnyOs
2023-11-29 14:58:56 -05:00
Carter Snook
a98d4a66e9 std.net: replace @ptrCast with slice syntax 2023-11-27 23:14:07 -05:00
Carter Snook
a0fbc6815c std.zig.system: remove explicit usize cast
The cast seems to no longer be necessary after changes in interactions
between `u64` and `usize`.
2023-11-27 23:13:30 -05:00
Andrew Kelley
70d51be3a2 std.zig.render: add ability to append strings after nodes 2023-11-26 19:41:00 -07:00
Lauri Tirkkonen
19af8aac82 os: expect ETIMEDOUT, ECONNRESET, ENOTCONN from recvfrom & read family
reads on eg. connected TCP sockets can fail with ETIMEDOUT, and ENOTCONN
happens eg. if you try to read a TCP socket that has not been connected
yet.

interestingly read() was already handling CONNRESET & TIMEDOUT, but
readv(), pread(), and preadv() were somewhat inconsistent.
2023-11-26 21:35:36 -05:00
Daniel A.C. Martin
280140595f fix: Prevent segfault when using add.Module()
This duplicates the source file string (as is done in other places such
as `addAssemblyFile()`) in order to prevent a segfault when the supplied
string is freed by the caller. This is still seen when the caller makes
use of a defer statement.
2023-11-26 21:33:28 -05:00
Michael Dusan
50bbb9d960 bsd: debitrot atomic and debug
closes #18119
2023-11-26 14:28:22 -05:00
David Rubin
069a079ddc complete todo 2023-11-26 14:27:39 -05:00
Andrew Kelley
7103088e4a
Merge pull request #18105 from Vexu/translate-c
Use Aro's tokenizer in `translate-c`
2023-11-26 02:22:51 -05:00
Bogdan Romanyuk
2ff707be78
AstGen: check allowed non-function builtins with declarative field (#18120) 2023-11-26 02:21:58 -05:00
Veikka Tuominen
74010fecc7 translate-c: use Aro's tokenizer 2023-11-25 12:28:19 +02:00
Andrew Kelley
648f592db1
Merge pull request #18109 from nektro/std-compiler
compiler: move BuiltinFn and AstRlAnnotate to std.zig namespace
2023-11-25 04:11:46 -05:00
Andrew Kelley
e834e95d71 Revert "std.SinglyLinkedList: add sort function"
This reverts commit 8b10970836.

This implementation has the following problems:

* It does not provide context to the less than function. This will be an
  API break in order to fix.
* It uses recursion, causing unbounded stack memory usage - likely
  depending on user input, which is extra problematic.
* Sorting linked lists is generally an inefficient operation;
  encouraging it by having a standard library function for it may
  lead to suboptimal software being written in Zig.

Furthermore, there is almost no benefit to providing a sort function as
a method, when a third party implementation can easily be passed a
linked list to then be sorted.
2023-11-24 22:33:50 -07:00
Meghan Denny
121d995fcb frontend: move AstRlAnnotate to std.zig namespace 2023-11-24 17:09:08 -08:00
Meghan Denny
84d58aaa1f frontend: move BuiltinFn to std.zig namespace 2023-11-24 17:04:52 -08:00