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 [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id E26453858434 for ; Wed, 1 Sep 2021 21:46:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E26453858434 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-425-m9f02q0sN_yFr2A6x_7Zwg-1; Wed, 01 Sep 2021 17:46:39 -0400 X-MC-Unique: m9f02q0sN_yFr2A6x_7Zwg-1 Received: by mail-qt1-f198.google.com with SMTP id 98-20020aed316b000000b00298da0dd56bso972256qtg.13 for ; Wed, 01 Sep 2021 14:46:39 -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:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OqrgBwSnzdyTWlw1RLTrFlFhAm+LMT3mTYBLyIVpYqI=; b=YtuHiHzOrKUyN/TEUIi5/tlPkS3g5QOa95xigu/YjwR5kAx+/0yy9gRTr0nrFjL/qr 5sIWlO7s8pgVhvpNAzUjgcB+g4a8Hva1MqDUJmTZclisJHPwtFcjAWE7QxMYC65v2xB8 EiRm8wonlJSYDF0T9gN8257vDNZdfIoeiP0CzfBGFOChCxLW90r/8Vj8zfN1h/dXKqb+ PcS1GA4imVVuK/MN8AaC8qDp/Hi1Wtle3BfWHHd0RGN+9IXWb+qdkOdJnXTyL1KBnkLu Q9Ma/ZuSmBeo2TlSK5Qw4ouixrdgODifqk93jJAZkMWFucEpJtz+H3eJEeyAMKlYNb0q noVg== X-Gm-Message-State: AOAM531QdKn8H/M0m8gWHWt/P/NC7E/4Cq9d22nFI+zGmpI/mFrZJ8Oj Rt/y3BMqqtkQZkSPk0i301fM+LYi2AYc/xNuCxy/2v5FhV9MYE8Pbgo8JVk4GyMIiFc3mlNg9qB cXTO8mNaTje4uu2tU8rZOsg//hYxHsAfwo6FHPKp7sPBEY7Y63p6k6W3abPG3oplgGw== X-Received: by 2002:ad4:4e0f:: with SMTP id dl15mr33115qvb.60.1630532798342; Wed, 01 Sep 2021 14:46:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFN4nidHeMAjAdlEciRN+QPJj5tov4erWd5z3HHDLWlJ+G1wrESHqwRrE5WhRw9sSSGu4/Gg== X-Received: by 2002:ad4:4e0f:: with SMTP id dl15mr33093qvb.60.1630532798031; Wed, 01 Sep 2021 14:46:38 -0700 (PDT) Received: from [192.168.1.149] (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 l13sm638782qkp.97.2021.09.01.14.46.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Sep 2021 14:46:37 -0700 (PDT) Subject: Re: C++ patch ping To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org References: <20210830071140.GJ920497@tucnak> <20210901201112.GN920497@tucnak> From: Jason Merrill Message-ID: Date: Wed, 1 Sep 2021 17:46:36 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210901201112.GN920497@tucnak> 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.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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: Wed, 01 Sep 2021 21:46:52 -0000 On 9/1/21 4:11 PM, Jakub Jelinek wrote: > On Wed, Sep 01, 2021 at 03:25:17PM -0400, Jason Merrill wrote: >> On 8/30/21 3:11 AM, Jakub Jelinek wrote: >>> Hi! >>> >>> I'd like to ping the following patches >>> >>> libcpp: __VA_OPT__ p1042r1 placemarker changes [PR101488] >>> https://gcc.gnu.org/pipermail/gcc-patches/2021-July/575621.html >>> together with your >>> https://gcc.gnu.org/pipermail/gcc-patches/2021-August/577602.html >>> incremental patch (successfully tested on x86_64-linux and i686-linux). >> >> OK, thanks. > > Thanks, committed both patches. > >> My reply to that patch approved it with a suggestion for a tweak to >> ucn_valid_in_identifier. Quoting it here: >> >>> I might check invalid_start_flags first, and return 1 if not set, then >>> check all the other flags when not pedantic, and finally return 2 if >>> nothing matches. OK with or without this change. > > Sorry for missing this, didn't scroll down enough. > > I don't think something like: > if (CPP_OPTION (pfile, cxx23_identifiers)) > invalid_start_flags = NXX23; > else if (CPP_OPTION (pfile, c11_identifiers)) > invalid_start_flags = N11; > else if (CPP_OPTION (pfile, c99)) > invalid_start_flags = N99; > else > invalid_start_flags = 0; > > /* In C99, UCN digits may not begin identifiers. In C11 and C++11, > UCN combining characters may not begin identifiers. */ > if ((ucnranges[mn].flags & invalid_start_flags) == 0) > return 1; > > /* If not -pedantic, accept as character that may > begin an identifier a union of characters allowed > at that position in each of the character sets. */ > if (!CPP_PEDANTIC (pfile) > && ((ucnranges[mn].flags & (C99 | N99)) == C99 > || (ucnranges[mn].flags & CXX) != 0 > || (ucnranges[mn].flags & (C11 | N11)) == C11 > || (ucnranges[mn].flags & (CXX23 | NXX23)) == CXX23)) > return 1; > > return 2; > would work, e.g. for C++98 invalid_start_flags is 0, so it would return > always 1, while the previous patch returned 2 for non-pedantic if the char > wasn't in the CXX set but was e.g. in the C99 set that wasn't allowed > as the first char (i.e. in & (C99 | N99) == (C99 | N99) set) etc. > While all C99 | N99 characters are C11 | 0, e.g. > \u0304 (and many others) are not in C99 at all, not in CXX, and in > C11 | N11 and in CXX23 | NXX23. So they are never valid as start > characters. There are also some characters like > \u1dfa which are not in C99 at all, not in CXX, not in CXX23 and in > C11 | N11, so again not valid as start character in any of the pedantic > modes. IMHO we want to return 2 for them in non-pedantic. > And testing first > if (ucnranges[mn].flags & invalid_start_flags) > return 2; > and then doing the if !CPP_PEDANTIC stuff wouldn't work either, e.g. > \U0001d18b is in CXX23 | NXX23 and in C11 | 0, so we IMHO want to return > 1 for that (allowed as start character in -pedantic -std=c++20, disallowed > as start character in -pedantic -std=c++23) but we would return 2 > in -std=c++23 mode. Fair enough. Go ahead without changes, then. Jason