From patchwork Fri Oct 1 19:43:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1535526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=uTtRZrPT; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HLh4L3zm6z9t10 for ; Sat, 2 Oct 2021 06:08:02 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6FE193858013 for ; Fri, 1 Oct 2021 20:07:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6FE193858013 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633118879; bh=WEmlDBpQIBm6yzt8bQgE5yNAVSvbq0aodvuqk3rXWVE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=uTtRZrPT4JwslrfzHffQ4h2O4Zq1KlgZiLsv8fKs4H5MsXLlTgL1LKQ+RUa3pSbt9 Pdr+vujVwaBfLFnsHa2rIlvLBLYfIL6Mjl+TTX8TjUrV1TqCtktxyJ6EWEX736Z9VN VIN06CDX7vpyXHQapiSAB02KCTW78UVsPjFoI7b4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 244503858024 for ; Fri, 1 Oct 2021 19:43:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 244503858024 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-wkStmBWrPtq8UrNSdujSPQ-1; Fri, 01 Oct 2021 15:43:16 -0400 X-MC-Unique: wkStmBWrPtq8UrNSdujSPQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8977A36308; Fri, 1 Oct 2021 19:43:15 +0000 (UTC) Received: from localhost (unknown [10.33.36.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 374D419C59; Fri, 1 Oct 2021 19:43:15 +0000 (UTC) Date: Fri, 1 Oct 2021 20:43:14 +0100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove useless base classes in pb_db tests Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" These function objects do not need to be adaptable, so stop deriving from deprecated classes. Also the 'inline' keyword is redundant on member functions defined in the class body. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/ext/pb_ds/example/basic_multimap.cc: Remove unnecesary derivation from std::unary_function. * testsuite/ext/pb_ds/example/erase_if.cc: Likewise. * testsuite/ext/pb_ds/example/hash_illegal_resize.cc: Likewise. * testsuite/ext/pb_ds/example/hash_initial_size.cc: Likewise. * testsuite/ext/pb_ds/example/hash_load_set_change.cc: Likewise. * testsuite/ext/pb_ds/example/hash_mod.cc: Likewise. * testsuite/ext/pb_ds/example/hash_resize.cc: Likewise. * testsuite/ext/pb_ds/example/hash_shift_mask.cc: Likewise. * testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc: Likewise. * testsuite/ext/pb_ds/example/ranged_hash.cc: Likewise. * testsuite/ext/pb_ds/example/store_hash.cc: Likewise. Tested powerpc64le-linux. Committed to trunk. commit e3869a48fc2e5fbb9e8eb7058e5176446479673f Author: Jonathan Wakely Date: Mon May 24 18:27:16 2021 libstdc++: Remove useless base classes in pb_db tests These function objects do not need to be adaptable, so stop deriving from deprecated classes. Also the 'inline' keyword is redundant on member functions defined in the class body. Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * testsuite/ext/pb_ds/example/basic_multimap.cc: Remove unnecesary derivation from std::unary_function. * testsuite/ext/pb_ds/example/erase_if.cc: Likewise. * testsuite/ext/pb_ds/example/hash_illegal_resize.cc: Likewise. * testsuite/ext/pb_ds/example/hash_initial_size.cc: Likewise. * testsuite/ext/pb_ds/example/hash_load_set_change.cc: Likewise. * testsuite/ext/pb_ds/example/hash_mod.cc: Likewise. * testsuite/ext/pb_ds/example/hash_resize.cc: Likewise. * testsuite/ext/pb_ds/example/hash_shift_mask.cc: Likewise. * testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc: Likewise. * testsuite/ext/pb_ds/example/ranged_hash.cc: Likewise. * testsuite/ext/pb_ds/example/store_hash.cc: Likewise. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc index 1d0b49146b9..143f3ee62e3 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc @@ -51,9 +51,9 @@ using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet // standard everywhere. -struct string_hash : public unary_function +struct string_hash { - inline size_t + size_t operator()(const string& r_s) const { size_t ret = 0; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc index 74ed84676ed..bb8e9c494a5 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc @@ -48,7 +48,7 @@ using namespace __gnu_pbds; // The following functor takes a map's value-type object and returns // whether its key is between two numbers. -struct between : public unary_function, bool> +struct between { // Constructor taking two numbers determining a range. between(int b, int e) : m_b(b), m_e(e) @@ -56,7 +56,7 @@ struct between : public unary_function, bool> // Operator determining whether a value-type object's key is within // the range. - inline bool + bool operator()(const pair& r_val) { return r_val.first >= m_b&& r_val.first < m_e; } diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc index d045b40654a..73eda50374c 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc @@ -62,9 +62,9 @@ using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet // standard everywhere. -struct int_hash : public unary_function +struct int_hash { - inline size_t + size_t operator()(const int& r_i) const { return r_i; } }; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc index 0fe99d291ee..a69c9c99bd8 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc @@ -49,9 +49,9 @@ using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet // standard everywhere. -struct int_hash : public unary_function +struct int_hash { - inline size_t + size_t operator()(const int& r_i) const { return r_i; } }; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc index 976291fce3f..8f7ed2767db 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc @@ -51,9 +51,9 @@ using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet // standard everywhere. -struct int_hash : public unary_function +struct int_hash { - inline size_t + size_t operator()(int i) const { return i; } }; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc index f57a6ad8bd3..d42e6d87c98 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc @@ -49,9 +49,9 @@ using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet // standard everywhere. -struct int_hash : public unary_function +struct int_hash { - inline size_t + size_t operator()(int i) const { return i; } }; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc index 53c5e26c9b6..f8e4a7b8f9c 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc @@ -50,9 +50,9 @@ using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet // standard everywhere. -struct int_hash : public unary_function +struct int_hash { - inline size_t + size_t operator()(const int& r_i) const { return r_i; } }; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc index 19fb3d32cc0..0ea02dadc44 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc @@ -51,9 +51,9 @@ using namespace __gnu_pbds; // A simple hash functor. hash could serve instead of this functor, // but it is not yet standard everywhere. -struct simple_int_hash : public unary_function +struct simple_int_hash { - inline size_t + size_t operator()(int i) const { return i; } }; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc index 1910e2c35e1..d99ebff7010 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc @@ -61,9 +61,9 @@ using namespace __gnu_pbds; typedef std::pair pq_value; // Comparison functor used to compare priority-queue value types. -struct pq_value_cmp : public binary_function +struct pq_value_cmp { - inline bool + bool operator()(const pq_value& r_lhs, const pq_value& r_rhs) const { // Note that a value is considered smaller than a different value diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc index a5b1898fed7..86c37d41ecc 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc @@ -60,7 +60,6 @@ using namespace __gnu_pbds; * for larger sizes it uses a more complicated hash function. */ class simple_string_ranged_hash_fn - : public unary_function { public: typedef size_t size_type; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc index 0bf6b06059b..5dd9cb7c36c 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc @@ -53,9 +53,9 @@ using namespace std; using namespace __gnu_pbds; // A string hash functor. -struct string_hash : public unary_function +struct string_hash { - inline size_t + size_t operator()(string str) const { string::const_iterator b = str.begin();