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 ESMTP id 3BC67385DC23 for ; Thu, 8 Jul 2021 01:19:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3BC67385DC23 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-50--xhhqZJ_P7qsNtAWKQ9McA-1; Wed, 07 Jul 2021 21:19:31 -0400 X-MC-Unique: -xhhqZJ_P7qsNtAWKQ9McA-1 Received: by mail-qk1-f197.google.com with SMTP id y5-20020a37af050000b02903a9c3f8b89fso2770770qke.2 for ; Wed, 07 Jul 2021 18:19:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=anRzfUo665QYEGb3p2RiwCM7xedGGvfn84dyRw0vf4k=; b=Xh6ugO+NhyYD7LRIeY9zSMQifpjytjt9l/pD//V0xmUYwV4o33Coc0wGDunWDiejo7 y0117ZZ69a1aGD/CPrzC9AxzhZ0/lrqj5/Vxtc+FNRj0UFn5K6hpeGpknpASM7Ov3L8j iSWQiKyGrLzcHUNaCmiQe7+nc/dmyt8tGxSKSjDE7glw5L6EuL7ni4scXLSe2tbtT3WX xKlqKkUhlcNPBo2h6gdPTjLXDBlaiRlKQgtgoSyGMtNpR/3I902x+6rabi+ybxIWD+iN LGURpdwoES/2Ws9L3ixeUAZc88iX39S0JiPKQUO+20L+FT7P66/qDL+aUnxHlmSAQMxW nm2A== X-Gm-Message-State: AOAM533kvLvYWhJq+aYuU2zjuUOT1IKQoaMOSqddXjTQB8GUTY60ezyR Ymj0eNQU17sPqLUr92J00oarKeHdr7wfB4Zp8yzJqmLrtkabJH5tNXN5cqtjLkj4kJ1gJQ6eVAT yzQO9sNhEUlETQvtFPMbHkWBb2K9EGXm0+cFZV7QrRu76exN8TUCyaaBZAY4CQK2yZg== X-Received: by 2002:a05:620a:a1d:: with SMTP id i29mr28177217qka.311.1625707170248; Wed, 07 Jul 2021 18:19:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyts9Hee4McqQpq+Pv59PGF38uWgepbbwmoGM+hmG/5+0CcGarrslOQ4mPGkdKNP31dV7FqHQ== X-Received: by 2002:a05:620a:a1d:: with SMTP id i29mr28177188qka.311.1625707169880; Wed, 07 Jul 2021 18:19:29 -0700 (PDT) Received: from [192.168.1.148] (130-44-159-43.s11817.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id x21sm338839qkn.0.2021.07.07.18.19.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Jul 2021 18:19:29 -0700 (PDT) Subject: Re: [PATCH] Add gnu::diagnose_as attribute To: Matthias Kretz , gcc-patches@gcc.gnu.org References: <14205410.xuKvIAzr1H@excalibur> <2031764.yKVeVyVuyW@minbar> <18863746.PYa122fH2K@excalibur> From: Jason Merrill Message-ID: Date: Wed, 7 Jul 2021 21:19:28 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <18863746.PYa122fH2K@excalibur> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 01:19:33 -0000 On 7/7/21 4:23 AM, Matthias Kretz wrote: > On Tuesday, 22 June 2021 21:52:16 CEST Jason Merrill wrote: >>> 2. About the namespace aliases: IIUC an attribute would currently be >>> rejected because of the C++ grammar. Do you want to make it valid before >>> WG21 officially decides how to proceed? And if you have a pointer for me >>> where I'd have to adjust the grammar rules, that'd help. >> >> You will want to adjust cp_parser_namespace_alias_definition to handle >> attributes like cp_parser_namespace_definition. The latter currently >> accepts attributes both before and after the name, which seems like a >> good pattern to follow so it doesn't matter which WG21 chooses. >> Probably best to pedwarn about C++11 attributes in both locations for >> now, not just after. > > This introduces an ambiguity in cp_parser_declaration. The function has to > decide whether to call cp_parser_namespace_definition or fall back to > cp_parser_block_declaration (which calls > cp_parser_namespace_alias_definition). But now the parser has to look ahead a > lot farther: > > namespace foo [[whatever]] {} > namespace bar [[whatever]] = foo; > > I.e. only at '{' vs. '=' can cp_parser_declaration decide to call > cp_parser_namespace_definition. > > Consequently, should I really modify cp_parser_namespace_definition to handle > namespace aliases? aliases can also appear at block scope, unlike namespace definitions, but you could factor out some of the alias handling to call from both places. > Or can/should cp_parser_declaration look ahead behind the > attribute(s)? How? cp_parser_skip_attributes_opt Jason