From patchwork Wed Oct 30 15:47:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1186836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-512080-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="ai/F4n0+"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="JtMOdnNE"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 473CXK4Xycz9sPd for ; Thu, 31 Oct 2019 02:48:01 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=nJcHMkeo4VHDsdyqjhrQBZC+z5OlSJVvZ2fUW5EBRNr3fIjfA9gd1 HP+jemFIBFt4ifI4PEwlUXfZl6mQwldHkZeXPZVz4gHk6BnfIeYmjeoLIIo+ytps VRZwZkTCzm3NRb5fw6M6G9WP0jp5HxI4WzUWjg1hCRG6NwZFSoD4D4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=hj/P5ie/V3LgSa069CBysQIlIPE=; b=ai/F4n0+MX7NETaN9dQ/ sLbUtb38JejDv41e2FepWMm5MwCvHeWoHQK+OSfA2DWPMhDA6b+9rrJdUHpJZ2d9 GBbK4p8xSan6m/d7Ec0iqJ1GLR9DH61McidpgKvsruAuN/+1qAbkboR/ElOD8Jkn FgYql/q6wkn3Qy5VONEX5Kk= Received: (qmail 7875 invoked by alias); 30 Oct 2019 15:47:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 7806 invoked by uid 89); 30 Oct 2019 15:47:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=qualify, 2318 X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.61) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Oct 2019 15:47:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572450462; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=K70ziAPVXx6Pw/bs8ADfa+JshFzAJeinT33zxRQM07c=; b=JtMOdnNEz+k3tepfIGW7XILZAXamzhp/H8jscie6ObbBlW9CjI7iojY4GBC+gGgrHnvP3r e9ynU0U8898PpOzCHwyJHqlZ77sDkrqQFTX9O2Xdaqwf75z24d/ZSgsJ2Xafot4tJ9uroz fSKtdbKhH0nc7OkyPF/w8zuGIgxEa5c= 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-6-ijM2wxDtO9WGFBLlMr126A-1; Wed, 30 Oct 2019 11:47:37 -0400 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 56D24107ACC0; Wed, 30 Oct 2019 15:47:36 +0000 (UTC) Received: from localhost (unknown [10.33.36.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2B9919488; Wed, 30 Oct 2019 15:47:35 +0000 (UTC) Date: Wed, 30 Oct 2019 15:47:35 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Remove some more using-declarations from namespace __gnu_cxx Message-ID: <20191030154735.GA1202@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.12.1 (2019-06-15) X-Mimecast-Spam-Score: 0 Content-Disposition: inline Similar to some recent patches, this removes using-declarations for names from namespace std, so that they are not redeclared in __gnu_cxx. * include/bits/stl_iterator.h (namespace __gnu_cxx): Remove using-declarations for std::iterator and std::iterator_traits. (__gnu_cxx::__normal_iterator): Qualify iterator_traits. * include/ext/algorithm (namespace __gnu_cxx): Remove using-declarations for std names and qualify those names when used. Also refer to std::min in parentheses to protect against function-like macros. * include/ext/rc_string_base.h: Qualify iterator_traits. * include/ext/sso_string_base.h: Qualify iterator_traits. Tested powerpc64le-linux, committed to trunk. commit 0c978d0446b42573a5201b3b5f1b6b9f42160133 Author: Jonathan Wakely Date: Wed Oct 30 15:31:25 2019 +0000 Remove some more using-declarations from namespace __gnu_cxx Similar to some recent patches, this removes using-declarations for names from namespace std, so that they are not redeclared in __gnu_cxx. * include/bits/stl_iterator.h (namespace __gnu_cxx): Remove using-declarations for std::iterator and std::iterator_traits. (__gnu_cxx::__normal_iterator): Qualify iterator_traits. * include/ext/algorithm (namespace __gnu_cxx): Remove using-declarations for std names and qualify those names when used. Also refer to std::min in parentheses to protect against function-like macros. * include/ext/rc_string_base.h: Qualify iterator_traits. * include/ext/sso_string_base.h: Qualify iterator_traits. diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 2a3b0231079..ecc06178c34 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -793,15 +793,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // The _Container parameter exists solely so that different containers // using this template can instantiate different types, even if the // _Iterator parameter is the same. - using std::iterator_traits; - using std::iterator; template class __normal_iterator { protected: _Iterator _M_current; - typedef iterator_traits<_Iterator> __traits_type; + typedef std::iterator_traits<_Iterator> __traits_type; public: typedef _Iterator iterator_type; diff --git a/libstdc++-v3/include/ext/algorithm b/libstdc++-v3/include/ext/algorithm index 2970b7d8dfe..ec244d91860 100644 --- a/libstdc++-v3/include/ext/algorithm +++ b/libstdc++-v3/include/ext/algorithm @@ -64,21 +64,14 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - using std::ptrdiff_t; - using std::min; - using std::pair; - using std::input_iterator_tag; - using std::random_access_iterator_tag; - using std::iterator_traits; - //-------------------------------------------------- // copy_n (not part of the C++ standard) template - pair<_InputIterator, _OutputIterator> + std::pair<_InputIterator, _OutputIterator> __copy_n(_InputIterator __first, _Size __count, _OutputIterator __result, - input_iterator_tag) + std::input_iterator_tag) { for ( ; __count > 0; --__count) { @@ -86,17 +79,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ++__first; ++__result; } - return pair<_InputIterator, _OutputIterator>(__first, __result); + return std::pair<_InputIterator, _OutputIterator>(__first, __result); } template - inline pair<_RAIterator, _OutputIterator> + inline std::pair<_RAIterator, _OutputIterator> __copy_n(_RAIterator __first, _Size __count, _OutputIterator __result, - random_access_iterator_tag) + std::random_access_iterator_tag) { _RAIterator __last = __first + __count; - return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first, + return std::pair<_RAIterator, _OutputIterator>(__last, std::copy(__first, __last, __result)); } @@ -116,13 +109,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @ingroup SGIextensions */ template - inline pair<_InputIterator, _OutputIterator> + inline std::pair<_InputIterator, _OutputIterator> copy_n(_InputIterator __first, _Size __count, _OutputIterator __result) { // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_InputIterator>::value_type>) + typename std::iterator_traits<_InputIterator>::value_type>) return __gnu_cxx::__copy_n(__first, __count, __result, std::__iterator_category(__first)); @@ -156,10 +149,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const unsigned char* __first2, const unsigned char* __last2) { - const ptrdiff_t __len1 = __last1 - __first1; - const ptrdiff_t __len2 = __last2 - __first2; + const std::ptrdiff_t __len1 = __last1 - __first1; + const std::ptrdiff_t __len2 = __last2 - __first2; const int __result = __builtin_memcmp(__first1, __first2, - min(__len1, __len2)); + (std::min)(__len1, __len2)); return __result != 0 ? __result : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); } @@ -207,9 +200,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>) __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_InputIterator1>::value_type>) + typename std::iterator_traits<_InputIterator1>::value_type>) __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_InputIterator2>::value_type>) + typename std::iterator_traits<_InputIterator2>::value_type>) __glibcxx_requires_valid_range(__first1, __last1); __glibcxx_requires_valid_range(__first2, __last2); @@ -228,7 +221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_EqualityComparableConcept< - typename iterator_traits<_InputIterator>::value_type >) + typename std::iterator_traits<_InputIterator>::value_type >) __glibcxx_function_requires(_EqualityComparableConcept<_Tp>) __glibcxx_requires_valid_range(__first, __last); @@ -246,7 +239,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // concept requirements __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate, - typename iterator_traits<_InputIterator>::value_type>) + typename std::iterator_traits<_InputIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); for ( ; __first != __last; ++__first) @@ -270,11 +263,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_ForwardIterator>::value_type>) + typename std::iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); _Distance __remaining = std::distance(__first, __last); - _Distance __m = min(__n, __remaining); + _Distance __m = (std::min)(__n, __remaining); while (__m > 0) { @@ -305,13 +298,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, - typename iterator_traits<_ForwardIterator>::value_type>) + typename std::iterator_traits<_ForwardIterator>::value_type>) __glibcxx_function_requires(_UnaryFunctionConcept< _RandomNumberGenerator, _Distance, _Distance>) __glibcxx_requires_valid_range(__first, __last); _Distance __remaining = std::distance(__first, __last); - _Distance __m = min(__n, __remaining); + _Distance __m = (std::min)(__n, __remaining); while (__m > 0) { @@ -441,7 +434,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_RandomAccessIterator>::value_type>) + typename std::iterator_traits<_RandomAccessIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__is_heap(__first, __last - __first); @@ -461,8 +454,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __glibcxx_function_requires(_RandomAccessIteratorConcept< _RandomAccessIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, - typename iterator_traits<_RandomAccessIterator>::value_type, - typename iterator_traits<_RandomAccessIterator>::value_type>) + typename std::iterator_traits<_RandomAccessIterator>::value_type, + typename std::iterator_traits<_RandomAccessIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); return std::__is_heap(__first, __comp, __last - __first); @@ -488,7 +481,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_LessThanComparableConcept< - typename iterator_traits<_ForwardIterator>::value_type>) + typename std::iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) @@ -514,8 +507,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // concept requirements __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, - typename iterator_traits<_ForwardIterator>::value_type, - typename iterator_traits<_ForwardIterator>::value_type>) + typename std::iterator_traits<_ForwardIterator>::value_type, + typename std::iterator_traits<_ForwardIterator>::value_type>) __glibcxx_requires_valid_range(__first, __last); if (__first == __last) diff --git a/libstdc++-v3/include/ext/rc_string_base.h b/libstdc++-v3/include/ext/rc_string_base.h index 2cf5fb0c5e3..3a902d6a18a 100644 --- a/libstdc++-v3/include/ext/rc_string_base.h +++ b/libstdc++-v3/include/ext/rc_string_base.h @@ -231,7 +231,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _S_construct_aux(_InIterator __beg, _InIterator __end, const _Alloc& __a, std::__false_type) { - typedef typename iterator_traits<_InIterator>::iterator_category _Tag; + typedef typename std::iterator_traits<_InIterator>::iterator_category + _Tag; return _S_construct(__beg, __end, __a, _Tag()); } diff --git a/libstdc++-v3/include/ext/sso_string_base.h b/libstdc++-v3/include/ext/sso_string_base.h index e86d81011dd..eacf55702c4 100644 --- a/libstdc++-v3/include/ext/sso_string_base.h +++ b/libstdc++-v3/include/ext/sso_string_base.h @@ -98,7 +98,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_construct_aux(_InIterator __beg, _InIterator __end, std::__false_type) { - typedef typename iterator_traits<_InIterator>::iterator_category _Tag; + typedef typename std::iterator_traits<_InIterator>::iterator_category + _Tag; _M_construct(__beg, __end, _Tag()); }