1 // To apply, at the top of xnu.git:
2 // $ spatch --max-width=120 --use-gitgrep --in-place --include-headers --sp-file tools/cocci/c11_atomic_builtin_rewrite.cocci
5 identifier m =~ "(memory_order_(relaxed|consume|acquire|release|acq_rel|seq_cst)(|_smp)|__ATOMIC_(RELAXED|CONSUME|ACQUIRE|RELEASE|ACQ_REL|SEQ_CST))";
10 @script:ocaml os_memory_order@
15 new_m := make_ident (String.lowercase_ascii (Str.global_replace (Str.regexp "memory_order_\\|__ATOMIC_\\|_smp") "" m))
18 identifier memory_order.m;
19 identifier os_memory_order.new_m;
22 - __c11_atomic_thread_fence(m)
23 + os_atomic_thread_fence(new_m)
28 identifier memory_order.m;
29 identifier os_memory_order.new_m;
52 identifier memory_order.m;
53 identifier os_memory_order.new_m;
56 - __c11_atomic_fetch_add
76 identifier memory_order.m;
77 identifier os_memory_order.new_m;
80 - __c11_atomic_fetch_sub
100 identifier memory_order.m;
101 identifier os_memory_order.new_m;
108 - __c11_atomic_fetch_add
111 - __c11_atomic_fetch_sub
114 - __c11_atomic_fetch_and
117 - __c11_atomic_fetch_or
120 - __c11_atomic_fetch_xor
141 identifier memory_order.m;
142 identifier os_memory_order.new_m;
145 - __c11_atomic_compare_exchange_strong
158 - &F, G, m, memory_order_relaxed