The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/tools/cocci/c11_atomic_builtin_rewrite.cocci

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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
    3 
    4 @memory_order@
    5 identifier m =~ "(memory_order_(relaxed|consume|acquire|release|acq_rel|seq_cst)(|_smp)|__ATOMIC_(RELAXED|CONSUME|ACQUIRE|RELEASE|ACQ_REL|SEQ_CST))";
    6 @@
    7 
    8 m
    9 
   10 @script:ocaml os_memory_order@
   11 m << memory_order.m;
   12 new_m;
   13 @@
   14 
   15 new_m := make_ident (String.lowercase_ascii (Str.global_replace (Str.regexp "memory_order_\\|__ATOMIC_\\|_smp") "" m))
   16 
   17 @fence@
   18 identifier memory_order.m;
   19 identifier os_memory_order.new_m;
   20 @@
   21 
   22 - __c11_atomic_thread_fence(m)
   23 + os_atomic_thread_fence(new_m)
   24 
   25 @load@
   26 expression E;
   27 type T;
   28 identifier memory_order.m;
   29 identifier os_memory_order.new_m;
   30 @@
   31 
   32 - __c11_atomic_load
   33 + os_atomic_load
   34  (
   35 (
   36 -((T)E)
   37 +E
   38 |
   39 -(T)E
   40 +E
   41 |
   42 E
   43 )
   44  ,
   45 -m
   46 +new_m
   47  )
   48 
   49 @inc@
   50 expression E;
   51 type T;
   52 identifier memory_order.m;
   53 identifier os_memory_order.new_m;
   54 @@
   55 
   56 - __c11_atomic_fetch_add
   57 + os_atomic_inc_orig
   58  (
   59 (
   60 -((T)E)
   61 +E
   62 |
   63 -(T)E
   64 +E
   65 |
   66 E
   67 )
   68  ,
   69 -1, m
   70 +new_m
   71  )
   72 
   73 @dec@
   74 expression E;
   75 type T;
   76 identifier memory_order.m;
   77 identifier os_memory_order.new_m;
   78 @@
   79 
   80 - __c11_atomic_fetch_sub
   81 + os_atomic_dec_orig
   82  (
   83 (
   84 -((T)E)
   85 +E
   86 |
   87 -(T)E
   88 +E
   89 |
   90 E
   91 )
   92  ,
   93 -1, m
   94 +new_m
   95  )
   96 
   97 @single_arg@
   98 expression E, F;
   99 type T;
  100 identifier memory_order.m;
  101 identifier os_memory_order.new_m;
  102 @@
  103 
  104 (
  105 - __c11_atomic_store
  106 + os_atomic_store
  107 |
  108 - __c11_atomic_fetch_add
  109 + os_atomic_add_orig
  110 |
  111 - __c11_atomic_fetch_sub
  112 + os_atomic_sub_orig
  113 |
  114 - __c11_atomic_fetch_and
  115 + os_atomic_and_orig
  116 |
  117 - __c11_atomic_fetch_or
  118 + os_atomic_or_orig
  119 |
  120 - __c11_atomic_fetch_xor
  121 + os_atomic_xor_orig
  122 )
  123  (
  124 (
  125 -((T)E)
  126 +E
  127 |
  128 -(T)E
  129 +E
  130 |
  131 E
  132 )
  133  , F,
  134 -m
  135 +new_m
  136  )
  137 
  138 @cmpxcgh@
  139 expression E, F, G;
  140 type T;
  141 identifier memory_order.m;
  142 identifier os_memory_order.new_m;
  143 @@
  144 
  145 - __c11_atomic_compare_exchange_strong
  146 + os_atomic_cmpxchgv
  147  (
  148 (
  149 -((T)E)
  150 +E
  151 |
  152 -(T)E
  153 +E
  154 |
  155 E
  156 )
  157  ,
  158 - &F, G, m, memory_order_relaxed
  159 + F, G, &F, new_m
  160  )
  161 
  162 // vim:ft=diff:

Cache object: ab346543e14e7ab14792cbc90b9811b2


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.