From Jason Turner

[dcl.attr.depend]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpbmxk5kdb/{from.md → to.md} +11 -13
tmp/tmpbmxk5kdb/{from.md → to.md} RENAMED
@@ -4,15 +4,15 @@ The *attribute-token* `carries_dependency` specifies dependency
4
  propagation into and out of functions. It shall appear at most once in
5
  each *attribute-list* and no *attribute-argument-clause* shall be
6
  present. The attribute may be applied to the *declarator-id* of a
7
  *parameter-declaration* in a function declaration or lambda, in which
8
  case it specifies that the initialization of the parameter carries a
9
- dependency to ([[intro.multithread]]) each lvalue-to-rvalue
10
- conversion ([[conv.lval]]) of that object. The attribute may also be
11
- applied to the *declarator-id* of a function declaration, in which case
12
- it specifies that the return value, if any, carries a dependency to the
13
- evaluation of the function call expression.
14
 
15
  The first declaration of a function shall specify the
16
  `carries_dependency` attribute for its *declarator-id* if any
17
  declaration of the function specifies the `carries_dependency`
18
  attribute. Furthermore, the first declaration of a function shall
@@ -37,11 +37,11 @@ code. — *end note*]
37
  struct foo { int* a; int* b; };
38
  std::atomic<struct foo *> foo_head[10];
39
  int foo_array[10][10];
40
 
41
  [[carries_dependency]] struct foo* f(int i) {
42
- return foo_head[i].load(memory_order_consume);
43
  }
44
 
45
  int g(int* x, int* y [[carries_dependency]]) {
46
  return kill_dependency(foo_array[*x][*y]);
47
  }
@@ -64,15 +64,13 @@ void h(int i) {
64
 
65
  The `carries_dependency` attribute on function `f` means that the return
66
  value carries a dependency out of `f`, so that the implementation need
67
  not constrain ordering upon return from `f`. Implementations of `f` and
68
  its caller may choose to preserve dependencies instead of emitting
69
- hardware memory ordering instructions (a.k.a. fences).
70
-
71
- Function `g`’s second parameter has a `carries_dependency` attribute,
72
- but its first parameter does not. Therefore, function `h`’s first call
73
- to `g` carries a dependency into `g`, but its second call does not. The
74
- implementation might need to insert a fence prior to the second call to
75
- `g`.
76
 
77
  — *end example*]
78
 
 
4
  propagation into and out of functions. It shall appear at most once in
5
  each *attribute-list* and no *attribute-argument-clause* shall be
6
  present. The attribute may be applied to the *declarator-id* of a
7
  *parameter-declaration* in a function declaration or lambda, in which
8
  case it specifies that the initialization of the parameter carries a
9
+ dependency to [[intro.multithread]] each lvalue-to-rvalue conversion
10
+ [[conv.lval]] of that object. The attribute may also be applied to the
11
+ *declarator-id* of a function declaration, in which case it specifies
12
+ that the return value, if any, carries a dependency to the evaluation of
13
+ the function call expression.
14
 
15
  The first declaration of a function shall specify the
16
  `carries_dependency` attribute for its *declarator-id* if any
17
  declaration of the function specifies the `carries_dependency`
18
  attribute. Furthermore, the first declaration of a function shall
 
37
  struct foo { int* a; int* b; };
38
  std::atomic<struct foo *> foo_head[10];
39
  int foo_array[10][10];
40
 
41
  [[carries_dependency]] struct foo* f(int i) {
42
+ return foo_head[i].load(memory_order::consume);
43
  }
44
 
45
  int g(int* x, int* y [[carries_dependency]]) {
46
  return kill_dependency(foo_array[*x][*y]);
47
  }
 
64
 
65
  The `carries_dependency` attribute on function `f` means that the return
66
  value carries a dependency out of `f`, so that the implementation need
67
  not constrain ordering upon return from `f`. Implementations of `f` and
68
  its caller may choose to preserve dependencies instead of emitting
69
+ hardware memory ordering instructions (a.k.a. fences). Function `g`’s
70
+ second parameter has a `carries_dependency` attribute, but its first
71
+ parameter does not. Therefore, function `h`’s first call to `g` carries
72
+ a dependency into `g`, but its second call does not. The implementation
73
+ might need to insert a fence prior to the second call to `g`.
 
 
74
 
75
  — *end example*]
76