Skip to content

Commit 99dccef

Browse files
jensmaurertkoeppe
authored andcommitted
P2552R3 On the ignorability of standard attributes
1 parent baea8ec commit 99dccef

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
@@ -8746,6 +8746,11 @@
87468746
deduce information used to optimize the program.
87478747
Implementations are not required to deduce
87488748
any information from any particular assumption.
8749+
It is expected that the value of
8750+
a \grammarterm{has-attribute-expression} for the \tcode{assume} attribute
8751+
is \tcode{0}
8752+
if an implementation does not attempt to deduce
8753+
any such information from assumptions.
87498754
\end{note}
87508755
\begin{example}
87518756
\begin{codeblock}
@@ -8894,6 +8899,10 @@
88948899
declaration that specifies the attribute. The diagnostic message should include the text provided
88958900
within the \grammarterm{attribute-argument-clause} of any \tcode{deprecated} attribute applied
88968901
to the name or entity.
8902+
The value of
8903+
a \grammarterm{has-attribute-expression} for the \tcode{deprecated} attribute
8904+
should be \tcode{0}
8905+
unless the implementation can issue such diagnostic messages.
88978906

88988907
\rSec2[dcl.attr.fallthrough]{Fallthrough attribute}
88998908
\indextext{attribute!fallthrough}
@@ -8920,6 +8929,10 @@
89208929
a warning that an implementation might otherwise issue
89218930
for a case or default label that is reachable
89228931
from another case or default label along some path of execution.
8932+
The value of
8933+
a \grammarterm{has-attribute-expression} for the \tcode{fallthrough} attribute
8934+
should be \tcode{0}
8935+
if the attribute does not cause suppression of such warnings.
89238936
Implementations should issue a warning
89248937
if a fallthrough statement is not dynamically reachable.
89258938

@@ -8969,7 +8982,7 @@
89698982
that contains the \grammarterm{attribute-token} \tcode{unlikely}.
89708983

89718984
\pnum
8972-
\recommended
8985+
\begin{note}
89738986
The use of the \tcode{likely} attribute
89748987
is intended to allow implementations to optimize for
89758988
the case where paths of execution including it
@@ -8982,8 +8995,14 @@
89828995
are arbitrarily more unlikely
89838996
than any alternative path of execution
89848997
that does not include such an attribute on a statement or label.
8998+
It is expected that the value of a \grammarterm{has-attribute-expression}
8999+
for the \tcode{likely} and \tcode{unlikely} attributes
9000+
is \tcode{0}
9001+
if the implementation does not attempt to use these attributes
9002+
for such optimizations.
89859003
A path of execution includes a label
89869004
if and only if it contains a jump to that label.
9005+
\end{note}
89879006
\begin{note}
89889007
Excessive usage of either of these attributes
89899008
is liable to result in performance degradation.
@@ -9044,6 +9063,10 @@
90449063
For a structured binding declaration not marked \tcode{maybe_unused},
90459064
implementations should not emit such a warning unless
90469065
all of its structured bindings are unused.
9066+
The value of
9067+
a \grammarterm{has-attribute-expression} for the \tcode{maybe_unused} attribute
9068+
should be \tcode{0}
9069+
if the attribute does not cause suppression of such warnings.
90479070

90489071
\pnum
90499072
\begin{example}
@@ -9112,6 +9135,9 @@
91129135
a potentially-evaluated discarded-value expression\iref{expr.prop}
91139136
is discouraged unless explicitly cast to \keyword{void}.
91149137
Implementations should issue a warning in such cases.
9138+
The value of
9139+
a \grammarterm{has-attribute-expression} for the \tcode{nodiscard} attribute
9140+
should be \tcode{0} unless the implementation can issue such warnings.
91159141
\begin{note}
91169142
This is typically because discarding the return value
91179143
of a nodiscard call has surprising consequences.
@@ -9174,6 +9200,9 @@
91749200
\recommended
91759201
Implementations should issue a
91769202
warning if a function marked \tcode{[[noreturn]]} might return.
9203+
The value of
9204+
a \grammarterm{has-attribute-expression} for the \tcode{noreturn} attribute
9205+
should be \tcode{0} unless the implementation can issue such warnings.
91779206

91789207
\pnum
91799208
\begin{example}
@@ -9208,6 +9237,14 @@
92089237
at the end of the object
92099238
can be reused as storage for other members.
92109239
\end{note}
9240+
9241+
\recommended
9242+
The value of a \grammarterm{has-attribute-expression}
9243+
for the \tcode{no_unique_address} attribute
9244+
should be \tcode{0} for a given implementation
9245+
unless this attribute can cause a potentially-overlapping subobject
9246+
to have zero size.
9247+
92119248
\begin{example}
92129249
\begin{codeblock}
92139250
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)