From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 2E2B33858D28; Wed, 18 Jan 2023 18:53:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2E2B33858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674068006; bh=9+pI3lGQrgZL9iA0CFBbyORgJ/wOL3M2e99niD2teSY=; h=From:To:Subject:Date:From; b=nCRZnwjARZTzYcRvc+QqEKPI1/XqlkFULZAMxdDEmYVtRI6kKNh1GgiKiiO1I6me9 /HWiE2u6wbTdoQ/kdB+yFrgYvd8+FEhcoEvdlcqtOkoyzo1N1nQmhFnRkcZJ7/R9w4 Y+mTcifm8XlEALmHh74gn5RHlAaZlHsFMSC9RQ5Y= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-5245] libstdc++: testsuite: Simplify codecvt_unicode X-Act-Checkin: gcc X-Git-Author: Dimitrij Mijoski X-Git-Refname: refs/heads/master X-Git-Oldrev: c6a011119bfa038ccbfc9f123ede14a3d6237fab X-Git-Newrev: 7d0cdbbcdd1c9e5e709d0be7d1843e8c1045fd16 Message-Id: <20230118185326.2E2B33858D28@sourceware.org> Date: Wed, 18 Jan 2023 18:53:26 +0000 (GMT) List-Id: https://gcc.gnu.org/g:7d0cdbbcdd1c9e5e709d0be7d1843e8c1045fd16 commit r13-5245-g7d0cdbbcdd1c9e5e709d0be7d1843e8c1045fd16 Author: Dimitrij Mijoski Date: Tue Jan 17 22:12:12 2023 +0100 libstdc++: testsuite: Simplify codecvt_unicode 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. Diff: --- .../testsuite/22_locale/codecvt/codecvt_unicode.cc | 18 ++++++++++-------- .../testsuite/22_locale/codecvt/codecvt_unicode.h | 9 +-------- .../22_locale/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 ae4b6c8968f..df1a2b4cc51 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); + codecvt_utf8 cvt2; + 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); + codecvt_utf8_utf16 cvt2; + test_utf8_utf16_cvts (cvt2); - auto cvt_ptr2 = to_unique_ptr (new codecvt_utf8_utf16 ()); - test_utf8_utf16_cvts (*cvt_ptr2); + codecvt_utf8_utf16 cvt3; + 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); + codecvt_utf8 cvt; + 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 99d1a46840e..fbdc7a35b28 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 169504939a2..4fd1bfec63a 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); + codecvt_utf8 cvt; + 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); + codecvt_utf8_utf16 cvt; + 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); + codecvt_utf8 cvt; + test_utf8_ucs2_cvts (cvt); #endif }