Skip to content

Commit 43876c3

Browse files
jensmaurerzygoloid
authored andcommitted
[dcl.attr] Introduce 'Recommended practice' paragraphs.
1 parent 7918bc2 commit 43876c3

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

source/declarations.tex

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8766,13 +8766,12 @@
87668766
\grammarterm{attribute-argument-clause}{s}) are allowed.
87678767

87688768
\pnum
8769-
\begin{note}
8770-
Implementations may use the \tcode{deprecated} attribute to produce a diagnostic
8769+
\recommended
8770+
Implementations should use the \tcode{deprecated} attribute to produce a diagnostic
87718771
message in case the program refers to a name or entity other than to declare it, after a
8772-
declaration that specifies the attribute. The diagnostic message may include the text provided
8772+
declaration that specifies the attribute. The diagnostic message should include the text provided
87738773
within the \grammarterm{attribute-argument-clause} of any \tcode{deprecated} attribute applied
87748774
to the name or entity.
8775-
\end{note}
87768775

87778776
\rSec2[dcl.attr.fallthrough]{Fallthrough attribute}
87788777
\indextext{attribute!fallthrough}
@@ -8796,14 +8795,13 @@
87968795
The program is ill-formed if there is no such statement.
87978796

87988797
\pnum
8799-
\begin{note}
8800-
The use of a fallthrough statement is intended to suppress
8798+
\recommended
8799+
The use of a fallthrough statement should suppress
88018800
a warning that an implementation might otherwise issue
88028801
for a case or default label that is reachable
88038802
from another case or default label along some path of execution.
88048803
Implementations should issue a warning
88058804
if a fallthrough statement is not dynamically reachable.
8806-
\end{note}
88078805

88088806
\pnum
88098807
\begin{example}
@@ -8854,7 +8852,7 @@
88548852
that contains the \grammarterm{attribute-token} \tcode{unlikely}.
88558853

88568854
\pnum
8857-
\begin{note}
8855+
\recommended
88588856
The use of the \tcode{likely} attribute
88598857
is intended to allow implementations to optimize for
88608858
the case where paths of execution including it
@@ -8869,6 +8867,7 @@
88698867
that does not include such an attribute on a statement or label.
88708868
A path of execution includes a label
88718869
if and only if it contains a jump to that label.
8870+
\begin{note}
88728871
Excessive usage of either of these attributes
88738872
is liable to result in performance degradation.
88748873
\end{note}
@@ -8914,6 +8913,14 @@
89148913
a function, an enumeration, or an enumerator.
89158914

89168915
\pnum
8916+
A name or entity declared without the \tcode{maybe_unused} attribute
8917+
can later be redeclared with the attribute
8918+
and vice versa.
8919+
An entity is considered marked
8920+
after the first declaration that marks it.
8921+
8922+
\pnum
8923+
\recommended
89178924
For an entity marked \tcode{maybe_unused},
89188925
implementations should not emit a warning
89198926
that the entity or its structured bindings (if any)
@@ -8922,13 +8929,6 @@
89228929
implementations should not emit such a warning unless
89238930
all of its structured bindings are unused.
89248931

8925-
\pnum
8926-
A name or entity declared without the \tcode{maybe_unused} attribute
8927-
can later be redeclared with the attribute
8928-
and vice versa.
8929-
An entity is considered marked
8930-
after the first declaration that marks it.
8931-
89328932
\pnum
89338933
\begin{example}
89348934
\begin{codeblock}
@@ -8992,18 +8992,19 @@
89928992
\end{itemize}
89938993

89948994
\pnum
8995-
\begin{note}
8995+
\recommended
89968996
Appearance of a nodiscard call as
89978997
a potentially-evaluated discarded-value expression\iref{expr.prop}
89988998
is discouraged unless explicitly cast to \tcode{void}.
89998999
Implementations should issue a warning in such cases.
9000+
\begin{note}
90009001
This is typically because discarding the return value
90019002
of a nodiscard call has surprising consequences.
9003+
\end{note}
90029004
The \grammarterm{string-literal}
90039005
in a \tcode{nodiscard} \grammarterm{attribute-argument-clause}
9004-
is intended to be used in the message of the warning
9006+
should be used in the message of the warning
90059007
as the rationale for why the result should not be discarded.
9006-
\end{note}
90079008

90089009
\pnum
90099010
\begin{example}
@@ -9053,10 +9054,11 @@
90539054
The function may
90549055
terminate by throwing an exception.
90559056
\end{note}
9056-
\begin{note}
9057+
9058+
\pnum
9059+
\recommended
90579060
Implementations should issue a
90589061
warning if a function marked \tcode{[[noreturn]]} might return.
9059-
\end{note}
90609062

90619063
\pnum
90629064
\begin{example}

source/macros.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@
269269
%% Library function descriptions
270270
\newcommand{\Fundescx}[1]{\textit{#1}}
271271
\newcommand{\Fundesc}[1]{\Fundescx{#1:}\space}
272+
\newcommand{\recommended}{\Fundesc{Recommended practice}}
272273
\newcommand{\required}{\Fundesc{Required behavior}}
273274
\newcommand{\requires}{\Fundesc{Requires}}
274275
\newcommand{\constraints}{\Fundesc{Constraints}}

0 commit comments

Comments
 (0)