From patchwork Mon Nov 29 11:24:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 48246 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB158386F437 for ; Mon, 29 Nov 2021 11:25:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB158386F437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1638185102; bh=7mqv5nLBK7BVxchY+BDKVk556zgSLlvvWfQlkK33CQ8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=ZUx6AwyklBxGEQHJLkxgtiPnSC4vo/HNJm3UPP+SW5WC4i8qJPeZJLDAshHbnyLqJ uV5Y1jdApGqKfKeY5XTQcc+gC8jwJoytmVlDJ+Zj0QcvLhplhyIAjMFFjj7gFuBf5i XdvFpQBZVQYDMHz9DoEowi3t68URFRmbJSyw/A7Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DC5063857C6E for ; Mon, 29 Nov 2021 11:24:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DC5063857C6E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-igqdVHVHP3C4inF_QOnBfQ-1; Mon, 29 Nov 2021 06:24:30 -0500 X-MC-Unique: igqdVHVHP3C4inF_QOnBfQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4696D2F26 for ; Mon, 29 Nov 2021 11:24:29 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 059AB694C1; Mon, 29 Nov 2021 11:24:16 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 1ATBODpY190332 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 29 Nov 2021 12:24:13 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 1ATBODAU190331; Mon, 29 Nov 2021 12:24:13 +0100 Date: Mon, 29 Nov 2021 12:24:13 +0100 To: Jason Merrill Subject: [PATCH] libcpp: Enable P1949R7 for C++11 and up as it was a DR [PR100977] Message-ID: <20211129112413.GE2646553@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SCC_10_SHORT_WORD_LINES, SCC_20_SHORT_WORD_LINES, SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: Jonathan Wakely , gcc-patches@gcc.gnu.org Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi! Jonathan mentioned on IRC that: "Accept P1949R7 (C++ Identifier Syntax using Unicode Standard Annex 31) as a Defect Report and apply the changes therein to the C++ working paper." while I've actually implemented it only for -std={gnu,c}++{23,2b}. As the C++98 rules were significantly different, I'm not trying to change anything for C++98. So far lightly tested, ok for trunk if it passes full bootstrap/regtest on x86_64-linux/i686-linux? 2021-11-29 Jakub Jelinek PR c++/100977 * init.c (lang_defaults): Enable cxx23_identifiers for -std={gnu,c}++{11,14,17,20} too. * c-c++-common/cpp/ucnid-2011-1-utf8.c: Expect errors in C++. * c-c++-common/cpp/ucnid-2011-1.c: Likewise. * g++.dg/cpp/ucnid-4-utf8.C: Add missing space to dg-options. * g++.dg/cpp23/normalize3.C: Enable for c++11 rather than just c++23. * g++.dg/cpp23/normalize4.C: Likewise. * g++.dg/cpp23/normalize5.C: Likewise. * g++.dg/cpp23/normalize7.C: Expect errors rather than just warnings for c++11 and up rather than just c++23. * g++.dg/cpp23/ucnid-2-utf8.C: Expect errors even for c++11 .. c++20. Jakub --- libcpp/init.c.jj 2021-11-17 20:08:18.359724792 +0100 +++ libcpp/init.c 2021-11-29 11:40:05.989432952 +0100 @@ -114,14 +114,14 @@ static const struct lang_flags lang_defa /* STDC2X */ { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1 }, /* GNUCXX */ { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 }, /* CXX98 */ { 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0 }, - /* GNUCXX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0, 0, 0 }, + /* GNUCXX20 */ { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0 }, + /* CXX20 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0 }, /* GNUCXX23 */ { 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1 }, /* CXX23 */ { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1 }, /* ASM */ { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } --- gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c.jj 2020-01-14 20:02:46.649611841 +0100 +++ gcc/testsuite/c-c++-common/cpp/ucnid-2011-1-utf8.c 2021-11-29 12:11:51.640324720 +0100 @@ -2,7 +2,7 @@ /* { dg-options "-std=c11 -pedantic" { target c } } */ /* { dg-options "-std=c++11 -pedantic" { target c++ } } */ -¨ +¨ /* { dg-error "is not valid in an identifier" "" { target c++ } } */ B̀ @@ -11,5 +11,5 @@ B̀ À /* { dg-warning "not in NFC" } */ ? -? -? +? /* { dg-error "is not valid in an identifier" "" { target c++ } } */ +? /* { dg-error "is not valid in an identifier" "" { target c++ } } */ --- gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c.jj 2020-01-14 20:02:46.649611841 +0100 +++ gcc/testsuite/c-c++-common/cpp/ucnid-2011-1.c 2021-11-29 12:12:02.230174227 +0100 @@ -2,7 +2,7 @@ /* { dg-options "-std=c11 -pedantic" { target c } } */ /* { dg-options "-std=c++11 -pedantic" { target c++ } } */ -\u00A8 +\u00A8 /* { dg-error "is not valid in an identifier" "" { target c++ } } */ B\u0300 @@ -11,5 +11,5 @@ B\u0300 A\u0300 /* { dg-warning "not in NFC" } */ \U00010000 -\U0001FFFD -\U000E1234 +\U0001FFFD /* { dg-error "is not valid in an identifier" "" { target c++ } } */ +\U000E1234 /* { dg-error "is not valid in an identifier" "" { target c++ } } */ --- gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C.jj 2020-01-14 20:02:46.702611047 +0100 +++ gcc/testsuite/g++.dg/cpp/ucnid-4-utf8.C 2021-11-29 12:09:44.871126209 +0100 @@ -1,5 +1,5 @@ /* { dg-do preprocess } */ -/* { dg-options "-std=gnu++98"} */ +/* { dg-options "-std=gnu++98" } */ ª « /* { dg-error "not valid in an identifier" } */ --- gcc/testsuite/g++.dg/cpp23/normalize3.C.jj 2021-09-01 22:32:39.624869716 +0200 +++ gcc/testsuite/g++.dg/cpp23/normalize3.C 2021-11-29 11:42:49.283104059 +0100 @@ -1,4 +1,4 @@ -// { dg-do preprocess { target { c++23 } } } +// { dg-do preprocess { target { c++11 } } } // { dg-options "-pedantic-errors" } \u00AA --- gcc/testsuite/g++.dg/cpp23/normalize4.C.jj 2021-09-01 22:32:39.624869716 +0200 +++ gcc/testsuite/g++.dg/cpp23/normalize4.C 2021-11-29 11:43:03.542900685 +0100 @@ -1,4 +1,4 @@ -// { dg-do preprocess { target { c++23 } } } +// { dg-do preprocess { target { c++11 } } } // { dg-options "" } \u00AA --- gcc/testsuite/g++.dg/cpp23/normalize5.C.jj 2021-09-01 22:32:39.624869716 +0200 +++ gcc/testsuite/g++.dg/cpp23/normalize5.C 2021-11-29 11:43:14.662742096 +0100 @@ -1,4 +1,4 @@ -// { dg-do preprocess { target { c++23 } } } +// { dg-do preprocess { target { c++11 } } } // { dg-options "-pedantic-errors" } \u00AA --- gcc/testsuite/g++.dg/cpp23/normalize7.C.jj 2021-09-01 22:32:39.624869716 +0200 +++ gcc/testsuite/g++.dg/cpp23/normalize7.C 2021-11-29 11:51:00.691111036 +0100 @@ -3,10 +3,8 @@ // { dg-options "-pedantic-errors" } constexpr int À = 1; // U+00C0 -constexpr int À = 2; // U+0041 U+0300 { dg-warning "is not in NFC" "" { target { ! c++23 } } } -// { dg-error "is not in NFC" "" { target c++23 } .-1 } +constexpr int À = 2; // U+0041 U+0300 { dg-error "is not in NFC" } constexpr int gv1 = \u00c0; -constexpr int gv2 = A\u0300; // { dg-warning "is not in NFC" "" { target { ! c++23 } } } -// { dg-error "is not in NFC" "" { target c++23 } .-1 } +constexpr int gv2 = A\u0300; // { dg-error "is not in NFC" } static_assert(gv1 == 1, ""); static_assert(gv2 == 2, ""); --- gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C.jj 2021-09-01 22:32:39.624869716 +0200 +++ gcc/testsuite/g++.dg/cpp23/ucnid-2-utf8.C 2021-11-29 11:44:49.803387527 +0100 @@ -2,17 +2,17 @@ // { dg-do compile } // { dg-options "-pedantic-errors" } -bool ? = true; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } } +bool ? = true; // { dg-error "is not valid in an identifier" } bool ?‍♀ = false; // { dg-error "is not valid in an identifier" } int ⏰ = 0; // { dg-error "is not valid in an identifier" } -int ? = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } } +int ? = 0; // { dg-error "is not valid in an identifier" } int ☠ = 0; // { dg-error "is not valid in an identifier" } -int ? = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } } +int ? = 0; // { dg-error "is not valid in an identifier" } int ✋ = 0; // { dg-error "is not valid in an identifier" } -int ? = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } } +int ? = 0; // { dg-error "is not valid in an identifier" } int ✈ = 0; // { dg-error "is not valid in an identifier" } -int ? = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } } +int ? = 0; // { dg-error "is not valid in an identifier" } int ☹ = 0; // { dg-error "is not valid in an identifier" } -int ? = 0; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } } +int ? = 0; // { dg-error "is not valid in an identifier" } struct E {}; -class ? : public E {}; // { dg-error "is not valid in an identifier" "" { target { c++98_only || c++23 } } } +class ? : public E {}; // { dg-error "is not valid in an identifier" }