From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id CE58E38582B0 for ; Mon, 13 Nov 2023 21:51:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CE58E38582B0 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CE58E38582B0 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699912317; cv=none; b=x52/g2H4jwkhKpWo3Y+K7t5quj1MQ0Cn1p9RuBHViRKR2TMPgfTR9uMKLRW1tLjZlW19ehgLuqhJxkXFy7d/gOXwNWbvlmbHmXL8cLrMJhPzq6by6EwZpFPvL6+Zr8RYe4y3e0fYmFKcQSdbxqJqhP4YgsSVdNO447z+IYLm+F0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699912317; c=relaxed/simple; bh=e1+s8DzquBKENqPB3E2VFhvUkOdeTkvX5bDNWtsaxq4=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=tr8Mg1RpR3yC/Vk1Yu0i+UtQkpQLUPppVvOlT4VyOlDfcIJItGDONkjW47AnDsJaWkgljw0IpRcQynWCSFxwdwRpFj45ZIqR/IQPPWSHbv/dm2EyRnT/LE4Z38QLwYmp4q+5NkyPNdd+Cla76jqLQYK1x00t8Cls8+sR42CfS4Q= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1cc316ccc38so37535325ad.1 for ; Mon, 13 Nov 2023 13:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699912315; x=1700517115; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jsIctMu5dBODdAkK5Rn89P9c6R472IlnZBN3DbIo4qg=; b=O/YlWUlUoqvFL7HS+HnRZ5q1PYlEZHsgCu+nzU4I18XYdpvCQAoTiTbpZQ9ttB2qze hu5gBvx2WATepwmTu0OTdFhCA+AxB5Jxfjycq1OVQh1bTx3lill/G+WDmp3w6UUdvWnt VS1am3ZysMTPVyRC+F0liGCZuq5ttVqRtrAoax7qK9S8tb+FD3IYYc7YhhQDc21J9L3q zqGCYACm+iw5AqH/OVY062gfw2pkG7FynX1IX289H41UrArSa//vXnIYhSMaSyI1KJpa DY6brht9Dz0L43RZ0lIoPeedQghAMlesfr4p28PVG8r0TwpOIsoUo0kUwbOHJ0I3Z0tz PmLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699912315; x=1700517115; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jsIctMu5dBODdAkK5Rn89P9c6R472IlnZBN3DbIo4qg=; b=n9Lp0zo+bogOMoJ+KKnZ1ZU1CMzB4qwgyTjP3YqizTXLprHtW6UZIhJ6rqObhuSfGK FtxKUvLPIsrPDW4ROUdFS677VQPyOlpmNIHeIHKqLKM79t4Pu8887ETgrTzPT+4e39I3 DzBG0qabnbyJB6JJ1AYy2dtE+prS6u6ksUWKQCIabaheJX79Kl88cqPNhjfZIl+EzK4U YWeHWwMvvRK5XAjzPiFI7TDqtlwBC2MOQlI2yYZOdEaXtH08j6f73T/vzx+Ny+sLsn9W Hydwckxx50KMkw4ml/R9OVUhvbEAJ3t8Svfp7V30ZX6vlW3Amo+JZ6uXKJJhlGO4/oDq sdbQ== X-Gm-Message-State: AOJu0YyNux5Y7Y5wk4DJRVjZyvLYEPoMwpLt1+oicu12gc2OkXkykFRu NobUhg0o5crfpJcaLEnk0U4= X-Google-Smtp-Source: AGHT+IHEeT7DxFMrujxqZggD/uxgOAg4eBUhImVpsLHzEfYQ183Rcq86YLOdi5SjFx2vIZYm/9uYtg== X-Received: by 2002:a17:903:1109:b0:1cc:3825:7ba2 with SMTP id n9-20020a170903110900b001cc38257ba2mr591623plh.4.1699912314733; Mon, 13 Nov 2023 13:51:54 -0800 (PST) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id s13-20020a170902988d00b001cc8cf4ad14sm4473704plp.142.2023.11.13.13.51.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Nov 2023 13:51:54 -0800 (PST) Message-ID: <40816fd8-b467-45e8-993b-750c6ad6ebd1@gmail.com> Date: Mon, 13 Nov 2023 14:51:48 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] c-family: Add handling for clang-style attributes [PR109877]. Content-Language: en-US To: iain@sandoe.co.uk, gcc-patches@gcc.gnu.org Cc: joseph@codesourcery.com, jason@redhat.com References: <20231113060244.90554-1-iain@sandoe.co.uk> <20231113060244.90554-2-iain@sandoe.co.uk> From: Jeff Law In-Reply-To: <20231113060244.90554-2-iain@sandoe.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: On 11/12/23 23:02, Iain Sandoe wrote: > This patch set is not actually particualry new, I have been maintaining > it locally one Darwin branches and it has been tested on several versions > of Darwin both with and without Alex's __has_{feature, extension} patch. > > This is one of the three most significant blockers to importing the macOS > SDKs properly, and cannot currently be fixincludes-ed (in fact it can not > ever really since the attribute is uaer-facing and so can be in end-user > code that we cannot fix). > > OK for trunk? > thanks > Iain > > --- 8< --- > > > The clang compiler supports essentially arbitrary, per-attribute, syntax and > token forms for attribute arguments. This extends to the case where token > forms are required to be accepted that are not part of the valid set for > standard C or C++. > > A motivating example (in the initial attribute of this form implemented > in this patch set) is version-style (i.e. x.y.z) numeric values. At present > the c-family cannot handle this, since invalid numeric tokens are rejected > by both C and C++ frontends before we have a chance to decide to accept them > in custom attribute argument parsing. > > The solution proposed in this patch series is to allow for a certain set of > attributes names that are known to be 'clang-form' and to defer argument > token validation until the parse of those arguments. > > This does not apparently represent any loss of generality - since the > specific attribute names are already claimed by clang and re-using them with > different semantics in GCC would be a highly unfortunate experience for end- > users. > > The first patch here adds a mechanism to check attribute identifiers against > a list known to be in clang form. The 'availability' attribute is added as a > first example. > > The acceptance of non-standard tokens is constrained to the interval enclosing > the attribute arguments of cases notified as 'clang-form'. > > PR c++/109877 > > gcc/c-family/ChangeLog: > > * c-attribs.cc (attribute_clang_form_p): New. > * c-common.h (attribute_clang_form_p): New. Patches #1-#3 are fine if nobody has objected within say 48hrs. Basically I agree that we have to do something along the lines of what you're suggesting and I just want to give folks the opportunity to raise any implementation issues they may see. Patch #4 is obviously darwin specific and I think you can self-approve. Jeff