From patchwork Tue Jan 17 21:12:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitrij Mijoski X-Patchwork-Id: 44800 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1984244wrn; Tue, 17 Jan 2023 13:13:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXu7h7dXZgbYuEoqyEzm2tLuAH/81PaGHRrONIcm5upMQR4n/Jj78KNVqPCCl+oCUecNNaOg X-Received: by 2002:a17:906:948e:b0:870:8a70:d630 with SMTP id t14-20020a170906948e00b008708a70d630mr4871911ejx.17.1673989998188; Tue, 17 Jan 2023 13:13:18 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id qw23-20020a1709066a1700b0087093a55b0csi7823836ejc.252.2023.01.17.13.13.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 13:13:18 -0800 (PST) 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=uD20dfwz; arc=fail (signature failed); 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 9BD8C3858421 for ; Tue, 17 Jan 2023 21:13:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BD8C3858421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673989983; bh=m5nzsNlA/eBZVTlbKm7TuScWRUKXV9MVbd3ngyQN6ho=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uD20dfwzcpKpRmr+pqU/ujFl3sveniOUBI1Tj9pzGP4v2gcQuYjO0Jxq22v8wyHmT PcLrO2fAn+O4GZXBB5Yz1oQ8Gx9KR2SnDN8ui6iItppBnQ7Cp/9ooHJNJqK+z0rmWH g8LXufGwMrLi6G0FW/CcXulec53xFHw6u9C8UVvA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04olkn2048.outbound.protection.outlook.com [40.92.75.48]) by sourceware.org (Postfix) with ESMTPS id C60F83858D28; Tue, 17 Jan 2023 21:12:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C60F83858D28 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QHNLrIHER2CUOcj1Z7tKpnT3AstsOg82Al+LntWCCnp8CR8f3u09dDPPJiqS5caA/HtN34Mqv8lkIH6br3vyJWlxGg+llgmvCvtBgFKb3EfO7nQBIYENW/STntGr+1E5fhYzVIa8lid2rE4FYppWZmKbifhX+Cg7Rr3ZV/n2bDJVqzbWpKtITJLHJtMorlLKnpAgaeXDQA0wCYaNpVZNUTpFrYdSATuB2Q6wppxhqdmj6sZ2lMyXAq/89mRU5aU+j8OLpBXlLqlehM6KMy+asSh/ZO7v+G5cNl2Dtze0yzPt8wStIos4dOWU2Qu3tKf850CMg5GjobwApDMBYa3sSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m5nzsNlA/eBZVTlbKm7TuScWRUKXV9MVbd3ngyQN6ho=; b=Q2g4zNiCIQec+mOEYRvpDz6CmT9HP9nddjKZnrEnuWbLKYiXsWHAbwUD9E2ZGZAYb7UYWuUJ8ane0zMFPtxrLLb/xwks8VspO7nf3vEoIsgddiijLU3xXkr52a6nQKChSiLnwc8M9XuAlV1WM8E1FWuRVxjDkD1KQMitQLZOfc/YRDcVkdDq42gmaGmoMo/SgDAehlx8KN0pP64V3X3PWt9HYsbQGTMImDss0M1JmntFMvuZiK+T+imimGaV7Xmq5QbG2853nSkx7y2bG7yGVk3BxsmZN5JGYPg3cRqJEAhKTp3G3mRFi0lVGVkfyrqMkqBWeHLlrQ1Gyo8P/HmIyg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from AM0PR04MB5412.eurprd04.prod.outlook.com (2603:10a6:208:10f::11) by PAXPR04MB8717.eurprd04.prod.outlook.com (2603:10a6:102:21c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Tue, 17 Jan 2023 21:12:16 +0000 Received: from AM0PR04MB5412.eurprd04.prod.outlook.com ([fe80::8021:ef99:c515:b20f]) by AM0PR04MB5412.eurprd04.prod.outlook.com ([fe80::8021:ef99:c515:b20f%3]) with mapi id 15.20.6002.012; Tue, 17 Jan 2023 21:12:16 +0000 Message-ID: Subject: [PATCH] libstdc++: testsuite: Simplify codecvt_unicode To: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Date: Tue, 17 Jan 2023 22:12:12 +0100 User-Agent: Evolution 3.44.4-0ubuntu1 X-TMN: [eHU+VnTz5CCvN6kYV8HTTpcMjkMqxowc] X-ClientProxiedBy: VI1PR03CA0044.eurprd03.prod.outlook.com (2603:10a6:803:50::15) To AM0PR04MB5412.eurprd04.prod.outlook.com (2603:10a6:208:10f::11) X-Microsoft-Original-Message-ID: <62127694c3cb81f447538be07506c48fffe2092a.camel@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB5412:EE_|PAXPR04MB8717:EE_ X-MS-Office365-Filtering-Correlation-Id: ca03d060-0e13-4125-4f18-08daf8cf821e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g7c0HzF3f4f62h/QgBI2p05hwYe5kRZISmway1QF5Z43C/KCmkk/hPtLA85igM9WiTPkrxAsyNJaa5nypUEhI4yG3Rpv4PUyi+rwsWSOOugwckJ/dqHYaYttA1SH8YmU70pNkm73ono8lSJ3rVf/S/IcaL2+u/TLy9ySkUfeyGHfVeE3fZLwRoWjt3PVvP3m92QkhqjJAJYL8+UPS6WhO/AJiVc1zCW3MBQwvF5kD/8FI0+5sYBBdm1cZbYGqXiQJgVLbHVa3SY4g4z92lVL3cDsxa7V1hOR5ssMNR1Jc9H4Yb0L8wceLqd9WuAGyieCxDA3DhXyQw++dC8XB0VYr+BwlBGy4+FxZsxeI0KPMRGLnLD6nTPTLM5AhlwgtjPilqj2QuevKl/E0QUCPoc8WAl+++XbmfoKFUJjKmDQJsz6UQeHo7BhmJCxVgiAHyI1vpeANrc8zeap3zGnuXzYNAQQYCVWK4S7Cm0nWIWOgM05A09CXp8EzPhZYekbK6/FATGVuNK8yAXfkKa4sJXFDwoTbT3pw/5k6V33OVPXwzLQIGdMMKMW0IKwImSaStEr8kGHulG7emurtp+WNuxmPQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?D2KiVIt5VHz7v81fk9TN/n/La94U?= =?utf-8?q?3GnPpnGL/C+H6J5V9e+vhuB/vm65R77ZF7Dw0FUkWYrTE6jFYveyhliNT0FgyCdl8?= =?utf-8?q?7U6widH9ksbX4Hopd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2sYBxWDc9r86MxkA9eMjmJ2MO+6YTl8hz9C5BJdvRM8U?= =?utf-8?q?PqhHXrXKA3Kb3sXMwXQM1wAQW39UZGfXjKRv7d//t6FI0K5DFNcGD8wzvfYX8+Kgr?= =?utf-8?q?BCA6iPj75m1vj8YdWPwxMwfvKtxFuG3pE2hJKLeNE27g96/r9VbK6J6vHuec6XfVb?= =?utf-8?q?rAUgRkHNIikiTR2gz5YRLBk8YyGTAk2UBwCeB4uaVpPJeQTZprpGE5dhY50cOkyFb?= =?utf-8?q?9MgDoAHQYM1BxX2bn?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-03a34.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: ca03d060-0e13-4125-4f18-08daf8cf821e X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5412.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 21:12:15.9414 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8717 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Dimitrij Mijoski via Gcc-patches From: Dimitrij Mijoski Reply-To: Dimitrij Mijoski Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755305736563331923?= X-GMAIL-MSGID: =?utf-8?q?1755305736563331923?= Stop using unique_ptr, create some objects directly. libstdc++-v3/ChangeLog: * testsuite/22_locale/codecvt/codecvt_unicode.cc: Simplify. * testsuite/22_locale/codecvt/codecvt_unicode.h: Simplify. * testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc: Simplify. --- .../22_locale/codecvt/codecvt_unicode.cc | 18 ++++++++++-------- .../22_locale/codecvt/codecvt_unicode.h | 9 +-------- .../codecvt/codecvt_unicode_wchar_t.cc | 12 ++++++------ 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc index ae4b6c896..3d7393e4a 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.cc @@ -29,11 +29,12 @@ test_utf8_utf32_codecvts () using codecvt_c32 = codecvt; auto loc_c = locale::classic (); VERIFY (has_facet (loc_c)); + auto &cvt = use_facet (loc_c); test_utf8_utf32_codecvts (cvt); - auto cvt_ptr = to_unique_ptr (new codecvt_utf8 ()); - test_utf8_utf32_codecvts (*cvt_ptr); + auto cvt2 = codecvt_utf8 (); + test_utf8_utf32_codecvts (cvt2); } void @@ -42,21 +43,22 @@ test_utf8_utf16_codecvts () using codecvt_c16 = codecvt; auto loc_c = locale::classic (); VERIFY (has_facet (loc_c)); + auto &cvt = use_facet (loc_c); test_utf8_utf16_cvts (cvt); - auto cvt_ptr = to_unique_ptr (new codecvt_utf8_utf16 ()); - test_utf8_utf16_cvts (*cvt_ptr); + auto cvt2 = codecvt_utf8_utf16 (); + test_utf8_utf16_cvts (cvt2); - auto cvt_ptr2 = to_unique_ptr (new codecvt_utf8_utf16 ()); - test_utf8_utf16_cvts (*cvt_ptr2); + auto cvt3 = codecvt_utf8_utf16 (); + test_utf8_utf16_cvts (cvt3); } void test_utf8_ucs2_codecvts () { - auto cvt_ptr = to_unique_ptr (new codecvt_utf8 ()); - test_utf8_ucs2_cvts (*cvt_ptr); + auto cvt = codecvt_utf8 (); + test_utf8_ucs2_cvts (cvt); } int diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h index 99d1a4684..fbdc7a35b 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode.h @@ -15,18 +15,11 @@ // with this library; see the file COPYING3. If not see // . +#include #include #include -#include #include -template -std::unique_ptr -to_unique_ptr (T *ptr) -{ - return std::unique_ptr (ptr); -} - struct test_offsets_ok { size_t in_size, out_size; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc index 169504939..f7a0a4fd8 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_unicode_wchar_t.cc @@ -27,8 +27,8 @@ void test_utf8_utf32_codecvts () { #if __SIZEOF_WCHAR_T__ == 4 - auto cvt_ptr = to_unique_ptr (new codecvt_utf8 ()); - test_utf8_utf32_codecvts (*cvt_ptr); + auto cvt = codecvt_utf8 (); + test_utf8_utf32_codecvts (cvt); #endif } @@ -36,8 +36,8 @@ void test_utf8_utf16_codecvts () { #if __SIZEOF_WCHAR_T__ >= 2 - auto cvt_ptr = to_unique_ptr (new codecvt_utf8_utf16 ()); - test_utf8_utf16_cvts (*cvt_ptr); + auto cvt = codecvt_utf8_utf16 (); + test_utf8_utf16_cvts (cvt); #endif } @@ -45,8 +45,8 @@ void test_utf8_ucs2_codecvts () { #if __SIZEOF_WCHAR_T__ == 2 - auto cvt_ptr = to_unique_ptr (new codecvt_utf8 ()); - test_utf8_ucs2_cvts (*cvt_ptr); + auto cvt = codecvt_utf8 (); + test_utf8_ucs2_cvts (cvt); #endif }