Commit Graph

12241 Commits

Author SHA1 Message Date
Andrew Kelley faab6d5cbf fix hello world 2025-07-01 16:35:26 -07:00
Jacob Young 1501734747 io: fix compile errors 2025-07-01 16:35:26 -07:00
Jacob Young 5d22c588e2 ubsan_rt: port to new std.io.BufferedWriter API 2025-07-01 16:35:26 -07:00
Jacob Young d76c8d0bd2 Dwarf: cleanup and port to new std.io.BufferedReader API 2025-07-01 16:35:26 -07:00
Andrew Kelley 9dc0b4a98f back to the anyerror!usize vtable 2025-07-01 16:35:26 -07:00
Andrew Kelley 6ac7931bec std: hacking around with buffered reader / writer semantics
I think I'm going to back out these vtable changes in the next commit
2025-07-01 16:35:26 -07:00
Andrew Kelley 890a02c345 std.io: move getStdIn, getStdOut, getStdErr functions to fs.File
preparing to rearrange std.io namespace into an interface
2025-07-01 16:35:26 -07:00
Andrew Kelley 6c48aad991 update some more std lib API to new Reader/Writer
std.compress needs an audit, I see some problems
2025-07-01 16:35:26 -07:00
Andrew Kelley 31e0b5c3c7 fix merge conflicts
partially reapply b636d56d6a
2025-07-01 16:35:26 -07:00
Andrew Kelley 57e1fc29d2 reader interface vecs and bufferedwriter arraylist 2025-07-01 16:35:26 -07:00
Andrew Kelley 5aa8573f2b redo reader 2025-07-01 16:35:26 -07:00
Andrew Kelley 2fb6ce2f92 update some more compiler code 2025-07-01 16:35:26 -07:00
Andrew Kelley 4aed226e07 zig fmt compiling 2025-07-01 16:35:26 -07:00
Andrew Kelley 5ada2e3937 std.http tests passing with updated writer API
fix splat implementation in std.fs.File

update http.Client, with caveats:
 * TODO: only 1 underlying write call
 * TODO: don't rely on max_buffers_len exceeding the caller
 * TODO: handle splat

update net.Stream API. also make it use WSASend on windows
2025-07-01 16:35:26 -07:00
Andrew Kelley 6c7b103122 std.crypto.tls.Client: upgrade to std.io.BufferedWriter
This is pretty clearly a better API.
2025-07-01 16:35:26 -07:00
Andrew Kelley d87b59f5a5 std.fmt.format: support base 64 encoding 2025-07-01 16:35:26 -07:00
Andrew Kelley 8464efa5dd std.posix.sendfile: don't write trailers on linux
After sending the file, better to return total bytes written. The caller
will decide if they want to do another syscall with the trailers. Maybe
the caller would rather buffer them.
2025-07-01 16:35:26 -07:00
Nameless a500651370 os: fix missing and incorrect msghdr definitions
Macos uses the BSD definition of msghdr

