From patchwork Fri Oct 13 14:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lancelot SIX X-Patchwork-Id: 77666 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 C057238560AA for ; Fri, 13 Oct 2023 14:45:51 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2055.outbound.protection.outlook.com [40.107.212.55]) by sourceware.org (Postfix) with ESMTPS id F133E3855591 for ; Fri, 13 Oct 2023 14:45:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F133E3855591 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-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RZtGCGj/W2uq0wHtKKy24p79r0luAMG3FkoMepPNMriAN2dk3cgre1a5q3UOX7gDpCFIgIdnoVBAzIodHzdUXHBSkVUz3I5YuYpxGz5M2uALrpP06LmvoPEiryEBKIUTPnrmrMVZ949DcJpDemb9aIm1bebWa3zDLLMtQIQjCW5ekMybL2rFfxCJRZWhPxEH9KjnYX2KbzA+xY9N+8lqnT2fEfl2xeRzs4untvBvLTXO9+rSdI7gEKjNWcOyR6r7o2dKyhuYqP8iwV649At0MvicRPo40WEpJ3U5Z0Omr8Vuf/es8NFzjzS5KnbzzBRDWK//0C+AZ9DIrlqJmAkQJw== 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=d6cg6jI5IW/GESbdd3kCMjTxAzQuhX/aW5phA8GQMeg=; b=E9wVdZfBPZKnBQPpplUQSMmnp8GWuOnTknBJZ9VQnM4IYStlzAL7pEsAUCGKxDmEnPibxAxwppBWL/oIL6+ytt9Zf/TKuGQzkouz+A3xUV/Gz/PZnaI/7DAUD1rX9KIXMg2n3c2dlONLzkib09FSIZD+1AuWAntnxE51XipRlOF9N2dYxmIGALKL463+xTpXxbLQZj6mWNLHMiwa9bZy736k62AmRIY4cGOLsvSKHEDd43TaIqcnwaBSC/ZQJUquyBuB+mYud7GmQlBVe4oPdw/c0r07FjPcpeygLGny1BJZDW/yJz2YKFd63e92E684DS3DlgRAcQPxO76UzNeEcA== 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 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=d6cg6jI5IW/GESbdd3kCMjTxAzQuhX/aW5phA8GQMeg=; b=pC+rqoK1G7iewD0011YXiqZeNKeaOtKqQ0lyM4pNakAV2VxeV6Nqxs7sGweCsaddn5LdWYBhiQ43+UUvumhIZCwvqprg2kzhYitwDASs5I8eCiqxcw6oCF57ZSzEjaI9QoqUWryYMi6EwKUUHEiqIZY2O8XEQSTl5czmL+HDx0I= Received: from DM6PR11CA0035.namprd11.prod.outlook.com (2603:10b6:5:190::48) by MW6PR12MB7070.namprd12.prod.outlook.com (2603:10b6:303:238::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.45; Fri, 13 Oct 2023 14:45:00 +0000 Received: from DS1PEPF00017096.namprd05.prod.outlook.com (2603:10b6:5:190:cafe::bd) by DM6PR11CA0035.outlook.office365.com (2603:10b6:5:190::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Fri, 13 Oct 2023 14:45:00 +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 DS1PEPF00017096.mail.protection.outlook.com (10.167.18.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 14:45:00 +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.27; Fri, 13 Oct 2023 09:44:57 -0500 From: Lancelot Six To: CC: Lancelot Six Subject: [PATCH 09/11] gdbsupport: Replace gdb::invoke_result with std::invoke_result Date: Fri, 13 Oct 2023 14:44:16 +0000 Message-ID: <20231013144418.3180617-10-lancelot.six@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013144418.3180617-1-lancelot.six@amd.com> References: <20231013144418.3180617-1-lancelot.six@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017096:EE_|MW6PR12MB7070:EE_ X-MS-Office365-Filtering-Correlation-Id: 190e89fb-ce02-4e55-db79-08dbcbfafa4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sjR4ZBENLupGjVE/l6PBCeQWriyjnv1qv5G5n0yPVtEJp8S2aWY+a2Mvc7+BUHOvnR26Cvivtreuq2K/Pqp7B8ZKK0QFQagHzPhZcuDt1s/u4I5z2uD8ZpXdSk1JZXVC+DC9DTSK82qXkj+OcVdBDNvS5qTbIB53FDuYshdM49R1UDZaDMRhrQZih3FefZaOl3WrDVGgRTHC/qnZ4rkoV2u+xfHOp0kFvKQbNRS/eilYd1HAP+AkvOFjDp0wSZfRkrCUYf+wqocZQEaoyttXOXZj4VJ/oWFoKVB/Gi5N5RGzkanUF/5Nt1iPfxL6gyIunt90zlWNjV+gQKWCQq9AjZ0vralLcUznHy/uYB/lR0mJPzg/XxFKOL9iiMczZg2VohPu6rFBrEhRwr4f66aptjH3ObCae8J33vUUVZQ3dhjLvHoR4rrYdnx6CkPgOel1N4on0JoCjznsmC1DtQ5Faw7Fqw9aQlfWobY2eACO6ptIoz6RR+XSTwI9TXrCjGtNITqa5MfmUaKiT+ZbQlTojxxXqwN0DSLevPfR91iLRVlOHXOzUI4PwvIQhKYi9LnvSsqfnc/4jYXSUnT4ZeMCZDyuQ8N/oo5DDqW6trW4rD5/2eZJYVrO5fTXNHgnOBlHe1X5GYPhcp1llmRo2loTweTGzmpR/t7ORaqR6fInta4p7BRNxdL8ZJplSCEpU+OWKnWIJkYIqqgU3Xfp5M3KLZATFX0eNgqeWdjYRuKcEChj350yijm1uFbz33OnpXZVm25UuJ3bXKOw2opTYORGeQ== 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)(396003)(136003)(39860400002)(376002)(230922051799003)(64100799003)(186009)(451199024)(82310400011)(1800799009)(36840700001)(46966006)(40470700004)(8936002)(8676002)(4326008)(5660300002)(44832011)(6916009)(40480700001)(70206006)(70586007)(41300700001)(316002)(40460700003)(47076005)(81166007)(356005)(82740400003)(1076003)(36756003)(336012)(16526019)(26005)(426003)(2616005)(86362001)(6666004)(478600001)(2906002)(83380400001)(7696005)(36860700001)(2004002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 14:45:00.3944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 190e89fb-ce02-4e55-db79-08dbcbfafa4d 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: DS1PEPF00017096.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7070 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 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 --- 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; }