From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2066) id DCFBC3951C87; Tue, 12 May 2020 07:18:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCFBC3951C87 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589267935; bh=g6iVVmuvIkseNnU0R7hAPQYfRTmIkrAQnmParWf1Mg8=; h=From:To:Subject:Date:From; b=MZku/oydiH+2mFLVaQePxOgDePlQktlSUkq+EKG16NxrNv/cobkVjH3NZkXODTXoh mGc9E4iN2J+kanifFN1aj99gtaud4UIdbIYOvXebVjnLWuqWjb9SJGS9pu7Zo2s4Zj j69WThU1P5jtuCKcaYp5lGufhFFhRwOgTxtUNIOc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jiu Fu Guo To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/guojiufu/heads/personal-branch)] libstdc++: Replace reserved identifier _T with _Tp (PR 94901) X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/users/guojiufu/heads/personal-branch X-Git-Oldrev: 7eee6d219617123a94cf0872821b1f78c2a9b8f1 X-Git-Newrev: 070b4df8a06539b661c134d436ea4207099fdcf0 Message-Id: <20200512071855.DCFBC3951C87@sourceware.org> Date: Tue, 12 May 2020 07:18:55 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2020 07:18:56 -0000 https://gcc.gnu.org/g:070b4df8a06539b661c134d436ea4207099fdcf0 commit 070b4df8a06539b661c134d436ea4207099fdcf0 Author: Jonathan Wakely Date: Fri May 1 13:13:39 2020 +0100 libstdc++: Replace reserved identifier _T with _Tp (PR 94901) The libstdc++ manual documents that _T can not be used, because it's a macro in system headers on some targets. PR libstdc++/94901 * include/std/type_traits (__is_complete_or_unbounded): Replace BADNAME _T with _Tp. * testsuite/17_intro/badnames.cc: New test. Diff: --- libstdc++-v3/ChangeLog | 7 +++ libstdc++-v3/include/std/type_traits | 4 +- libstdc++-v3/testsuite/17_intro/badnames.cc | 72 +++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b21c44fc0b8..f699a1bc59e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2020-05-01 Jonathan Wakely + + PR libstdc++/94901 + * include/std/type_traits (__is_complete_or_unbounded): Replace + BADNAME _T with _Tp. + * testsuite/17_intro/badnames.cc: New test. + 2020-04-30 Jonathan Wakely PR libstdc++/89510 diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 75a98e38c0a..bc9a45b3746 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -197,8 +197,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Helper functions that return false_type for incomplete classes, // incomplete unions and arrays of known bound from those. - template - constexpr true_type __is_complete_or_unbounded(__type_identity<_T>) + template + constexpr true_type __is_complete_or_unbounded(__type_identity<_Tp>) { return {}; } template . + +// { dg-do compile { target x86_64-*-linux* } } + +// Names taken from coding_style.bad_identifiers in the libstdc++ manual. +// We can't test this on all targets, because these names are used in +// non-GCC system headers. Test on x86_64-linux where we know these particular +// names aren't used. + +// For Solaris: +#define _B _B is a BADNAME +#define _C _C is a BADNAME +#define _L _L is a BADNAME +#define _N _N is a BADNAME +#define _P _P is a BADNAME +#define _S _S is a BADNAME +#define _U _U is a BADNAME +#define _X _X is a BADNAME +#define _E1 _E1 is a BADNAME +#define _E2 _E2 is a BADNAME +#define _E3 _E3 is a BADNAME +#define _E4 _E4 is a BADNAME +#define _E5 _E5 is a BADNAME +#define _E6 _E6 is a BADNAME +#define _E7 _E7 is a BADNAME +#define _E8 _E8 is a BADNAME +#define _E9 _E9 is a BADNAME + // .. +#define _E24 _E24 is a BADNAME + +// Irix adds: +#define _A _A is a BADNAME +#define _G _G is a BADNAME + +// MS adds: +#define _T _T is a BADNAME + +// BSD adds: +#define __used __used is a BADNAME +#define __unused __unused is a BADNAME + // __inline (glibc uses this so can't test here) + // _Complex (glibc uses this so can't test here) +#define __istype __istype is a BADNAME +#define __maskrune __maskrune is a BADNAME +#define __tolower __tolower is a BADNAME +#define __toupper __toupper is a BADNAME +#define __wchar_t __wchar_t is a BADNAME +#define __wint_t __wint_t is a BADNAME + // _res + // _res_ext + // __tg_* + +// VxWorks adds: +#define _C2 _C2 is a BADNAME + + +#include