C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] Ignorability of attributes: draft wording, and concern about __has_c_attribute

From: Timur Doumler <cpp_at_[hidden]>
Date: Tue, 7 Feb 2023 11:11:15 -0800
(removing SG1 from this thread)

Robert, thanks for the clarification. I would be very curious how exactly WG14 defines this idea of "implements the semantics suggested in the specification of the attribute". Is this what the C23 working draft actually says now?

Aaron, would you be available this week? The EWG chair indicated yesterday that there might be time slots available for bringing this paper back to EWG this week.

Cheers,
Timur

> On 7 Feb 2023, at 11:07, Robert Seacord <rcseacord_at_[hidden]> wrote:
>
> response inline below
>
> On Tue, Feb 7, 2023 at 10:50 AM Timur Doumler <cpp_at_[hidden]> wrote:
>
> @SG22: Can you confirm this? What is the intent of __has_c_attribute in C: what Poll 1 says or what Poll 2 says?
>
> The intent in C is the same as Poll 1:
>
> __has_c_attribute should return a positive value for a standard attribute only if it implements the semantics suggested in the specification of the attribute.
>
> The C Standard contains the following example in Subclause 6.10.1 Conditional inclusion, paragraph 17:
>
> /* Fallback for compilers not yet implementing this feature. */
> #ifndef __has_c_attribute
> #define __has_c_attribute(x) 0
> #endif /* __has_c_attribute */
> #if __has_c_attribute(fallthrough)
> /* Standard attribute is available, use it. */
> #define FALLTHROUGH [[fallthrough]]
> #elif __has_c_attribute(vendor::fallthrough)
> /* Vendor attribute is available, use it. */
> #define FALLTHROUGH [[vendor::fallthrough]]
> #else
> /* Fallback implementation. */
> #define FALLTHROUGH
> #endif
>
> How should we resolve this contradiction? Should we re-discuss that aspect of the paper in EWG, with someone from SG22 present?
>
> Aaron Ballman would be the ideal person to represent the SG22 and WG14 positions, but if he is not available I would be willing to act as a poor substitute.
>
> rCs


Received on 2023-02-07 19:11:21