Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen

Conflicts:
 * build.zig
 * lib/std/array_list.zig
 * lib/std/c/ast.zig
 * lib/std/c/parse.zig
 * lib/std/os/bits/linux.zig
This commit is contained in:
Andrew Kelley
2021-05-05 10:48:22 -07:00
54 changed files with 7621 additions and 2952 deletions

View File

@@ -387,7 +387,7 @@ pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) us
}
pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize {
if (@hasField(SYS, "pread64")) {
if (@hasField(SYS, "pread64") and usize_bits < 64) {
const offset_halves = splitValue64(offset);
if (require_aligned_register_pair) {
return syscall6(
@@ -410,8 +410,10 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize {
);
}
} else {
// Some architectures (eg. 64bit SPARC) pread is called pread64.
const S = if (!@hasField(SYS, "pread") and @hasField(SYS, "pread64")) .pread64 else .pread;
return syscall4(
.pread,
S,
@bitCast(usize, @as(isize, fd)),
@ptrToInt(buf),
count,
@@ -451,7 +453,7 @@ pub fn write(fd: i32, buf: [*]const u8, count: usize) usize {
}
pub fn ftruncate(fd: i32, length: u64) usize {
if (@hasField(SYS, "ftruncate64")) {
if (@hasField(SYS, "ftruncate64") and usize_bits < 64) {
const length_halves = splitValue64(length);
if (require_aligned_register_pair) {
return syscall4(
@@ -479,7 +481,7 @@ pub fn ftruncate(fd: i32, length: u64) usize {
}
pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize {
if (@hasField(SYS, "pwrite64")) {
if (@hasField(SYS, "pwrite64") and usize_bits < 64) {
const offset_halves = splitValue64(offset);
if (require_aligned_register_pair) {
@@ -503,8 +505,10 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize {
);
}
} else {
// Some architectures (eg. 64bit SPARC) pwrite is called pwrite64.
const S = if (!@hasField(SYS, "pwrite") and @hasField(SYS, "pwrite64")) .pwrite64 else .pwrite;
return syscall4(
.pwrite,
S,
@bitCast(usize, @as(isize, fd)),
@ptrToInt(buf),
count,