tmp/tmp1c002mdx/{from.md → to.md}
RENAMED
|
@@ -3,31 +3,34 @@
|
|
| 3 |
The *attribute-token* `maybe_unused` indicates that a name or entity is
|
| 4 |
possibly intentionally unused. It shall appear at most once in each
|
| 5 |
*attribute-list* and no *attribute-argument-clause* shall be present.
|
| 6 |
|
| 7 |
The attribute may be applied to the declaration of a class, a
|
| 8 |
-
*typedef-name*, a variable
|
| 9 |
-
enumeration, or an enumerator.
|
| 10 |
-
|
| 11 |
-
[*Note 1*: For an entity marked `maybe_unused`, implementations are
|
| 12 |
-
encouraged not to emit a warning that the entity is unused, or that the
|
| 13 |
-
entity is used despite the presence of the attribute. — *end note*]
|
| 14 |
|
| 15 |
A name or entity declared without the `maybe_unused` attribute can later
|
| 16 |
be redeclared with the attribute and vice versa. An entity is considered
|
| 17 |
marked after the first declaration that marks it.
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
[*Example 1*:
|
| 20 |
|
| 21 |
``` cpp
|
| 22 |
[[maybe_unused]] void f([[maybe_unused]] bool thing1,
|
| 23 |
[[maybe_unused]] bool thing2) {
|
| 24 |
[[maybe_unused]] bool b = thing1 && thing2;
|
| 25 |
assert(b);
|
| 26 |
}
|
| 27 |
```
|
| 28 |
|
| 29 |
-
Implementations
|
| 30 |
-
|
| 31 |
|
| 32 |
— *end example*]
|
| 33 |
|
|
|
|
| 3 |
The *attribute-token* `maybe_unused` indicates that a name or entity is
|
| 4 |
possibly intentionally unused. It shall appear at most once in each
|
| 5 |
*attribute-list* and no *attribute-argument-clause* shall be present.
|
| 6 |
|
| 7 |
The attribute may be applied to the declaration of a class, a
|
| 8 |
+
*typedef-name*, a variable (including a structured binding declaration),
|
| 9 |
+
a non-static data member, a function, an enumeration, or an enumerator.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
A name or entity declared without the `maybe_unused` attribute can later
|
| 12 |
be redeclared with the attribute and vice versa. An entity is considered
|
| 13 |
marked after the first declaration that marks it.
|
| 14 |
|
| 15 |
+
*Recommended practice:* For an entity marked `maybe_unused`,
|
| 16 |
+
implementations should not emit a warning that the entity or its
|
| 17 |
+
structured bindings (if any) are used or unused. For a structured
|
| 18 |
+
binding declaration not marked `maybe_unused`, implementations should
|
| 19 |
+
not emit such a warning unless all of its structured bindings are
|
| 20 |
+
unused.
|
| 21 |
+
|
| 22 |
[*Example 1*:
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
[[maybe_unused]] void f([[maybe_unused]] bool thing1,
|
| 26 |
[[maybe_unused]] bool thing2) {
|
| 27 |
[[maybe_unused]] bool b = thing1 && thing2;
|
| 28 |
assert(b);
|
| 29 |
}
|
| 30 |
```
|
| 31 |
|
| 32 |
+
Implementations should not warn that `b` is unused, whether or not
|
| 33 |
+
`NDEBUG` is defined.
|
| 34 |
|
| 35 |
— *end example*]
|
| 36 |
|