Enforce explicit context definition for procedure calls

This commit is contained in:
gingerBill
2020-05-14 13:44:28 +01:00
parent cd4403be0c
commit e0a242e9a1
9 changed files with 68 additions and 40 deletions
+13 -13
View File
@@ -10,7 +10,7 @@ Ordering :: enum {
Sequentially_Consistent,
}
strongest_failure_ordering :: inline proc "contextless" (order: Ordering) -> Ordering {
strongest_failure_ordering :: inline proc(order: Ordering) -> Ordering {
switch order {
case .Relaxed: return .Relaxed;
case .Release: return .Relaxed;
@@ -21,7 +21,7 @@ strongest_failure_ordering :: inline proc "contextless" (order: Ordering) -> Ord
return .Relaxed;
}
fence :: inline proc "contextless" ($order: Ordering) {
fence :: inline proc($order: Ordering) {
switch order {
case .Relaxed: panic("there is no such thing as a relaxed fence");
case .Release: intrinsics.atomic_fence_rel();
@@ -33,7 +33,7 @@ fence :: inline proc "contextless" ($order: Ordering) {
}
atomic_store :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) {
atomic_store :: inline proc(dst: ^$T, val: T, $order: Ordering) {
switch order {
case .Relaxed: intrinsics.atomic_store_relaxed(dst, val);
case .Release: intrinsics.atomic_store_rel(dst, val);
@@ -44,7 +44,7 @@ atomic_store :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) {
}
}
atomic_load :: inline proc "contextless" (dst: ^$T, $order: Ordering) -> T {
atomic_load :: inline proc(dst: ^$T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_load_relaxed(dst);
case .Acquire: return intrinsics.atomic_load_acq(dst);
@@ -56,7 +56,7 @@ atomic_load :: inline proc "contextless" (dst: ^$T, $order: Ordering) -> T {
return T{};
}
atomic_swap :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T {
atomic_swap :: inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_xchg_relaxed(dst, val);
case .Release: return intrinsics.atomic_xchg_rel(dst, val);
@@ -68,7 +68,7 @@ atomic_swap :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) ->
return T{};
}
atomic_compare_exchange :: inline proc "contextless" (dst: ^$T, old, new: T, $success, $failure: Ordering) -> (val: T, ok: bool) {
atomic_compare_exchange :: inline proc(dst: ^$T, old, new: T, $success, $failure: Ordering) -> (val: T, ok: bool) {
switch failure {
case .Relaxed:
switch success {
@@ -102,7 +102,7 @@ atomic_compare_exchange :: inline proc "contextless" (dst: ^$T, old, new: T, $su
}
atomic_compare_exchange_weak :: inline proc "contextless" (dst: ^$T, old, new: T, $success, $failure: Ordering) -> (val: T, ok: bool) {
atomic_compare_exchange_weak :: inline proc(dst: ^$T, old, new: T, $success, $failure: Ordering) -> (val: T, ok: bool) {
switch failure {
case .Relaxed:
switch success {
@@ -137,7 +137,7 @@ atomic_compare_exchange_weak :: inline proc "contextless" (dst: ^$T, old, new: T
}
atomic_add :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T {
atomic_add :: inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_add_relaxed(dst, val);
case .Release: return intrinsics.atomic_add_rel(dst, val);
@@ -149,7 +149,7 @@ atomic_add :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) ->
return T{};
}
atomic_sub :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T {
atomic_sub :: inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_sub_relaxed(dst, val);
case .Release: return intrinsics.atomic_sub_rel(dst, val);
@@ -161,7 +161,7 @@ atomic_sub :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) ->
return T{};
}
atomic_and :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T {
atomic_and :: inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_and_relaxed(dst, val);
case .Release: return intrinsics.atomic_and_rel(dst, val);
@@ -173,7 +173,7 @@ atomic_and :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) ->
return T{};
}
atomic_nand :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T {
atomic_nand :: inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_nand_relaxed(dst, val);
case .Release: return intrinsics.atomic_nand_rel(dst, val);
@@ -185,7 +185,7 @@ atomic_nand :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) ->
return T{};
}
atomic_or :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T {
atomic_or :: inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_or_relaxed(dst, val);
case .Release: return intrinsics.atomic_or_rel(dst, val);
@@ -197,7 +197,7 @@ atomic_or :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T
return T{};
}
atomic_xor :: inline proc "contextless" (dst: ^$T, val: T, $order: Ordering) -> T {
atomic_xor :: inline proc(dst: ^$T, val: T, $order: Ordering) -> T {
switch order {
case .Relaxed: return intrinsics.atomic_xor_relaxed(dst, val);
case .Release: return intrinsics.atomic_xor_rel(dst, val);