From: redi Date: Sun, 4 Dec 2011 16:53:17 +0000 (+0000) Subject: * include/std/type_traits: Doxygen improvements. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=3598538cbd964f7bbdddf36284d0c696fa469ca9 * include/std/type_traits: Doxygen improvements. * include/bits/move.h: Likewise. * include/tr1/type_traits: Likewise. * include/tr2/type_traits: Likewise. * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error line numbers * testsuite/20_util/forward/c_neg.cc: Likewise. * testsuite/20_util/forward/f_neg.cc: Likewise. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Likewise. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181993 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6751abbdfae..7b66e6a178d 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,18 @@ +2011-12-04 Jonathan Wakely + + * include/std/type_traits: Doxygen improvements. + * include/bits/move.h: Likewise. + * include/tr1/type_traits: Likewise. + * include/tr2/type_traits: Likewise. + * testsuite/20_util/declval/requirements/1_neg.cc: Adjust dg-error + line numbers + * testsuite/20_util/forward/c_neg.cc: Likewise. + * testsuite/20_util/forward/f_neg.cc: Likewise. + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: + Likewise. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: + Likewise. + 2011-12-04 Markus Trippelsdorf Jonathan Wakely diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h index f5beb22bb8d..353c466d8fc 100644 --- a/libstdc++-v3/include/bits/move.h +++ b/libstdc++-v3/include/bits/move.h @@ -38,6 +38,10 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION // Used, in C++03 mode too, by allocators, etc. + /** + * @brief Same as C++11 std::addressof + * @ingroup utilities + */ template inline _Tp* __addressof(_Tp& __r) _GLIBCXX_NOEXCEPT @@ -55,13 +59,30 @@ _GLIBCXX_END_NAMESPACE_VERSION namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION - - /// forward (as per N3143) + + /** + * @addtogroup utilities + * @{ + */ + + // forward (as per N3143) + /** + * @brief Forward an lvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ template constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type& __t) noexcept { return static_cast<_Tp&&>(__t); } + /** + * @brief Forward an rvalue. + * @return The parameter cast to the specified type. + * + * This function is used to implement "perfect forwarding". + */ template constexpr _Tp&& forward(typename std::remove_reference<_Tp>::type&& __t) noexcept @@ -72,10 +93,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } /** - * @brief Move a value. - * @ingroup utilities + * @brief Convert a value to an rvalue. * @param __t A thing of arbitrary type. - * @return Same, moved. + * @return The parameter cast to an rvalue-reference to allow moving it. */ template constexpr typename std::remove_reference<_Tp>::type&& @@ -89,10 +109,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION is_copy_constructible<_Tp>>::type { }; /** - * @brief Move unless it could throw and the type is copyable. - * @ingroup utilities + * @brief Conditionally convert a value to an rvalue. * @param __x A thing of arbitrary type. - * @return Same, possibly moved. + * @return The parameter, possibly cast to an rvalue-reference. + * + * Same as std::move unless the type's move constructor could throw and the + * type is copyable, in which case an lvalue-reference is returned instead. */ template inline typename @@ -100,13 +122,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION move_if_noexcept(_Tp& __x) noexcept { return std::move(__x); } - /// declval, from type_traits. + // declval, from type_traits. /** * @brief Returns the actual address of the object or function * referenced by r, even in the presence of an overloaded * operator&. - * @ingroup utilities * @param __r Reference to an object or function. * @return The actual address. */ @@ -115,6 +136,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION addressof(_Tp& __r) noexcept { return std::__addressof(__r); } + /// @} group utilities _GLIBCXX_END_NAMESPACE_VERSION } // namespace @@ -130,8 +152,12 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION /** + * @addtogroup utilities + * @{ + */ + + /** * @brief Swaps two values. - * @ingroup utilities * @param __a A thing of arbitrary type. * @param __b Another thing of arbitrary type. * @return Nothing. @@ -154,6 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 809. std::swap should be overloaded for array types. + /// Swap the contents of two arrays. template inline void swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) @@ -165,6 +192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION swap(__a[__n], __b[__n]); } + /// @} group utilities _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 46e3f800cab..e3ec7ad5de5 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1,4 +1,4 @@ -// C++0x type_traits -*- C++ -*- +// C++11 type_traits -*- C++ -*- // Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. // @@ -42,7 +42,13 @@ namespace std _GLIBCXX_VISIBILITY(default) _GLIBCXX_BEGIN_NAMESPACE_VERSION /** - * @addtogroup metaprogramming + * @defgroup metaprogramming Metaprogramming and type traits + * @ingroup utilities + * + * Template utilities for compile-time introspection and modification, + * including type classification traits, type property inspection traits + * and type transformation traits. + * * @{ */ @@ -56,10 +62,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr operator value_type() { return value; } }; - /// typedef for true_type + /// The type used as a compile-time boolean with true value. typedef integral_constant true_type; - /// typedef for false_type + /// The type used as a compile-time boolean with false value. typedef integral_constant false_type; template @@ -451,7 +457,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct is_compound : public integral_constant::value> { }; - /// is_member_pointer template struct __is_member_pointer_helper : public false_type { }; @@ -460,6 +465,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __is_member_pointer_helper<_Tp _Cp::*> : public true_type { }; + /// is_member_pointer template struct is_member_pointer : public integral_constant { }; - /// is_trivially_copyable (still unimplemented) + // is_trivially_copyable (still unimplemented) /// is_standard_layout template @@ -564,6 +570,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct add_rvalue_reference; + /** + * @brief Utility to simplify expressions used in unevaluated operands + * @ingroup utilities + */ template typename add_rvalue_reference<_Tp>::type declval() noexcept; @@ -1702,9 +1712,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; - // Define a nested type if some predicate holds. // Primary template. - /// enable_if + /// Define a member typedef @c type only if a boolean constant is true. template struct enable_if { }; @@ -1715,9 +1724,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typedef _Tp type; }; - // A conditional expression, but for types. If true, first, if false, second. // Primary template. - /// conditional + /// Define a member typedef @c type to one of two argument types. template struct conditional { typedef _Iftrue type; }; @@ -1747,14 +1755,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION common_type::type, _Vp...>::type type; }; - /// underlying_type + /// The underlying type of an enum. template struct underlying_type { typedef __underlying_type(_Tp) type; }; - /// declval template struct __declval_protector { @@ -1892,7 +1899,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ::type>::value> \ { }; - // @} group metaprogramming + /// @} group metaprogramming _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index 2825fe6f4e3..f15123ace5b 100644 --- a/libstdc++-v3/include/tr1/type_traits +++ b/libstdc++-v3/include/tr1/type_traits @@ -1,6 +1,6 @@ // TR1 type_traits -*- C++ -*- -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -41,10 +41,7 @@ namespace tr1 _GLIBCXX_BEGIN_NAMESPACE_VERSION /** - * @defgroup metaprogramming Type Traits - * @ingroup utilities - * - * Compile time type transformation and information. + * @addtogroup metaprogramming * @{ */ @@ -682,6 +679,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #undef _DEFINE_SPEC_2_HELPER #undef _DEFINE_SPEC + /// @} group metaprogramming + _GLIBCXX_END_NAMESPACE_VERSION } } diff --git a/libstdc++-v3/include/tr2/type_traits b/libstdc++-v3/include/tr2/type_traits index 4ec41181047..9c301b30a01 100644 --- a/libstdc++-v3/include/tr2/type_traits +++ b/libstdc++-v3/include/tr2/type_traits @@ -40,9 +40,7 @@ namespace tr2 _GLIBCXX_BEGIN_NAMESPACE_VERSION /** - * @defgroup metaprogramming Type Traits - * @ingroup utilities - * + * @addtogroup metaprogramming * @{ */ @@ -111,6 +109,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typelist<__direct_bases(_Tp)...> type; }; + /// @} group metaprogramming + _GLIBCXX_END_NAMESPACE_VERSION } } diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index 33ab45b4bbc..298e93e23d9 100644 --- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-error "static assertion failed" "" { target *-*-* } 1769 } +// { dg-error "static assertion failed" "" { target *-*-* } 1776 } #include diff --git a/libstdc++-v3/testsuite/20_util/forward/c_neg.cc b/libstdc++-v3/testsuite/20_util/forward/c_neg.cc index 50bfbf02850..01128245d7e 100644 --- a/libstdc++-v3/testsuite/20_util/forward/c_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward/c_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-error "static assertion failed" "" { target *-*-* } 69 } +// { dg-error "static assertion failed" "" { target *-*-* } 90 } #include diff --git a/libstdc++-v3/testsuite/20_util/forward/f_neg.cc b/libstdc++-v3/testsuite/20_util/forward/f_neg.cc index 418a469dfd9..9e5b78a04db 100644 --- a/libstdc++-v3/testsuite/20_util/forward/f_neg.cc +++ b/libstdc++-v3/testsuite/20_util/forward/f_neg.cc @@ -1,7 +1,7 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// Copyright (C) 2010 Free Software Foundation, Inc. +// Copyright (C) 2010, 2011 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-error "static assertion failed" "" { target *-*-* } 69 } +// { dg-error "static assertion failed" "" { target *-*-* } 90 } #include diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index b8bd23f841f..d2ebf165319 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1555 } -// { dg-error "declaration of" "" { target *-*-* } 1519 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1565 } +// { dg-error "declaration of" "" { target *-*-* } 1529 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index 96940119ed9..c0ef55bd25f 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1473 } -// { dg-error "declaration of" "" { target *-*-* } 1437 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1483 } +// { dg-error "declaration of" "" { target *-*-* } 1447 }