mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
fix incorrect use of mutable pointers to temporary values
This commit is contained in:
parent
67afd2a470
commit
f0fdaf32d3
@ -108,7 +108,7 @@ pub fn syscall6(
|
||||
);
|
||||
}
|
||||
|
||||
pub fn socketcall(call: usize, args: [*]usize) usize {
|
||||
pub fn socketcall(call: usize, args: [*]const usize) usize {
|
||||
return asm volatile ("int $0x80"
|
||||
: [ret] "={eax}" (-> usize),
|
||||
: [number] "{eax}" (@enumToInt(SYS.socketcall)),
|
||||
|
||||
@ -6098,7 +6098,7 @@ pub const PeerTypeCandidateSrc = union(enum) {
|
||||
none: void,
|
||||
/// When we want to know the the src of candidate i, look up at
|
||||
/// index i in this slice
|
||||
override: []?LazySrcLoc,
|
||||
override: []const ?LazySrcLoc,
|
||||
/// resolvePeerTypes originates from a @TypeOf(...) call
|
||||
typeof_builtin_call_node_offset: i32,
|
||||
|
||||
|
||||
@ -116,7 +116,7 @@ pub fn addRelocation(macho_file: *MachO, atom_index: Index, reloc: Relocation) !
|
||||
return addRelocations(macho_file, atom_index, &[_]Relocation{reloc});
|
||||
}
|
||||
|
||||
pub fn addRelocations(macho_file: *MachO, atom_index: Index, relocs: []Relocation) !void {
|
||||
pub fn addRelocations(macho_file: *MachO, atom_index: Index, relocs: []const Relocation) !void {
|
||||
const gpa = macho_file.base.allocator;
|
||||
const gop = try macho_file.relocs.getOrPut(gpa, atom_index);
|
||||
if (!gop.found_existing) {
|
||||
|
||||
@ -667,7 +667,7 @@ test "array init of container level array variable" {
|
||||
test "runtime initialized sentinel-terminated array literal" {
|
||||
var c: u16 = 300;
|
||||
const f = &[_:0x9999]u16{c};
|
||||
const g = @ptrCast(*[4]u8, f);
|
||||
const g = @ptrCast(*const [4]u8, f);
|
||||
try std.testing.expect(g[2] == 0x99);
|
||||
try std.testing.expect(g[3] == 0x99);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user