tmp/tmpgly6b3fj/{from.md → to.md}
RENAMED
|
@@ -1,18 +1,20 @@
|
|
| 1 |
### Attribute syntax and semantics <a id="dcl.attr.grammar">[[dcl.attr.grammar]]</a>
|
| 2 |
|
| 3 |
-
Attributes specify additional information for various
|
| 4 |
-
such as types, variables, names,
|
|
|
|
| 5 |
|
| 6 |
``` bnf
|
| 7 |
attribute-specifier-seq:
|
| 8 |
-
attribute-specifier-seqₒₚₜ
|
| 9 |
```
|
| 10 |
|
| 11 |
``` bnf
|
| 12 |
attribute-specifier:
|
| 13 |
'[' '[' attribute-using-prefixₒₚₜ attribute-list ']' ']'
|
|
|
|
| 14 |
alignment-specifier
|
| 15 |
```
|
| 16 |
|
| 17 |
``` bnf
|
| 18 |
alignment-specifier:
|
|
@@ -31,15 +33,26 @@ attribute-list:
|
|
| 31 |
attribute-list ',' attributeₒₚₜ
|
| 32 |
attribute '...'
|
| 33 |
attribute-list ',' attribute '...'
|
| 34 |
```
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
``` bnf
|
| 37 |
attribute:
|
| 38 |
attribute-token attribute-argument-clauseₒₚₜ
|
| 39 |
```
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
``` bnf
|
| 42 |
attribute-token:
|
| 43 |
identifier
|
| 44 |
attribute-scoped-token
|
| 45 |
```
|
|
@@ -59,20 +72,20 @@ attribute-argument-clause:
|
|
| 59 |
'(' balanced-token-seqₒₚₜ ')'
|
| 60 |
```
|
| 61 |
|
| 62 |
``` bnf
|
| 63 |
balanced-token-seq:
|
| 64 |
-
balanced-token
|
| 65 |
-
balanced-token-seq balanced-token
|
| 66 |
```
|
| 67 |
|
| 68 |
``` bnf
|
| 69 |
balanced-token:
|
| 70 |
'(' balanced-token-seqₒₚₜ ')'
|
| 71 |
'[' balanced-token-seqₒₚₜ ']'
|
| 72 |
'{' balanced-token-seqₒₚₜ '}'
|
| 73 |
-
|
|
|
|
| 74 |
```
|
| 75 |
|
| 76 |
If an *attribute-specifier* contains an *attribute-using-prefix*, the
|
| 77 |
*attribute-list* following that *attribute-using-prefix* shall not
|
| 78 |
contain an *attribute-scoped-token* and every *attribute-token* in that
|
|
@@ -101,30 +114,34 @@ contain an *attribute-scoped-token* and every *attribute-token* in that
|
|
| 101 |
*balanced-token-seq* will be specified. — *end note*]
|
| 102 |
|
| 103 |
In an *attribute-list*, an ellipsis may appear only if that
|
| 104 |
*attribute*’s specification permits it. An *attribute* followed by an
|
| 105 |
ellipsis is a pack expansion [[temp.variadic]]. An *attribute-specifier*
|
| 106 |
-
that contains no *attribute*s has no effect.
|
| 107 |
-
*attribute-token*s appear in an *attribute-list*
|
| 108 |
-
a keyword [[lex.key]] or an alternative token
|
| 109 |
-
satisfies the syntactic requirements of an
|
| 110 |
-
contained in an *attribute-token*, it is
|
| 111 |
-
name lookup [[basic.lookup]] is performed
|
| 112 |
-
contained in an *attribute-token*. The
|
| 113 |
-
additional requirements on the
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
Each *attribute-specifier-seq* is said to *appertain* to some entity or
|
| 116 |
statement, identified by the syntactic context where it appears
|
| 117 |
-
[[stmt
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
|
| 124 |
-
[*Note 3*: An *attribute-specifier-seq* cannot
|
| 125 |
-
|
| 126 |
|
| 127 |
For an *attribute-token* (including an *attribute-scoped-token*) not
|
| 128 |
specified in this document, the behavior is *implementation-defined*;
|
| 129 |
any such *attribute-token* that is not recognized by the implementation
|
| 130 |
is ignored.
|
|
|
|
| 1 |
### Attribute syntax and semantics <a id="dcl.attr.grammar">[[dcl.attr.grammar]]</a>
|
| 2 |
|
| 3 |
+
Attributes and annotations specify additional information for various
|
| 4 |
+
source constructs such as types, variables, names, contract assertions,
|
| 5 |
+
blocks, or translation units.
|
| 6 |
|
| 7 |
``` bnf
|
| 8 |
attribute-specifier-seq:
|
| 9 |
+
attribute-specifier attribute-specifier-seqₒₚₜ
|
| 10 |
```
|
| 11 |
|
| 12 |
``` bnf
|
| 13 |
attribute-specifier:
|
| 14 |
'[' '[' attribute-using-prefixₒₚₜ attribute-list ']' ']'
|
| 15 |
+
'[' '[' annotation-list ']' ']'
|
| 16 |
alignment-specifier
|
| 17 |
```
|
| 18 |
|
| 19 |
``` bnf
|
| 20 |
alignment-specifier:
|
|
|
|
| 33 |
attribute-list ',' attributeₒₚₜ
|
| 34 |
attribute '...'
|
| 35 |
attribute-list ',' attribute '...'
|
| 36 |
```
|
| 37 |
|
| 38 |
+
``` bnf
|
| 39 |
+
annotation-list:
|
| 40 |
+
annotation '...'ₒₚₜ
|
| 41 |
+
annotation-list ',' annotation '...'ₒₚₜ
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
``` bnf
|
| 45 |
attribute:
|
| 46 |
attribute-token attribute-argument-clauseₒₚₜ
|
| 47 |
```
|
| 48 |
|
| 49 |
+
``` bnf
|
| 50 |
+
annotation:
|
| 51 |
+
'=' constant-expression
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
``` bnf
|
| 55 |
attribute-token:
|
| 56 |
identifier
|
| 57 |
attribute-scoped-token
|
| 58 |
```
|
|
|
|
| 72 |
'(' balanced-token-seqₒₚₜ ')'
|
| 73 |
```
|
| 74 |
|
| 75 |
``` bnf
|
| 76 |
balanced-token-seq:
|
| 77 |
+
balanced-token balanced-token-seqₒₚₜ
|
|
|
|
| 78 |
```
|
| 79 |
|
| 80 |
``` bnf
|
| 81 |
balanced-token:
|
| 82 |
'(' balanced-token-seqₒₚₜ ')'
|
| 83 |
'[' balanced-token-seqₒₚₜ ']'
|
| 84 |
'{' balanced-token-seqₒₚₜ '}'
|
| 85 |
+
'[:' balanced-token-seqₒₚₜ ':]'
|
| 86 |
+
any *token* other than '(', ')', '[', ']', '{', '}', '[:', or ':]'
|
| 87 |
```
|
| 88 |
|
| 89 |
If an *attribute-specifier* contains an *attribute-using-prefix*, the
|
| 90 |
*attribute-list* following that *attribute-using-prefix* shall not
|
| 91 |
contain an *attribute-scoped-token* and every *attribute-token* in that
|
|
|
|
| 114 |
*balanced-token-seq* will be specified. — *end note*]
|
| 115 |
|
| 116 |
In an *attribute-list*, an ellipsis may appear only if that
|
| 117 |
*attribute*’s specification permits it. An *attribute* followed by an
|
| 118 |
ellipsis is a pack expansion [[temp.variadic]]. An *attribute-specifier*
|
| 119 |
+
that contains an *attribute-list* with no *attribute*s has no effect.
|
| 120 |
+
The order in which the *attribute-token*s appear in an *attribute-list*
|
| 121 |
+
is not significant. If a keyword [[lex.key]] or an alternative token
|
| 122 |
+
[[lex.digraph]] that satisfies the syntactic requirements of an
|
| 123 |
+
*identifier* [[lex.name]] is contained in an *attribute-token*, it is
|
| 124 |
+
considered an identifier. No name lookup [[basic.lookup]] is performed
|
| 125 |
+
on any of the identifiers contained in an *attribute-token*. The
|
| 126 |
+
*attribute-token* determines additional requirements on the
|
| 127 |
+
*attribute-argument-clause* (if any).
|
| 128 |
+
|
| 129 |
+
An *annotation* followed by an ellipsis is a pack expansion
|
| 130 |
+
[[temp.variadic]].
|
| 131 |
|
| 132 |
Each *attribute-specifier-seq* is said to *appertain* to some entity or
|
| 133 |
statement, identified by the syntactic context where it appears
|
| 134 |
+
[[stmt]], [[dcl]], [[dcl.decl]]. If an *attribute-specifier-seq* that
|
| 135 |
+
appertains to some entity or statement contains an *attribute* or
|
| 136 |
+
*alignment-specifier* that is not allowed to apply to that entity or
|
| 137 |
+
statement, the program is ill-formed. If an *attribute-specifier-seq*
|
| 138 |
+
appertains to a friend declaration [[class.friend]], that declaration
|
| 139 |
+
shall be a definition.
|
| 140 |
|
| 141 |
+
[*Note 3*: An *attribute-specifier-seq* cannot appertain to an explicit
|
| 142 |
+
instantiation [[temp.explicit]]. — *end note*]
|
| 143 |
|
| 144 |
For an *attribute-token* (including an *attribute-scoped-token*) not
|
| 145 |
specified in this document, the behavior is *implementation-defined*;
|
| 146 |
any such *attribute-token* that is not recognized by the implementation
|
| 147 |
is ignored.
|