Skip to content

Commit

Permalink
std.builtin: make atomic order fields lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
RossComputerGuy committed Mar 11, 2024
1 parent 455b58e commit 9e21a8d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export fn entry() void {
var x: u32 = 0;
@atomicStore(u32, &x, 1, .Acquire);
@atomicStore(u32, &x, 1, .acquire);
}

// error
// backend=stage2
// target=native
//
// :3:31: error: @atomicStore atomic ordering must not be Acquire or AcqRel
// :3:31: error: @atomicStore atomic ordering must not be acquire or acq_rel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const AtomicOrder = @import("std").builtin.AtomicOrder;
export fn f() void {
var x: i32 = 1234;
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Monotonic, AtomicOrder.SeqCst)) {}
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.monotonic, AtomicOrder.seq_cst)) {}
}

// error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const AtomicOrder = @import("std").builtin.AtomicOrder;
export fn f() void {
var x: i32 = 1234;
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.Unordered, AtomicOrder.Unordered)) {}
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.unordered, AtomicOrder.unordered)) {}
}

// error
// backend=stage2
// target=native
//
// :4:58: error: success atomic ordering must be Monotonic or stricter
// :4:58: error: success atomic ordering must be monotonic or stricter
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export fn entry() void {
@fence(.Monotonic);
@fence(.monotonic);
}

// error
// backend=stage2
// target=native
//
// :2:13: error: atomic ordering must be Acquire or stricter
// :2:13: error: atomic ordering must be acquire or stricter
2 changes: 1 addition & 1 deletion compile_errors/atomicrmw_with_bool_op_not_.Xchg.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export fn entry() void {
var x = false;
_ = @atomicRmw(bool, &x, .Add, true, .SeqCst);
_ = @atomicRmw(bool, &x, .Add, true, .seq_cst);
}

// error
Expand Down
2 changes: 1 addition & 1 deletion compile_errors/atomicrmw_with_enum_op_not_.Xchg.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export fn entry() void {
d,
};
var x: E = .a;
_ = @atomicRmw(E, &x, .Add, .b, .SeqCst);
_ = @atomicRmw(E, &x, .Add, .b, .seq_cst);
}

// error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export fn entry() void {
var x: f32 = 0;
_ = @atomicRmw(f32, &x, .And, 2, .SeqCst);
_ = @atomicRmw(f32, &x, .And, 2, .seq_cst);
}

// error
Expand Down
2 changes: 1 addition & 1 deletion compile_errors/cmpxchg_with_float.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export fn entry() void {
var x: f32 = 0;
_ = @cmpxchgWeak(f32, &x, 1, 2, .SeqCst, .SeqCst);
_ = @cmpxchgWeak(f32, &x, 1, 2, .seq_cst, .seq_cst);
}

// error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const AtomicOrder = @import("std").builtin.AtomicOrder;
export fn entry() bool {
var x: i32 align(1) = 1234;
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) {}
while (!@cmpxchgWeak(i32, &x, 1234, 5678, AtomicOrder.seq_cst, AtomicOrder.seq_cst)) {}
return x == 5678;
}

Expand Down

0 comments on commit 9e21a8d

Please sign in to comment.