[0/3] Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++
Message ID | 20220725175948.1424695-1-tom@honermann.net |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:b5d6:b0:2b9:3548:2db5 with SMTP id v22csp1795793pxt; Mon, 25 Jul 2022 11:00:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uKZAoWKaeWpy889/DXT5D7wHZsKFOYcnOe2Fxdo4UwYjr1JUxbmjBnxoEfgp2NHdMxCPTM X-Received: by 2002:a17:907:7628:b0:72b:4d6f:ce8a with SMTP id jy8-20020a170907762800b0072b4d6fce8amr10950960ejc.59.1658772052068; Mon, 25 Jul 2022 11:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658772052; cv=none; d=google.com; s=arc-20160816; b=tJDYbrpn9N2chZyH3IpjfoLJ6aUD53Q3R6x6kNHOk5U+3KALsQ5Tf8AY1vfJpND3q+ yw9qX0UgkbOL/22mLdXaT0Z1Qd4rPehMY18g4EvzxcuUBMafWAUQcXVFFS7Hlow+14IH aZDLQXDBBddUjurm4KIu4kFdrmFC3iwqIUGlW0cxETAoJfx80WGhKOgm9xo3zL/4HlNx 1C7oPvlJqMjC+ipDgDuOZOBDj3zvYxB4b2P4bBbQLz27o+whFaNaUEuyoCmcjEr654Iz 65GzZ2eiX81pi2jHfAtI06bXyqr+CTrlt0ufRl2yS0GCT2aO1JYv0VaXR4v20AQN+Ckk Uh7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=l6iOJAlewX9Ij6oci+KoVChAg8KSdAfMo2PMJSpXPmw=; b=S9oyMqt/7+eT7Mln2uiJFy9WTIsXSGHXxVW4OxkJsCZ+QgmGnHgUKZya35OHhcJFaq 0vWUtWEWTzQsokxtiIscVOxjlh/RobFqE23xPaTNHNgr2PJYrRZXQMpIfa+ph6uylIhq tnYoffK+PLrPJbJ5DkNusqYDNAnfO0yDCKrV6sjrTHzVkJE9LU5EH8L2lnlSyyvdxEOZ BG6OKznOaA1orKsHqdUwmoGsVKvOpwa5j+KhdH/Ad1Q3SgkYsyQCSJrKJ0bgmO9gIc5C P3u9mFgFcCP/JpG/Gy4DknTU91ylnACOp+vvh22q8w13NorXKm1qgF0ClYgoRSbxH3Z5 nu6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ugJWsPnq; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id i17-20020a05640242d100b0043a72c8b750si16857625edc.114.2022.07.25.11.00.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jul 2022 11:00:52 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ugJWsPnq; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 49C3638768A7 for <ouuuleilei@gmail.com>; Mon, 25 Jul 2022 18:00:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 49C3638768A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1658772046; bh=l6iOJAlewX9Ij6oci+KoVChAg8KSdAfMo2PMJSpXPmw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ugJWsPnqZjZ8y+t9SHrgI5ZMMW7WCjWHiWAaeY1xgyL7fQ2A4s6OPxCbhE4frtLnm c6vTnPQ/ZeOBzXD7hP+RKb2eWcYFq0oioeHdzGclj+D5X5C2gtg8pPtUhqenjKmDnR OWmH+S87mZubGpkr5BM22I0/QyD36htbLM4HZ1OY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp106.ord1d.emailsrvr.com (smtp106.ord1d.emailsrvr.com [184.106.54.106]) by sourceware.org (Postfix) with ESMTPS id CA50A38582AE for <gcc-patches@gcc.gnu.org>; Mon, 25 Jul 2022 18:00:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA50A38582AE X-Auth-ID: tom@honermann.net Received: by smtp6.relay.ord1d.emailsrvr.com (Authenticated sender: tom-AT-honermann.net) with ESMTPSA id 5AF2DE00E8; Mon, 25 Jul 2022 13:59:58 -0400 (EDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 0/3] Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++ Date: Mon, 25 Jul 2022 13:59:45 -0400 Message-Id: <20220725175948.1424695-1-tom@honermann.net> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Classification-ID: b7f150fc-14e1-4703-aa58-6102617532c5-1-1 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Tom Honermann via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Tom Honermann <tom@honermann.net> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1739348563660506125?= X-GMAIL-MSGID: =?utf-8?q?1739348563660506125?= |
Series |
Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++
|
|
Message
Tom Honermann
July 25, 2022, 5:59 p.m. UTC
This patch series provides an implementation and tests for the WG14 N2653 paper as adopted for C2X. Additionally, a fix is included for the C++ preprocessor to treat UTF-8 character literals in preprocessor directives as an unsigned type in char8_t enabled modes (in C++17 and earlier with -fchar8_t or in C++20 or later without -fno-char8_t). Tom Honermann (3): C: Implement C2X N2653 char8_t and UTF-8 string literal changes testsuite: Add tests for C2X N2653 char8_t and UTF-8 string literal changes c++/106426: Treat u8 character literals as unsigned in char8_t modes. gcc/c-family/c-lex.cc | 13 ++++-- gcc/c-family/c-opts.cc | 5 ++- gcc/c/c-parser.cc | 16 ++++++- gcc/c/c-typeck.cc | 2 +- gcc/ginclude/stdatomic.h | 8 ++++ .../g++.dg/ext/char8_t-char-literal-1.C | 6 ++- .../g++.dg/ext/char8_t-char-literal-2.C | 4 ++ .../atomic/c2x-stdatomic-lockfree-char8_t.c | 42 +++++++++++++++++++ .../atomic/gnu2x-stdatomic-lockfree-char8_t.c | 5 +++ gcc/testsuite/gcc.dg/c2x-predefined-macros.c | 11 +++++ gcc/testsuite/gcc.dg/c2x-utf8str-type.c | 6 +++ gcc/testsuite/gcc.dg/c2x-utf8str.c | 34 +++++++++++++++ .../gcc.dg/gnu2x-predefined-macros.c | 5 +++ gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c | 5 +++ gcc/testsuite/gcc.dg/gnu2x-utf8str.c | 34 +++++++++++++++ libcpp/charset.cc | 4 +- libcpp/include/cpplib.h | 4 +- libcpp/init.cc | 1 + 18 files changed, 191 insertions(+), 14 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/atomic/c2x-stdatomic-lockfree-char8_t.c create mode 100644 gcc/testsuite/gcc.dg/atomic/gnu2x-stdatomic-lockfree-char8_t.c create mode 100644 gcc/testsuite/gcc.dg/c2x-predefined-macros.c create mode 100644 gcc/testsuite/gcc.dg/c2x-utf8str-type.c create mode 100644 gcc/testsuite/gcc.dg/c2x-utf8str.c create mode 100644 gcc/testsuite/gcc.dg/gnu2x-predefined-macros.c create mode 100644 gcc/testsuite/gcc.dg/gnu2x-utf8str-type.c create mode 100644 gcc/testsuite/gcc.dg/gnu2x-utf8str.c