Skip to content

Commit 5e671fd

Browse files
committed
P2552R3 On the ignorability of standard attributes
1 parent c0685a5 commit 5e671fd

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

source/declarations.tex

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8697,6 +8697,11 @@
86978697
deduce information used to optimize the program.
86988698
Implementations are not required to deduce
86998699
any information from any particular assumption.
8700+
It is expected that the value of
8701+
a \grammarterm{has-attribute-expression} for the \tcode{assume} attribute
8702+
is \tcode{0}
8703+
if an implementation does not attempt to deduce
8704+
any such information from assumptions.
87008705
\end{note}
87018706
\begin{example}
87028707
\begin{codeblock}
@@ -8845,6 +8850,10 @@
88458850
declaration that specifies the attribute. The diagnostic message should include the text provided
88468851
within the \grammarterm{attribute-argument-clause} of any \tcode{deprecated} attribute applied
88478852
to the name or entity.
8853+
The value of
8854+
a \grammarterm{has-attribute-expression} for the \tcode{deprecated} attribute
8855+
should be \tcode{0}
8856+
unless the implementation can issue such diagnostic messages.
88488857

88498858
\rSec2[dcl.attr.fallthrough]{Fallthrough attribute}
88508859
\indextext{attribute!fallthrough}
@@ -8871,6 +8880,10 @@
88718880
a warning that an implementation might otherwise issue
88728881
for a case or default label that is reachable
88738882
from another case or default label along some path of execution.
8883+
The value of
8884+
a \grammarterm{has-attribute-expression} for the \tcode{fallthrough} attribute
8885+
should be \tcode{0}
8886+
if the attribute does not cause suppression of such warnings.
88748887
Implementations should issue a warning
88758888
if a fallthrough statement is not dynamically reachable.
88768889

@@ -8920,7 +8933,7 @@
89208933
that contains the \grammarterm{attribute-token} \tcode{unlikely}.
89218934

89228935
\pnum
8923-
\recommended
8936+
\begin{note}
89248937
The use of the \tcode{likely} attribute
89258938
is intended to allow implementations to optimize for
89268939
the case where paths of execution including it
@@ -8933,8 +8946,14 @@
89338946
are arbitrarily more unlikely
89348947
than any alternative path of execution
89358948
that does not include such an attribute on a statement or label.
8949+
It is expected that the value of a \grammarterm{has-attribute-expression}
8950+
for the \tcode{likely} and \tcode{unlikely} attributes
8951+
is \tcode{0}
8952+
if the implementation does not attempt to use these attributes
8953+
for such optimizations.
89368954
A path of execution includes a label
89378955
if and only if it contains a jump to that label.
8956+
\end{note}
89388957
\begin{note}
89398958
Excessive usage of either of these attributes
89408959
is liable to result in performance degradation.
@@ -8995,6 +9014,10 @@
89959014
For a structured binding declaration not marked \tcode{maybe_unused},
89969015
implementations should not emit such a warning unless
89979016
all of its structured bindings are unused.
9017+
The value of
9018+
a \grammarterm{has-attribute-expression} for the \tcode{maybe_unused} attribute
9019+
should be \tcode{0}
9020+
if the attribute does not cause suppression of such warnings.
89989021

89999022
\pnum
90009023
\begin{example}
@@ -9063,6 +9086,9 @@
90639086
a potentially-evaluated discarded-value expression\iref{expr.prop}
90649087
is discouraged unless explicitly cast to \keyword{void}.
90659088
Implementations should issue a warning in such cases.
9089+
The value of
9090+
a \grammarterm{has-attribute-expression} for the \tcode{nodiscard} attribute
9091+
should be \tcode{0} unless the implementation can issue such warnings.
90669092
\begin{note}
90679093
This is typically because discarding the return value
90689094
of a nodiscard call has surprising consequences.
@@ -9125,6 +9151,9 @@
91259151
\recommended
91269152
Implementations should issue a
91279153
warning if a function marked \tcode{[[noreturn]]} might return.
9154+
The value of
9155+
a \grammarterm{has-attribute-expression} for the \tcode{noreturn} attribute
9156+
should be \tcode{0} unless the implementation can issue such warnings.
91289157

91299158
\pnum
91309159
\begin{example}
@@ -9159,6 +9188,14 @@
91599188
at the end of the object
91609189
can be reused as storage for other members.
91619190
\end{note}
9191+
9192+
\recommended
9193+
The value of a \grammarterm{has-attribute-expression}
9194+
for the \tcode{no_unique_address} attribute
9195+
should be \tcode{0} for a given implementation
9196+
unless this attribute can cause a potentially-overlapping subobject
9197+
to have zero size.
9198+
91629199
\begin{example}
91639200
\begin{codeblock}
91649201
template<typename Key, typename Value,

source/preprocessor.tex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,10 @@
375375

376376
\pnum
377377
For an attribute specified in this document,
378-
the value of the \grammarterm{has-attribute-expression}
379-
is given by \tref{cpp.cond.ha}.
378+
it is \impldef{value of \grammarterm{has-attribute-expression}
379+
for standard attributes}
380+
whether the value of the \grammarterm{has-attribute-expression}
381+
is \tcode{0} or is given by \tref{cpp.cond.ha}.
380382
For other attributes recognized by the implementation,
381383
the value is
382384
\impldef{value of \grammarterm{has-attribute-expression}

0 commit comments

Comments
 (0)