[v4,0/2] Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++
Message ID | 20220802183602.1575950-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 v22csp3148933pxt; Tue, 2 Aug 2022 11:36:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uE6d1qlrc58U8fq42PkQJP9MTJ1IWh22Fh7SY5G1mAB5wRCqIOKLfas61WKx51T7prkxhX X-Received: by 2002:a17:907:1b1c:b0:72f:9aac:ee41 with SMTP id mp28-20020a1709071b1c00b0072f9aacee41mr17182433ejc.56.1659465419512; Tue, 02 Aug 2022 11:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659465419; cv=none; d=google.com; s=arc-20160816; b=DmN8IMvO8DNTnUM6z+EbWfO07Af6kTNvH6X2waw1BeSrcwt9wE4Z8FFImmOzqOj75y +/CSr5WKnB776/2dIiEsjSXNRk+f5AjSMwP05iPG/FucGOO/UaaO2q8CTeYma3zPo02l FsvGthCYMbBSYU0BsqIHIM9oioFNHjqpOL0m2xHQVOzThYF0WxKO6mU2z8GcLTMe5Xqc PuWNAgICVZ5e0ORVdLHDrnXoSWtYFNtDnuQVR4Izz07nJ/6yZ7F76qU6lee5ZFilkPNl 8lWZ1qQRfNiJMXG9zsla3fMn8UDpGyjyaZ8Eu5CGjjLGqFZ7bbJk8g3+Yh4D+zP0wsv7 dLmQ== 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=EsmxWRuq+JucN7R63vVtx+iVk6Y8ZM9reEb2s1a9nUM=; b=ZzF5A7/FHy2AvoEhrMUaikA0BwqV9JfXd7pI3c+UpGOJ1flfLZzm/1sPznwlMcaN5K BFh156sHQ2qy9TUPhJaygb5m/VK4aK+Tn7IvS86BnzVvX1sbr97nea7juhOkS2iF6vuj 17beYBGMo/i/ze+v1HKK9v3EAD82fU4Sdcfs8weHYn6McSNg7r/Npd/M5HR3TgE663q8 zrBfLu0YZ40Bj52ihlTIWTSnY06KBC7yM8XKZMuvfQfe+jM/KuXuKzMv/lf8Es6klUL7 F4vmZSGEzAsv2kgEQlGCdxNvWjKRG45389xa7cY4oXnBGoRR1jNClTgu31tax/peND9b V5uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="HROqcDo/"; 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 dp18-20020a170906c15200b00730925fc411si4528477ejc.840.2022.08.02.11.36.59 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 11:36:59 -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="HROqcDo/"; 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 133583857C7B for <ouuuleilei@gmail.com>; Tue, 2 Aug 2022 18:36:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 133583857C7B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1659465418; bh=EsmxWRuq+JucN7R63vVtx+iVk6Y8ZM9reEb2s1a9nUM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=HROqcDo/N9alv/GYBHyon45SdpR07RJBzaZp4YKLuPqLnNW/5S+KBDuC8h7VQ0L+u /++5+Vuu9fvSEDQyECtc4+KILGXf8U7LMapNIRSRn3eILVPrE1wIkZxF3anPCKV4Nk UhFFOqWabOZ/Pu/Lt0e2RFuquiM9jTZrFpLSzzMI= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp96.ord1d.emailsrvr.com (smtp96.ord1d.emailsrvr.com [184.106.54.96]) by sourceware.org (Postfix) with ESMTPS id 2797B385829C for <gcc-patches@gcc.gnu.org>; Tue, 2 Aug 2022 18:36:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2797B385829C X-Auth-ID: tom@honermann.net Received: by smtp13.relay.ord1d.emailsrvr.com (Authenticated sender: tom-AT-honermann.net) with ESMTPSA id B0EC8C015E; Tue, 2 Aug 2022 14:36:11 -0400 (EDT) To: gcc-patches@gcc.gnu.org Subject: [PATCH v4 0/2] Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++ Date: Tue, 2 Aug 2022 14:36:00 -0400 Message-Id: <20220802183602.1575950-1-tom@honermann.net> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Classification-ID: 1c8dd2ad-b7d1-42b3-917d-b50ffbed0e63-1-1 X-Spam-Status: No, score=-4.0 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?1740075611731665133?= X-GMAIL-MSGID: =?utf-8?q?1740075611731665133?= |
Series |
Implement C2X N2653 (char8_t) and correct UTF-8 character literal type in preprocessor directives for C++
|
|
Message
Tom Honermann
Aug. 2, 2022, 6:36 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 (2): C: Implement C2X N2653 char8_t and UTF-8 string literal changes preprocessor/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 | 6 +++ .../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/c11-utf8str-type.c | 6 +++ gcc/testsuite/gcc.dg/c17-utf8str-type.c | 6 +++ gcc/testsuite/gcc.dg/c2x-utf8str-type.c | 6 +++ gcc/testsuite/gcc.dg/c2x-utf8str.c | 34 +++++++++++++++ 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, 185 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/c11-utf8str-type.c create mode 100644 gcc/testsuite/gcc.dg/c17-utf8str-type.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-utf8str-type.c create mode 100644 gcc/testsuite/gcc.dg/gnu2x-utf8str.c