From patchwork Tue Nov 21 12:04:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lancelot SIX X-Patchwork-Id: 80465 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 125F638582A5 for ; Tue, 21 Nov 2023 12:07:18 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by sourceware.org (Postfix) with ESMTPS id 7F366385829E for ; Tue, 21 Nov 2023 12:05:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F366385829E Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7F366385829E Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.236.40 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1700568361; cv=pass; b=rOYkSEOoIG2Uw8Vbxa07W0IZ/M94KyJOHZ0Eip1Bu82Rsptzloo/dfqKa22vFX9hX5oLxL9QdliaSrETn1liZOHFxIEtoz5iEhpm5eRtSztm0Ydjd7xHsp8AZe5IjY2eCG2fd5/QaCFZhcNe6mVOLTPQxFo5TLT3w33S7kHrKiY= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1700568361; c=relaxed/simple; bh=37EO+zlc3jA5I15IDu0xMceQ5NVCqvHOqOVVH7M0i/8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=GDw087jn5vYcsvr1oxRgl0YUTbTsueSVJ9/9pKS/qOTHNbbaYUO2HbwdeKeU3sQ0k4HMLf/5k9i8DX7anxYS0hOp+ysbqC7/jHre1kwGkh2svm/QOV+ndE4axDy490ux6dhA+dvTOt23xkMNYqq5jhOIDDeY69cKJh+s/fbsPPA= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WaA/nNYDQDYu5RAvRxE7Q7BSKyFUzSX476yPLy5vYu2EMwf5mGWSbXuPOrMRVZFIyzbXgS18TlaJWjkNfqjyCmKyd0bv1mMJN3g+Wtyui0DTXYDmef4/JebSECH6mmN2BFAhKNX/mMyFmADrEjFymQzXkmIymd16bPN+Yb5Pbi1Vc4Pbvb0orYH5z2E6NtesWEleA1Jq3h9JWrOKyzJyH/gqDGTArVqxBkUbAoJurA2iYy3hkfGN6svejpP1eMf0PvnG9gvVWkJLZqg4r+cx6EFDT7HVz2h6Xtd1rjhd2YWeOHFxwBpHwq38iP2/FnrljZ+NXJFyV6xZQwVW8Ww8ug== 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=RHNJ4lKVt8jP4lLqkUBPVGTE7AFIYnrUi2fPh+DonS8=; b=duJIe0y+QjHNs5MDR3ONanOu0ZBWn6Ym0cCjqngOMEmrKF7pld/gvrGNB1F7i7FQIk3O0Fzl7eeJuSs4iQXsls3HRYTieCfA2wwhUmFSExsG6Xt8/PgS3P16iWBsK+mu13I7HxOeEymZqohZaInq9fWgWeWOkdW/ax/KNe65gPha0PYKEa0kXe9nwlZJ+n8+BzfJQxEVmVNV5xgB4tsK4ZDF97fzx6eKUfGfodhisvWYz/Bu2TixGinO7j1IsLmg8rMTBtBt3LyIDpztzX1tHKum/sk++r8kH45Rh/LuOPAVu/wB3+HOxAVN9hzWwFc2Z7IKLTAHyzPlpQmnTHHrhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=sourceware.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RHNJ4lKVt8jP4lLqkUBPVGTE7AFIYnrUi2fPh+DonS8=; b=iKzGA237bJ18MQjce4QwZHDN8U94HEq2rKvZ1c0DX+KDbT5SW7iuBnHxrQXv/Nm814U6G0i+SXMuwPIJ+n6vnPgFgGbtPL8xTWDnbryeM+qGP15Af2KNeS5pNdSyGldQgS0qJUQ6heczcu+aNEciEDTPb5vhtWEbVl7VvwWdRso= Received: from BL1PR13CA0265.namprd13.prod.outlook.com (2603:10b6:208:2ba::30) by MW3PR12MB4539.namprd12.prod.outlook.com (2603:10b6:303:59::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.18; Tue, 21 Nov 2023 12:05:55 +0000 Received: from MN1PEPF0000F0E2.namprd04.prod.outlook.com (2603:10b6:208:2ba:cafe::c8) by BL1PR13CA0265.outlook.office365.com (2603:10b6:208:2ba::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.17 via Frontend Transport; Tue, 21 Nov 2023 12:05:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000F0E2.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.12 via Frontend Transport; Tue, 21 Nov 2023 12:05:54 +0000 Received: from hpe6u-23.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 21 Nov 2023 06:05:52 -0600 From: Lancelot Six To: CC: , , Lancelot Six Subject: [COMMITTED PATCH v2 7/9] gdbsupport: Replace gdb::invoke_result with std::invoke_result Date: Tue, 21 Nov 2023 12:04:58 +0000 Message-ID: <20231121120500.1394523-8-lancelot.six@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231028204821.fp5hh7bahrmrnpjl@hpe6u-23> References: <20231028204821.fp5hh7bahrmrnpjl@hpe6u-23> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E2:EE_|MW3PR12MB4539:EE_ X-MS-Office365-Filtering-Correlation-Id: b819083a-3bef-4740-3fed-08dbea8a36a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: agFdbnf5XPHfF2V8RV+8cNFT/xrELtBpLbjRpIFn8rvLUWd7QUN1y/h5LGDA9led0ZPdygmI8wT7fZIhakYbNV+TFgDnPCu401h6zh6Ri91YHyYuUjg+ZZoH9i37L7JPOTjBTOLcPXztHFoMtaCGbHS3mr7VJn5Ub8BphfeRUYRkJ6S4nQSrLYIW+sMQ9QBMHC4zjDs9SY2z6NFzIrL+DLnwzUCWQppAmuoXI5j+5iFnanWeKZb9VPbCNz8HKs76LW4qxnLdOhoXc4Tf5FFOELIlFMj5c4vdPrb+SlyzlOppIe7eYwdmhqvDuqQmv7ixoRht1911z0RC2SvmyXTS87gjv/q03vq20GlBxR5SSMKOgM4P1mqR2S3y1en2Xrad9DipPopWQi7LJP/lyyVAqAWSmsPUTTU7zrpCMP3Izsb3AXBqM/9vGax7tysWbi3Xtca4sWyK5mQR+7pSWE7QyzldFvGY4jby7HadVgQhV+JHs2ZqHg2dOvEa/MJcti705OUkX29mLqCd57OEUQGUOPe7QclladSHHYqFdITxL3SPRX3Y1x+31tfm0f40PwfYDCMRdINbjOBHV7xIwaSk82f2q8q6WKr23Oe/IKmgnQymyzIvmBaShllx/p2yj6Hq65ioPdju55KOZ8A/G2YYWfGZjvlzwKuyvZTh6LpdKpUkSs63yIhF+pCL3fbUCXwNrjFiJLw+lVCGH0bC8rNQVRMy8FghCu/7T+l/93o/9JMNxda+DUeEsuaaCeexJJrlIOcNyhzWL9NdSI5CKSxJ6hjx/2DV/9crU72Y5i341SM= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(136003)(376002)(396003)(39860400002)(230922051799003)(82310400011)(1800799012)(64100799003)(186009)(451199024)(46966006)(40470700004)(36840700001)(44832011)(40480700001)(5660300002)(8676002)(4326008)(41300700001)(8936002)(2906002)(70586007)(70206006)(316002)(6916009)(54906003)(40460700003)(47076005)(86362001)(478600001)(26005)(16526019)(1076003)(36756003)(7696005)(2616005)(336012)(426003)(356005)(81166007)(83380400001)(36860700001)(82740400003)(2004002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Nov 2023 12:05:54.5512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b819083a-3bef-4740-3fed-08dbea8a36a1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4539 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Given that GDB now requires C++17, we can replace gdb::invoke_result with std::invoke_result which is provided by . This patch also removes gdbsupport/invoke-result.h as it is not used anymore. Change-Id: I7e567356d38d6b3d85d8797d61cfc83f6f933f22 Approved-By: Tom Tromey Approved-By: Pedro Alves --- gdbsupport/filtered-iterator.h | 4 ++-- gdbsupport/function-view.h | 4 ++-- gdbsupport/invoke-result.h | 37 ---------------------------------- gdbsupport/parallel-for.h | 9 ++++----- gdbsupport/safe-iterator.h | 4 ++-- 5 files changed, 10 insertions(+), 48 deletions(-) delete mode 100644 gdbsupport/invoke-result.h diff --git a/gdbsupport/filtered-iterator.h b/gdbsupport/filtered-iterator.h index 9e9548ef824..aa3366942d1 100644 --- a/gdbsupport/filtered-iterator.h +++ b/gdbsupport/filtered-iterator.h @@ -19,7 +19,7 @@ #ifndef COMMON_FILTERED_ITERATOR_H #define COMMON_FILTERED_ITERATOR_H -#include "gdbsupport/invoke-result.h" +#include /* A filtered iterator. This wraps BaseIterator and automatically skips elements that FilterFunc filters out. Requires that @@ -56,7 +56,7 @@ class filtered_iterator : filtered_iterator (static_cast (other)) {} - typename gdb::invoke_result::type operator* () const { return *m_it; } diff --git a/gdbsupport/function-view.h b/gdbsupport/function-view.h index cd62d40fd5e..ed113c74cfd 100644 --- a/gdbsupport/function-view.h +++ b/gdbsupport/function-view.h @@ -192,7 +192,7 @@ You can find unit tests covering the whole API in unittests/function-view-selftests.c. */ -#include "invoke-result.h" +#include namespace gdb { namespace fv_detail { @@ -230,7 +230,7 @@ class function_view /* True if Func can be called with Args, and either the result is Res, convertible to Res or Res is void. */ template::type> + typename Res2 = typename std::invoke_result::type> struct IsCompatibleCallable : CompatibleReturnType {}; diff --git a/gdbsupport/invoke-result.h b/gdbsupport/invoke-result.h deleted file mode 100644 index c9bb55e5b08..00000000000 --- a/gdbsupport/invoke-result.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Compatibility wrapper around std::result_of and std::invoke_result. - - Copyright (C) 2022-2023 Free Software Foundation, Inc. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -#ifndef GDBSUPPORT_INVOKE_RESULT_H -#define GDBSUPPORT_INVOKE_RESULT_H - -#include - -namespace gdb -{ -#if __cplusplus >= 201703L -template -using invoke_result = std::invoke_result; -#else -template -using invoke_result = std::result_of; -#endif - -} /* namespace gdb */ - -#endif /* GDBSUPPORT_INVOKE_RESULT_H */ diff --git a/gdbsupport/parallel-for.h b/gdbsupport/parallel-for.h index b57f7ea97e1..ee7bfd948e2 100644 --- a/gdbsupport/parallel-for.h +++ b/gdbsupport/parallel-for.h @@ -22,7 +22,6 @@ #include #include -#include "gdbsupport/invoke-result.h" #include "gdbsupport/thread-pool.h" #include "gdbsupport/function-view.h" @@ -145,14 +144,14 @@ struct par_for_accumulator template typename gdb::detail::par_for_accumulator< - typename gdb::invoke_result::type + typename std::invoke_result::type >::result_type parallel_for_each (unsigned n, RandomIt first, RandomIt last, RangeFunction callback, gdb::function_view task_size = nullptr) { using result_type - = typename gdb::invoke_result::type; + = typename std::invoke_result::type; /* If enabled, print debug info about how the work is distributed across the threads. */ @@ -305,13 +304,13 @@ parallel_for_each (unsigned n, RandomIt first, RandomIt last, template typename gdb::detail::par_for_accumulator< - typename gdb::invoke_result::type + typename std::invoke_result::type >::result_type sequential_for_each (unsigned n, RandomIt first, RandomIt last, RangeFunction callback, gdb::function_view task_size = nullptr) { - using result_type = typename gdb::invoke_result::type; + using result_type = typename std::invoke_result::type; gdb::detail::par_for_accumulator results (0); diff --git a/gdbsupport/safe-iterator.h b/gdbsupport/safe-iterator.h index ccd772ca2a5..b4891328f1a 100644 --- a/gdbsupport/safe-iterator.h +++ b/gdbsupport/safe-iterator.h @@ -19,7 +19,7 @@ #ifndef COMMON_SAFE_ITERATOR_H #define COMMON_SAFE_ITERATOR_H -#include "gdbsupport/invoke-result.h" +#include /* A forward iterator that wraps Iterator, such that when iterating with iterator IT, it is possible to delete *IT without invalidating @@ -77,7 +77,7 @@ class basic_safe_iterator basic_safe_iterator () {} - typename gdb::invoke_result::type + typename std::invoke_result::type operator* () const { return *m_it; }