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 E47503858004 for ; Fri, 18 Nov 2022 00:06:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E47503858004 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=1668729998; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E3cWvaYV9Ko3bOjN0YhGr7ycyTrFWOPJBiXV0fg/hu0=; b=f5MNGK8/vkxzwEjf+K0G+HtGTf51w3s9nrt/tW27qywsrZAz0B5d9hkWmp71QYnOTPeTDc dBsTiiM95KKKAIGafKxgMYeSj9zsS5l0bZnZdVO4lwxrJFdEuA39v+C9dIi7giMNP/+Vfb Rvd/XD/ZoaKuTmU4m15um44JE7uBEWg= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-142-8YBhje-lMQmyz-2WjYWEIg-1; Thu, 17 Nov 2022 19:06:37 -0500 X-MC-Unique: 8YBhje-lMQmyz-2WjYWEIg-1 Received: by mail-qk1-f199.google.com with SMTP id w4-20020a05620a444400b006fa24b2f394so4193316qkp.15 for ; Thu, 17 Nov 2022 16:06:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=E3cWvaYV9Ko3bOjN0YhGr7ycyTrFWOPJBiXV0fg/hu0=; b=BGFVuCd6N4FBTsBuyQ8C00eKjS/MbvHNRsh1kpZpwIQtHQ7d+EBRXWBZmHF7D1Hi7R M8fz0lJ8OlpkJMyXhvCirmRp0SrMf8Io6JUe909Ehb5u9z7fszGsQ47goGdbKXDLXk4G lwl6ImJJZHbwz2IGySHl5d8pOTX1G8kYOjv0bK7lkp7mzLfUFVm6E6JAnkhbl5aa1Bam /vPB70wZ1BrwDYrfaPDhkOGEStQkRjLILh7CWl4IeuiM2osn1YHS8bIlfn56U/VbbDTU BWlIiz0A3yt2G0w0uRw/Y+PhlB73U9PFr/zpdl3uIHVKHn4I2zSZQIthoYblsSwB1fAz Fnaw== X-Gm-Message-State: ANoB5pnXxL6FmtTO2qpxMFNXKeBtHGdJ1j/W75UNemKz2J24ysGKlaci fTIAIsm68EAp/Si7Pv08cKKTCs69q7s38Ia4puc+nVYfQi6IqB08qeLuAvbI7QvzJmMDjHdBKQQ Yar5tQIp4GMdpuWEwwA== X-Received: by 2002:a05:620a:2114:b0:6ed:dd9c:3c5d with SMTP id l20-20020a05620a211400b006eddd9c3c5dmr4004488qkl.454.1668729996559; Thu, 17 Nov 2022 16:06:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf7hVJZNjGiyS3s98XS+QY0nJISY1jBEvOh5p73oaR6CBhR6lECSlw5dgH85zW7YythpKubQuw== X-Received: by 2002:a05:620a:2114:b0:6ed:dd9c:3c5d with SMTP id l20-20020a05620a211400b006eddd9c3c5dmr4004470qkl.454.1668729996231; Thu, 17 Nov 2022 16:06:36 -0800 (PST) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id w21-20020a05620a445500b006fa31bf2f3dsm1449020qkp.47.2022.11.17.16.06.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Nov 2022 16:06:35 -0800 (PST) Message-ID: Date: Thu, 17 Nov 2022 19:06:34 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] c++: Reject UDLs in certain contexts [PR105300] To: Marek Polacek Cc: GCC Patches References: <20221112165331.349041-1-polacek@redhat.com> <95aefa6c-5460-3e40-1e07-c2ebd39e3559@redhat.com> From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.4 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_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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/16/22 20:12, Marek Polacek wrote: > On Wed, Nov 16, 2022 at 08:22:39AM -0500, Jason Merrill wrote: >> On 11/15/22 19:35, Marek Polacek wrote: >>> On Tue, Nov 15, 2022 at 06:58:39PM -0500, Jason Merrill wrote: >>>> On 11/12/22 06:53, Marek Polacek wrote: >>>>> In this PR, we are crashing because we've encountered a UDL where a >>>>> string-literal is expected. This patch makes the parser reject string >>>>> and character UDLs in all places where the grammar requires a >>>>> string-literal and not a user-defined-string-literal. >>>>> >>>>> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? >>>> >>>> Since the grammar has >>>> >>>> user-defined-string-literal : >>>> string-literal ud-suffix >>>> >>>> maybe we want to move the UDL handling out to a cp_parser_udl_string_literal >>>> that calls cp_parser_string_literal? >>> >>> Umm, maybe, but the UDL handling code seems to be too entrenched in >>> cp_parser_string_literal and I don't think it's going to be easy to extract >>> it :/. >> >> Fair enough; maybe a wrapper, then? > > As in, have a cp_parser_udl_string_literal wrapper that calls > cp_parser_string_literal with udl_ok=true, rename cp_parser_string_literal, > introduce a new cp_parser_string_literal wrapper that passes udl_ok=false? That's what I was thinking. And the new cp_parser_string_literal could also omit the lookup_udlit parm. > One problem with cp_parser_udl_string_literal is that it's too similar to > cp_parser_userdef_string_literal, which would be confusing, I think. True, probably better to use that name instead, and rename the current one to something like finish_userdef_string_literal Jason