Date: Mon, 20 Sep 2021 18:15:00 +0300
On Mon, 20 Sept 2021 at 18:02, Aaron Ballman via SG21
<sg21_at_[hidden]> wrote:
> There are compilers for which the implementation strategy for all
> attributes is to note the [[ that opens an attribute specifier, eat
> all balanced tokens up to the closing ]], and diagnose the entire bit
> as "attribute ignored" (as a warning). You cannot do that with
> contracts because a correct program does not remain correct when the
> contract is ignored. A program can correctly rely on the contract
> violation handler executing, and that's not the case with this
> implementation strategy.
That's not a conforming strategy. A compiler needs to parse the
attribute grammar, and that grammar doesn't
allow arbitrary tokens as a balanced-token-sequence outside an
attribute-argument-clause, as specified
in 6.7.11.1 in the C working draft.
<sg21_at_[hidden]> wrote:
> There are compilers for which the implementation strategy for all
> attributes is to note the [[ that opens an attribute specifier, eat
> all balanced tokens up to the closing ]], and diagnose the entire bit
> as "attribute ignored" (as a warning). You cannot do that with
> contracts because a correct program does not remain correct when the
> contract is ignored. A program can correctly rely on the contract
> violation handler executing, and that's not the case with this
> implementation strategy.
That's not a conforming strategy. A compiler needs to parse the
attribute grammar, and that grammar doesn't
allow arbitrary tokens as a balanced-token-sequence outside an
attribute-argument-clause, as specified
in 6.7.11.1 in the C working draft.
Received on 2021-09-20 10:15:17