From patchwork Thu May 25 23:17:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 99242 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp105941vqr; Thu, 25 May 2023 16:19:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ctlddc7sEVtEg3MdYF83z5bCnz4ESH1t7aQW26Od1Vk+ROPbwQUN+iEEGpvRfr7tNvcaj X-Received: by 2002:a17:906:5d0e:b0:94f:9acc:65c9 with SMTP id g14-20020a1709065d0e00b0094f9acc65c9mr333140ejt.66.1685056754873; Thu, 25 May 2023 16:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685056754; cv=none; d=google.com; s=arc-20160816; b=OWUWMqOmfvdKszvvDydRhXpLaNDjJm+tX5A/geQ1U2g7yUrYUNbVkuVSAlgtLUnfV8 jzdcSNdue4OIXOxSAINWiUdaRA4VNzYf/zcE8ndAHWeP5L0mjBZoXEzJ7N9mt8Cqv62O F1DDQBb341baVD5UW/vR+44gToNURI9NUV5i/Z9Ms9Uip6G11N1RjmotwE7tPRXpIrHv DnE8bXCmSAGV7vOXRfb60DUS9pNFnW/rJNI0jCmKL+ZfIiDfxaH1sg49JlOpiFxgPGmG voimAzfWvEMXbzocQTiRRqMa4gly7oJKMQHLW1FOZhADuQhECnKGjX2aOUlv/CJmhmYn 0zyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=5L7Yt6Si8DMgz+1lz8rTs6qhywdbOpMl1A1TpUv+blA=; b=EoV0fVVte7low0LNADNCThHJfZ7S6fZ3wMXuaWy3NwGL2gDu5kcX75txucWofb3l1n dGMsXp4TvHP8OOrfs5JP8lXvTRGbWf5OMWDqZZxWbrJS5owgOlTPLhH4gZwS4wK53Ymx 5ZrDQZ9cYIYFi2hSwMq7sZIiiYwONLWCTLRXyEXfKxzhRA2kEY+ppRAbeQUA+8SS6kG4 8dDpYlG2zlq7XYyR/AHm/XibOvxciE53a59gzEPr618Iq/uD+DnTZ3XxYLxAg46/iCm9 e0D+/E4i2xqoh11fcCdBF+2BWmIkEevbUofSdn2DnZfxb4330S2yq0LURCkn8wQPSfyg rMhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=iuoL2V1F; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d5-20020a170906174500b0094f3b83a4bfsi605383eje.177.2023.05.25.16.19.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 16:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=iuoL2V1F; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 57F31388200E for ; Thu, 25 May 2023 23:18:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 57F31388200E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685056700; bh=5L7Yt6Si8DMgz+1lz8rTs6qhywdbOpMl1A1TpUv+blA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=iuoL2V1FnqFFb2R4Uli304KT7LyqmM6ONOO84v8Ml5pdbflxxdWh2achu2EdzaWpy fEhS6qzf2OFWkHBt8sCP2/nNGY2YlT1iGV2D+3XK2Oy8i1V0K7p1UVRNBLwV+sVqr0 FUD2rKfFIXyu6ArlXYu2eDMR5ZwsUWsCY07hsJFk= 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 ESMTPS id 646823858289 for ; Thu, 25 May 2023 23:17:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 646823858289 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-510-QvawiYWcOo2DuqgmZqDspg-1; Thu, 25 May 2023 19:17:29 -0400 X-MC-Unique: QvawiYWcOo2DuqgmZqDspg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32C9229AA39B; Thu, 25 May 2023 23:17:29 +0000 (UTC) Received: from localhost (unknown [10.42.28.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBFC51121314; Thu, 25 May 2023 23:17:28 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Add relational operators to __gnu_test::PointerBase Date: Fri, 26 May 2023 00:17:28 +0100 Message-Id: <20230525231728.3306360-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.1 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_NONE, SPF_HELO_NONE, 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: 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766910071916352222?= X-GMAIL-MSGID: =?utf-8?q?1766910071916352222?= Tested x86_64-linux. Pushed to trunk. -- >8 -- The Cpp17Allocator requirements say that an allocator's pointer and const_pointer types must meet the Cpp17RandomAccessIterator requirements. That means our PointerBase helper for defining fancy pointer types should support the full set of relational operators. libstdc++-v3/ChangeLog: * testsuite/util/testsuite_allocator.h (PointerBase): Add relational operators. --- libstdc++-v3/testsuite/util/testsuite_allocator.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index 9108ee40821..70dacb3fdf2 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -719,6 +719,15 @@ namespace __gnu_test friend std::ptrdiff_t operator-(PointerBase l, PointerBase r) { return l.value - r.value; } + friend bool operator<(PointerBase l, PointerBase r) + { return l.value < r.value; } + friend bool operator>(PointerBase l, PointerBase r) + { return l.value > r.value; } + friend bool operator<=(PointerBase l, PointerBase r) + { return l.value <= r.value; } + friend bool operator>=(PointerBase l, PointerBase r) + { return l.value >= r.value; } + Derived& derived() { return static_cast(*this); }