All linux architectures share a single msghdr definition. Many
architectures had manually inserted padding fields that were endian
specific and some had fields with different integers. This unifies all
architectures to use a single correct msghdr definition.
2025-07-01 16:35:26 -07:00
Andrew Kelley bf00eb3006 more of the compiler updated to new Writer API 2025-07-01 16:35:26 -07:00
Andrew Kelley 09af68de80 fix duration formatting 2025-07-01 16:35:26 -07:00
Andrew Kelley 051c7af49a get std lib json tests passing 2025-07-01 16:35:26 -07:00
Andrew Kelley e154b62d63 give std.json an API spanking
Avoid Redundant Names in Fully-Qualified Namespaces
2025-07-01 16:35:26 -07:00
Andrew Kelley 7569494b45 fix byte formatted printing 2025-07-01 16:35:26 -07:00
Andrew Kelley bb1dffcf32 much of the compiler upgraded to new API 2025-07-01 16:35:26 -07:00
Andrew Kelley f3be721785 build runner compiling 2025-07-01 16:35:26 -07:00
Andrew Kelley 716b4489be update more of the std lib to new API 2025-07-01 16:35:26 -07:00
Andrew Kelley e60adb97d0 AllocatingWriter passing unit test 2025-07-01 16:35:26 -07:00
Andrew Kelley fced9467e8 std ArrayList unit tests passing 2025-07-01 16:35:26 -07:00
Andrew Kelley 221b194f28 std.io.BufferedWriter: implement hex string printing 2025-07-01 16:35:26 -07:00
Andrew Kelley 824216b1d4 remove legacy writer from array list 2025-07-01 16:35:25 -07:00
Andrew Kelley ff3581ca2d update some of the build system to new API 2025-07-01 16:35:25 -07:00
Andrew Kelley 1d0495678d fixes
writeFile should be split into two
2025-07-01 16:35:25 -07:00
Andrew Kelley 35824e4822 writeSplat 2025-07-01 16:35:25 -07:00
Andrew Kelley b26aceba7d thinking about splat being the only function 2025-07-01 16:35:25 -07:00
Andrew Kelley 5356f3a307 migrate some std lib 2025-07-01 16:35:25 -07:00
Andrew Kelley c2fc6b0b6c ArrayListWriter 2025-07-01 16:35:25 -07:00
Andrew Kelley 00c6c836a6 std: start reworking std.io
hello world is compiling
2025-07-01 16:35:25 -07:00
Micah Switzer b8ac740a1b Fix zig std regression FTBFS
Regressed in 9176408
2025-06-30 18:06:14 +02:00
Alex Rønne Petersen e837765956 zig rc: Fix include directory detection when cross-compiling from certain host archs (#24288)
* resinator: Only preprocess when the input is an .rc file

* resinator: Fix include directory detection when cross-compiling from certain host archs

Previously, resinator would use the host arch as the target arch when looking for windows-gnu include directories. However, Zig only thinks it can provide a libc for targets specified in the `std.zig.target.available_libcs` array, which only includes a few for windows-gnu. Therefore, when cross-compiling from a host architecture that doesn't have a windows-gnu target in the available_libcs list, resinator would fail to detect the MinGW include directories.

Now, the custom option `/:target` is passed to `zig rc` which is intended for the COFF object file target, but can be re-used for the include directory target as well. For the include directory target, resinator will convert the MachineType to the relevant arch, or fail if there is no  equivalent arch/no support for detecting the includes for the MachineType (currently 64-bit Itanium and EBC).

Fixes the `windows_resources` standalone test failing when the host is, for example, `riscv64-linux`.
2025-06-29 09:59:38 +02:00
Ryan Liptak 09f4e2d9d1 resinator: Fix include directory detection when cross-compiling from certain host archs
Previously, resinator would use the host arch as the target arch when looking for windows-gnu include directories. However, Zig only thinks it can provide a libc for targets specified in the `std.zig.target.available_libcs` array, which only includes a few for windows-gnu. Therefore, when cross-compiling from a host architecture that doesn't have a windows-gnu target in the available_libcs list, resinator would fail to detect the MinGW include directories.

Now, the custom option `/:target` is passed to `zig rc` which is intended for the COFF object file target, but can be re-used for the include directory target as well. For the include directory target, resinator will convert the MachineType to the relevant arch, or fail if there is no  equivalent arch/no support for detecting the includes for the MachineType (currently 64-bit Itanium and EBC).

Fixes the `windows_resources` standalone test failing when the host is, for example, `riscv64-linux`.
2025-06-28 19:52:18 -07:00
Ryan Liptak 761783f54d resinator: Only preprocess when the input is an .rc file 2025-06-28 19:43:22 -07:00
Bingwu Zhang ff06de4c89 riscv64: enable test summary printing 2025-06-28 06:47:09 +08:00
Bingwu Zhang 5db395f20b compiler: test runner: fix tests never fails on crippled architectures 2025-06-27 19:12:16 +08:00
Andrew Kelley 8eca338c27 fix zig libc FTBFS 2025-06-25 05:17:46 -07:00
Marc 75d6d4c3f2 add glibc versioning for a number of headers (#24237)
* getrandom was added in glibc 2.25
https://sourceware.org/bugzilla/show_bug.cgi?id=17252

* copy_file_range was added in glibc 2.27
https://sourceware.org/git/?p=glibc.git;a=commit;h=bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f

* threads.h should not exist for glibc < 2.28

* single_threaded.h should not exist for glibc < 2.35

* Apply suggestions from code review

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>

* 2.35 instead of 35

* before 2.35 instead of 2.34 and before

---------

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-06-24 16:14:00 +00:00
Dacheng 35329b510c c.darwin: define MSG for macos (#24224)
* c.darwin: define MSG for macos

* darwin: add series os name

* Update lib/std/c.zig

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>

---------

Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-06-24 15:07:06 +02:00
Alex Rønne Petersen 342c34d95e Merge pull request #24238 from taylordotfish/bugfix/ppc64le-syscall 2025-06-24 15:06:31 +02:00
Pat Tullmann 710632b45c lib/std/fs/test.zig: Some filesystems support 8 EiB files
Btrfs at least supports 16 EiB files (limited in practice to 8EiB by the
Linux VFS code which uses signed 64-bit offsets).  So fix the fs.zig test
case to expect either a FileTooBig or success from truncating a file to
8EiB.  And test that beyond that size the offset is interpreted as a
negative number.

Fixes #24242
2025-06-23 15:20:24 +02:00
Kevin Boulain 640a130651 std.Build.Watch: key fanotify file descriptors by mount id
Since marks are limited to a single filesystem.
Context: https://github.com/ziglang/zig/issues/20670
Original pull request: https://github.com/ziglang/zig/pull/20672

Co-authored-by: Maciej 'vesim' Kuliński <vesim809@pm.me>
2025-06-23 06:08:25 +02:00
Ali Cheraghi 1df79ab895 remove spirv cpu arch 2025-06-23 06:03:03 +02:00