From patchwork Fri Nov 17 14:49:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 166250 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp649233vqn; Fri, 17 Nov 2023 08:24:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnXmqStx4qVCP4zyH3O6BNFUXV8FwMs+Th622thQtSeYNZB4jWhSClJ5Hr9tgI792Aigje X-Received: by 2002:ac8:5a46:0:b0:41c:c066:9c0 with SMTP id o6-20020ac85a46000000b0041cc06609c0mr99434qta.5.1700238285070; Fri, 17 Nov 2023 08:24:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700238285; cv=pass; d=google.com; s=arc-20160816; b=wmS0KlyYcgROrG/6qCe6BwykQ5Q0EvzL4QsMNPcYBtj9jkZpprg1/o61uvHaNf2J0I BQjwIAEd/Flm/MA0kPguv/DFXTZMOgrcrWc5E5BYlrUFTfX95PgP95R91qbk3olgx2rC 43APIrzRaDEP4pkonusZF4TZQyREugv5ORawcue28B2wjQznIAUVXyYlQTY+24mGzyFI dN5U2cVspa4CKIczKnlBDkHjH+8Pb6TeWP7nPVhVKN0plrG+vF0hddjT9K4/wSApNU2y v4ufbMynV6tNYYqktglsJRt0t5quY9nKVOIJqDMzJXUun03BaRhDIBBU7UGpdXnwCHRr /+4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=bKhOSHuIT8iLbuwxVizaEeYyEa8yTjajkds2/ipHBsM=; fh=sJ+2/4g29YdyXkoRrFZSpsL2zxijepB7X/1rB0LDDh8=; b=gwbfDUuyyAzfbflYqJY1ozflQrH7JHCit+n/eWMGOxnpWIdu43ogeY3o6z1NTRLg1K lNTQLC3hHMQUMqP8bHKAANKerod6SgJ4j8c4G2XqkNJXucHr67KdV14BJE+Vinxls4dN PX3G66J348OCfN14G1Iq6vW77K4XAqofN4unHRod91IBUokU4C6uOh9mTsIEMslV1PCp pAoJYGJD86EzguiG9fjVVQv1qsm9W03/2BWjbZTzL5iMQjHtzOVvlGIGatGXxzsdYcTE C4fIJ/A+SIF6CGYbxiJW6sF/qnBIIfc/nFweDaMwd/+gGzoaNFlpyYFZFoLecGVs3KkJ /kzQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2gqo402; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id j14-20020ac85c4e000000b0041cc7a308f5si1864217qtj.536.2023.11.17.08.24.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 08:24:45 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F2gqo402; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 711EF3861825 for ; Fri, 17 Nov 2023 14:49:39 +0000 (GMT) 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 21C67385C40F for ; Fri, 17 Nov 2023 14:49:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 21C67385C40F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 21C67385C40F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700232555; cv=none; b=il+xvoGsdEU/wL/blSN2FiXmLO2GyJmLI5V2FWfBO0Ga+oXL6bXHVdxsZ9tjlyk624XDEhJN8y9Rf0Rhp7GoAE8OmAQUPxmHNd/sFQNBKQIqlDppsYfASGZur7DXx0V0Zbb6XoCOLXfOyH3BpoCHrzH/LzvLezzCLuuc6AC/K5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700232555; c=relaxed/simple; bh=ZxBLBKmqV7cFwu7Lvxw9P1IJla5VDkUt2sv8a0HlMR8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YX87bVZ4ZSIsNTR7M56SSa8Y7qmJ2q4E/ZCERel6WumZRpVomtdDUDDfqDxRj8QxNi+g4x9TpYVcMB7TexTPa77TWnz92uXQpMcDE/3JhElldyWWsFBSmRttEIbfuA0aTggrmXq6uoNCuIJdKxrzQa9DDOtosrKL8ZHrTNX4MvA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700232553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bKhOSHuIT8iLbuwxVizaEeYyEa8yTjajkds2/ipHBsM=; b=F2gqo402xeUU5XcvvyC35Gr+KD1yEyBHHJeOKivEt8nkCjlqQXxl07BtWC9XjNo19niBAr HbiF7lOQIr68sUn/GqZ/uvYMABZXT7v9+xe+WMIu05PcpoHasXGIf3fvOVOrtHWqNw1WmQ aEdfAVD62INmWVCpWgapJ7LiMMZkxjE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-329-4fHIXvNlMXmpzT5Hu0VEJQ-1; Fri, 17 Nov 2023 09:49:12 -0500 X-MC-Unique: 4fHIXvNlMXmpzT5Hu0VEJQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D4A5185A785; Fri, 17 Nov 2023 14:49:12 +0000 (UTC) Received: from localhost (unknown [10.42.28.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC1FB5036; Fri, 17 Nov 2023 14:49:11 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Adjust std::in_range template parameter name Date: Fri, 17 Nov 2023 14:49:05 +0000 Message-ID: <20231117144911.1481829-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.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_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782829059835423224 X-GMAIL-MSGID: 1782829059835423224 Tested x86_64-linux. Pushed to trunk. -- >8 -- This is more consistent with the specification in the standard. libstdc++-v3/ChangeLog: * include/std/utility (in_range): Rename _Up parameter to _Res. --- libstdc++-v3/include/std/utility | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility index 18bef7adccd..5d5fcc7da73 100644 --- a/libstdc++-v3/include/std/utility +++ b/libstdc++-v3/include/std/utility @@ -171,22 +171,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION cmp_greater_equal(_Tp __t, _Up __u) noexcept { return !std::cmp_less(__t, __u); } - template + template constexpr bool in_range(_Tp __t) noexcept { - static_assert(__is_standard_integer<_Up>::value); + static_assert(__is_standard_integer<_Res>::value); static_assert(__is_standard_integer<_Tp>::value); using __gnu_cxx::__int_traits; - if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>) - return __int_traits<_Up>::__min <= __t - && __t <= __int_traits<_Up>::__max; + if constexpr (is_signed_v<_Tp> == is_signed_v<_Res>) + return __int_traits<_Res>::__min <= __t + && __t <= __int_traits<_Res>::__max; else if constexpr (is_signed_v<_Tp>) return __t >= 0 - && make_unsigned_t<_Tp>(__t) <= __int_traits<_Up>::__max; + && make_unsigned_t<_Tp>(__t) <= __int_traits<_Res>::__max; else - return __t <= make_unsigned_t<_Up>(__int_traits<_Up>::__max); + return __t <= make_unsigned_t<_Res>(__int_traits<_Res>::__max); } #endif // __cpp_lib_integer_comparison_functions