mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Compare commits
6 commits
fc74ffbe9d
...
2ee4bd1072
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ee4bd1072 | ||
|
|
ea94ac52c5 | ||
|
|
032e3c9254 | ||
|
|
adc5a39de2 | ||
|
|
58e3c2cefd | ||
|
|
c166bb36f6 |
9 changed files with 34 additions and 17 deletions
|
|
@ -152,7 +152,7 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Build and Test
|
- name: Build and Test
|
||||||
run: sh ci/x86_64-linux-debug.sh
|
run: sh ci/x86_64-linux-debug.sh
|
||||||
timeout-minutes: 240
|
timeout-minutes: 180
|
||||||
x86_64-linux-debug-llvm:
|
x86_64-linux-debug-llvm:
|
||||||
runs-on: [self-hosted, x86_64-linux]
|
runs-on: [self-hosted, x86_64-linux]
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -162,7 +162,7 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Build and Test
|
- name: Build and Test
|
||||||
run: sh ci/x86_64-linux-debug-llvm.sh
|
run: sh ci/x86_64-linux-debug-llvm.sh
|
||||||
timeout-minutes: 480
|
timeout-minutes: 360
|
||||||
x86_64-linux-release:
|
x86_64-linux-release:
|
||||||
runs-on: [self-hosted, x86_64-linux]
|
runs-on: [self-hosted, x86_64-linux]
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -172,7 +172,7 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Build and Test
|
- name: Build and Test
|
||||||
run: sh ci/x86_64-linux-release.sh
|
run: sh ci/x86_64-linux-release.sh
|
||||||
timeout-minutes: 480
|
timeout-minutes: 360
|
||||||
|
|
||||||
x86_64-windows-debug:
|
x86_64-windows-debug:
|
||||||
runs-on: [self-hosted, x86_64-windows]
|
runs-on: [self-hosted, x86_64-windows]
|
||||||
|
|
|
||||||
12
README.md
12
README.md
|
|
@ -485,16 +485,14 @@ interpret your words.
|
||||||
### Find a Contributor Friendly Issue
|
### Find a Contributor Friendly Issue
|
||||||
|
|
||||||
The issue label
|
The issue label
|
||||||
[Contributor Friendly](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3A%22contributor+friendly%22)
|
[Contributor Friendly](https://codeberg.org/ziglang/zig/issues?labels=741726&state=open)
|
||||||
exists to help you find issues that are **limited in scope and/or
|
exists to help you find issues that are **limited in scope and/or
|
||||||
knowledge of Zig internals.**
|
knowledge of Zig internals.**
|
||||||
|
|
||||||
Please note that issues labeled
|
Please note that issues labeled
|
||||||
[Proposal](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aproposal)
|
[Proposal: Proposed](https://codeberg.org/ziglang/zig/issues?labels=746937&state=open)
|
||||||
but do not also have the
|
are still under consideration, and efforts to implement such a proposal have
|
||||||
[Accepted](https://github.com/ziglang/zig/issues?q=is%3Aissue+is%3Aopen+label%3Aaccepted)
|
a high risk of being wasted. If you are interested in a proposal which is
|
||||||
label are still under consideration, and efforts to implement such a proposal
|
|
||||||
have a high risk of being wasted. If you are interested in a proposal which is
|
|
||||||
still under consideration, please express your interest in the issue tracker,
|
still under consideration, please express your interest in the issue tracker,
|
||||||
providing extra insights and considerations that others have not yet expressed.
|
providing extra insights and considerations that others have not yet expressed.
|
||||||
The most highly regarded argument in such a discussion is a real world use case.
|
The most highly regarded argument in such a discussion is a real world use case.
|
||||||
|
|
@ -777,7 +775,7 @@ If you will be debugging the Zig compiler itself, or if you will be debugging
|
||||||
any project compiled with Zig's LLVM backend (not recommended with the LLDB
|
any project compiled with Zig's LLVM backend (not recommended with the LLDB
|
||||||
fork, prefer vanilla LLDB with a version that matches the version of LLVM that
|
fork, prefer vanilla LLDB with a version that matches the version of LLVM that
|
||||||
Zig is using), you can get a better debugging experience by using
|
Zig is using), you can get a better debugging experience by using
|
||||||
[`lldb_pretty_printers.py`](https://github.com/ziglang/zig/blob/master/tools/lldb_pretty_printers.py).
|
[`lldb_pretty_printers.py`](https://codeberg.org/ziglang/zig/src/branch/master/tools/lldb_pretty_printers.py).
|
||||||
|
|
||||||
Put this line in `~/.lldbinit`:
|
Put this line in `~/.lldbinit`:
|
||||||
|
|
||||||
|
|
|
||||||
2
lib/libc/glibc/README.md
vendored
2
lib/libc/glibc/README.md
vendored
|
|
@ -39,7 +39,7 @@ v2.2.5.
|
||||||
|
|
||||||
The file `lib/libc/glibc/abilist` is a Zig-specific binary blob that
|
The file `lib/libc/glibc/abilist` is a Zig-specific binary blob that
|
||||||
defines the supported glibc versions and the set of symbols each version
|
defines the supported glibc versions and the set of symbols each version
|
||||||
must define. See https://github.com/ziglang/glibc-abi-tool for the
|
must define. See https://codeberg.org/ziglang/libc-abi-tools for the
|
||||||
tooling to generate this blob. The code in `glibc.zig` parses the abilist
|
tooling to generate this blob. The code in `glibc.zig` parses the abilist
|
||||||
to build version-specific stub libraries on demand.
|
to build version-specific stub libraries on demand.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ enable_rosetta: bool = false,
|
||||||
enable_wasmtime: bool = false,
|
enable_wasmtime: bool = false,
|
||||||
/// Use system Wine installation to run cross compiled Windows build artifacts.
|
/// Use system Wine installation to run cross compiled Windows build artifacts.
|
||||||
enable_wine: bool = false,
|
enable_wine: bool = false,
|
||||||
/// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
|
/// After following the steps in https://codeberg.org/ziglang/infra/src/branch/master/libc-update/glibc.md,
|
||||||
/// this will be the directory $glibc-build-dir/install/glibcs
|
/// this will be the directory $glibc-build-dir/install/glibcs
|
||||||
/// Given the example of the aarch64 target, this is the directory
|
/// Given the example of the aarch64 target, this is the directory
|
||||||
/// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`.
|
/// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`.
|
||||||
|
|
|
||||||
|
|
@ -890,7 +890,7 @@ pub const Timestamp = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn withClock(t: Timestamp, clock: Clock) Clock.Timestamp {
|
pub fn withClock(t: Timestamp, clock: Clock) Clock.Timestamp {
|
||||||
return .{ .nanoseconds = t.nanoseconds, .clock = clock };
|
return .{ .raw = t, .clock = clock };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fromNanoseconds(x: i96) Timestamp {
|
pub fn fromNanoseconds(x: i96) Timestamp {
|
||||||
|
|
|
||||||
|
|
@ -1090,7 +1090,8 @@ pub const Socket = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sendMany(s: *const Socket, io: Io, messages: []OutgoingMessage, flags: SendFlags) SendError!void {
|
pub fn sendMany(s: *const Socket, io: Io, messages: []OutgoingMessage, flags: SendFlags) SendError!void {
|
||||||
return io.vtable.netSend(io.userdata, s.handle, messages, flags);
|
const err, const n = io.vtable.netSend(io.userdata, s.handle, messages, flags);
|
||||||
|
if (n != messages.len) return err.?;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const ReceiveError = error{
|
pub const ReceiveError = error{
|
||||||
|
|
|
||||||
|
|
@ -1604,6 +1604,13 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
|
||||||
|
|
||||||
test "manage resources correctly" {
|
test "manage resources correctly" {
|
||||||
if (SelfInfo == void) return error.SkipZigTest;
|
if (SelfInfo == void) return error.SkipZigTest;
|
||||||
|
if (builtin.zig_backend == .stage2_c) {
|
||||||
|
// The C backend emits an extremely large C source file, meaning it has a huge
|
||||||
|
// amount of debug information. Parsing this debug information makes this test
|
||||||
|
// take too long to be worth running.
|
||||||
|
return error.SkipZigTest;
|
||||||
|
}
|
||||||
|
|
||||||
const S = struct {
|
const S = struct {
|
||||||
noinline fn showMyTrace() usize {
|
noinline fn showMyTrace() usize {
|
||||||
return @returnAddress();
|
return @returnAddress();
|
||||||
|
|
|
||||||
|
|
@ -913,8 +913,9 @@ fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
|
||||||
.pointer => |ptr_info| {
|
.pointer => |ptr_info| {
|
||||||
const Elem = std.meta.Elem(T);
|
const Elem = std.meta.Elem(T);
|
||||||
const have_sentinel: bool = switch (ptr_info.size) {
|
const have_sentinel: bool = switch (ptr_info.size) {
|
||||||
.one, .slice, .many => if (std.meta.sentinel(T)) |s| s == end else false,
|
.one, .slice => if (std.meta.sentinel(T)) |s| s == end else false,
|
||||||
.c => false,
|
.many => if (std.meta.sentinel(T)) |s| s == end else true,
|
||||||
|
.c => true,
|
||||||
};
|
};
|
||||||
return @Pointer(.slice, .{
|
return @Pointer(.slice, .{
|
||||||
.@"const" = ptr_info.is_const,
|
.@"const" = ptr_info.is_const,
|
||||||
|
|
@ -961,8 +962,15 @@ test sliceTo {
|
||||||
try testing.expectEqualSlices(u16, array[0..2], sliceTo(&array, 3));
|
try testing.expectEqualSlices(u16, array[0..2], sliceTo(&array, 3));
|
||||||
try testing.expectEqualSlices(u16, array[0..2], sliceTo(array[0..3], 3));
|
try testing.expectEqualSlices(u16, array[0..2], sliceTo(array[0..3], 3));
|
||||||
|
|
||||||
|
const many_ptr: [*]u16 = &array;
|
||||||
|
try testing.expectEqualSlices(u16, array[0..2], sliceTo(many_ptr, 3));
|
||||||
|
try testing.expectEqual([:3]u16, @TypeOf(sliceTo(many_ptr, 3)));
|
||||||
|
|
||||||
const sentinel_ptr = @as([*:5]u16, @ptrCast(&array));
|
const sentinel_ptr = @as([*:5]u16, @ptrCast(&array));
|
||||||
try testing.expectEqualSlices(u16, array[0..2], sliceTo(sentinel_ptr, 3));
|
try testing.expectEqualSlices(u16, array[0..2], sliceTo(sentinel_ptr, 3));
|
||||||
|
try testing.expectEqual([]u16, @TypeOf(sliceTo(sentinel_ptr, 3)));
|
||||||
|
try testing.expectEqualSlices(u16, array[0..4], sliceTo(sentinel_ptr, 5));
|
||||||
|
try testing.expectEqual([:5]u16, @TypeOf(sliceTo(sentinel_ptr, 5)));
|
||||||
try testing.expectEqualSlices(u16, array[0..4], sliceTo(sentinel_ptr, 99));
|
try testing.expectEqualSlices(u16, array[0..4], sliceTo(sentinel_ptr, 99));
|
||||||
|
|
||||||
const optional_sentinel_ptr = @as(?[*:5]u16, @ptrCast(&array));
|
const optional_sentinel_ptr = @as(?[*:5]u16, @ptrCast(&array));
|
||||||
|
|
@ -971,6 +979,7 @@ test sliceTo {
|
||||||
|
|
||||||
const c_ptr = @as([*c]u16, &array);
|
const c_ptr = @as([*c]u16, &array);
|
||||||
try testing.expectEqualSlices(u16, array[0..2], sliceTo(c_ptr, 3));
|
try testing.expectEqualSlices(u16, array[0..2], sliceTo(c_ptr, 3));
|
||||||
|
try testing.expectEqual([:3]u16, @TypeOf(sliceTo(c_ptr, 3)));
|
||||||
|
|
||||||
const slice: []u16 = &array;
|
const slice: []u16 = &array;
|
||||||
try testing.expectEqualSlices(u16, array[0..2], sliceTo(slice, 3));
|
try testing.expectEqualSlices(u16, array[0..2], sliceTo(slice, 3));
|
||||||
|
|
@ -1015,6 +1024,8 @@ fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize {
|
||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while (ptr[i] != end and ptr[i] != s) i += 1;
|
while (ptr[i] != end and ptr[i] != s) i += 1;
|
||||||
return i;
|
return i;
|
||||||
|
} else {
|
||||||
|
return indexOfSentinel(ptr_info.child, end, @ptrCast(ptr));
|
||||||
},
|
},
|
||||||
.c => {
|
.c => {
|
||||||
assert(ptr != null);
|
assert(ptr != null);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! This script updates the .c, .h, .s, and .S files that make up the start
|
//! This script updates the .c, .h, .s, and .S files that make up the start
|
||||||
//! files such as crt1.o. Not to be confused with
|
//! files such as crt1.o. Not to be confused with
|
||||||
//! https://github.com/ziglang/glibc-abi-tool/ which updates the `abilists`
|
//! https://codeberg.org/ziglang/libc-abi-tools which updates the `abilists`
|
||||||
//! file.
|
//! file.
|
||||||
//!
|
//!
|
||||||
//! Example usage:
|
//! Example usage:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue