From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 54E573858D28 for ; Mon, 17 Jul 2023 13:40:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 54E573858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689601203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=o1LKLtivpqYWoaI+c+WbLkaGch3aL6kO2tmbGfDdLJo=; b=afJK5BKAIeVaDOJ1qO9GbkcYeEig/YSmb+hh0P2kBODHlw9ykRnDGpCKyYRT4eROKi4jYk rCkMEvlEdT/gNImzqHdUIWLIu9W7BLH34z0mPMRHxO2u303dAWEo/0tLIh4Qm1EZF5KjLc DD8tfeBUMOsA8nTii6P/7UHGfRL2bCo= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-578-PaeQRBi8N-WhRn2VqTD2ug-1; Mon, 17 Jul 2023 09:40:01 -0400 X-MC-Unique: PaeQRBi8N-WhRn2VqTD2ug-1 Received: by mail-io1-f71.google.com with SMTP id ca18e2360f4ac-77b25d256aaso273591939f.0 for ; Mon, 17 Jul 2023 06:40:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689601200; x=1692193200; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=o1LKLtivpqYWoaI+c+WbLkaGch3aL6kO2tmbGfDdLJo=; b=Wi9iYELnpliCDwsVhyvmH4LfSwn2SCW0bQmgQt5QK3qbszl92kTHvbFyjwaxavdd5z LDJkxmfZzPqWqUd/iv937M1wnI5SN/nT2UHqJL06BoUQJI8714HgNrT9t/cKtuDSdkOo OQ9jygATDk2c4Z2M7eAGfOT9THuuezxupvA83ZoTQtd7nfy5DuRZ7udsG6ZpviCHWFaa XYdyH+7tILa1vnVMwDNlbLBAC/piSlrpdRh7ttjoSsWfqf3OvuA1Yf8/PCyn8qBbBI2Z Dd+0AWd7VIG52mZ0zw0I2h0suZSj8l2MdPy2+WAQ+hObsy3dFusB0dRT6eEbt63SEUqH 6PTw== X-Gm-Message-State: ABy/qLaxLU3Y3DrJnFv3MEk4qs9ZXvz1RFtkIkiww2fpeTKyC5zP4m6O nrHuNXcI8y/CosdB2ZtkcotDb5Ij+yFhRg7fN4bj2mYTHg4HRgnHUOg/j1KLXCbctFwFaApAZOe 5kuUdQ689A6y00lJYUp6G5wuYCZUqwWCvwA== X-Received: by 2002:a6b:f21a:0:b0:77a:e86a:c24b with SMTP id q26-20020a6bf21a000000b0077ae86ac24bmr11954421ioh.6.1689601200386; Mon, 17 Jul 2023 06:40:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4ZODcAuaQ2DG0EIFhNb7NA7HrhPcEWjVWzFEwsXb/tn1fXbc6kDjcCiGb96ug+nmMnbJMDZR1AE9KgJN2JFc= X-Received: by 2002:a6b:f21a:0:b0:77a:e86a:c24b with SMTP id q26-20020a6bf21a000000b0077ae86ac24bmr11954406ioh.6.1689601200192; Mon, 17 Jul 2023 06:40:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jason Merrill Date: Mon, 17 Jul 2023 09:39:49 -0400 Message-ID: Subject: Re: [WIP RFC] Add support for keyword-based attributes To: Jakub Jelinek , gcc-patches@gcc.gnu.org, joseph@codesourcery.com, polacek@redhat.com, jason@redhat.com, nathan@acm.org, richard.sandiford@arm.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000005996350600aeef74" X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000005996350600aeef74 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Jul 16, 2023 at 6:50=E2=80=AFAM Richard Sandiford wrote: > Jakub Jelinek writes: > > On Fri, Jul 14, 2023 at 04:56:18PM +0100, Richard Sandiford via > Gcc-patches wrote: > >> Summary: We'd like to be able to specify some attributes using > >> keywords, rather than the traditional __attribute__ or [[...]] > >> syntax. Would that be OK? > > > > Will defer to C/C++ maintainers, but as you mentioned, there are many > > attributes which really can't be ignored and change behavior > significantly. > > vector_size is one of those, mode attribute another, > > no_unique_address another one (changes ABI in various cases), > > the OpenMP attributes (omp::directive, omp::sequence) can change > > behavior if -fopenmp, etc. > > One can easily error with > > #ifdef __has_cpp_attribute > > #if !__has_cpp_attribute (arm::whatever) > > #error arm::whatever attribute unsupported > > #endif > > #else > > #error __has_cpp_attribute unsupported > > #endif > > Yeah. It's easy to detect whether a particular ACLE feature is supported, > since there are predefined macros for each one. But IMO it's a failing > if we have to recommend that any compilation that uses arm::foo should > also have: > > #ifndef __ARM_FEATURE_FOO > #error arm::foo not supported > #endif > > It ought to be the compiler's job to diagnose its limitations, rather > than the user's. > > The feature macros are more for conditional usage of features, where > there's a fallback available. > > I suppose we could say that users have to include a particular header > file before using an attribute, and use a pragma in that header file to > tell the compiler to enable the attribute. But then there would need to > be a separate header file for each distinct set of attributes (in terms > of historical timeline), which would get ugly. I'm not sure that it's > better than using keywords, or even whether it's better than predefining > the "keyword" as a macro that expands to a compiler-internal attribute. > With a combination of those approaches it can be a single header: #ifdef __ARM_FEATURE_FOO #define __arm_foo [[arm::foo]] // else use of __arm_foo will fail #endif --0000000000005996350600aeef74--