Commit c34d3fd3 by Jonathan Wakely Committed by Jonathan Wakely

Improve API docs for <chrono> and <ratio>

	* doc/doxygen/doxygroups.cc (std::literals): Add documentation for
	inline namespace.
	* include/std/chrono: Improve docs.
	* include/std/ratio: Do not document implementation details.
	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust dg-error
	line numbers.
	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.

From-SVN: r270988
parent f61a12b3
2019-05-07 Jonathan Wakely <jwakely@redhat.com>
* doc/doxygen/doxygroups.cc (std::literals): Add documentation for
inline namespace.
* include/std/chrono: Improve docs.
* include/std/ratio: Do not document implementation details.
* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust dg-error
line numbers.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
PR libstdc++/89102
* doc/xml/manual/intro.xml: Document DR 2408 and 2465 changes.
* include/std/chrono (__duration_common_type_wrapper): Replace with ...
......
......@@ -19,6 +19,9 @@
/** @namespace std
* @brief ISO C++ entities toplevel namespace is std.
*/
/** @namespace std
* @brief ISO C++ inline namespace for literal suffixes.
*/
/** @namespace std::__detail
* @brief Implementation details not part of the namespace std interface.
*/
......
......@@ -24,6 +24,7 @@
/** @file include/ratio
* This is a Standard C++ Library header.
* @ingroup ratio
*/
#ifndef _GLIBCXX_RATIO
......@@ -50,6 +51,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{
*/
/// @cond undocumented
template<intmax_t _Pn>
struct __static_sign
: integral_constant<intmax_t, (_Pn < 0) ? -1 : 1>
......@@ -243,6 +246,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(__rem < __d, "Internal library error");
};
/// @endcond
/**
* @brief Provides compile-time rational arithmetic.
*
......@@ -280,6 +285,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<intmax_t _Num, intmax_t _Den>
constexpr intmax_t ratio<_Num, _Den>::den;
/// @cond undocumented
template<typename _R1, typename _R2>
struct __ratio_multiply
{
......@@ -306,10 +313,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_multiply<_R1, _R2>::den;
/// @endcond
/// ratio_multiply
template<typename _R1, typename _R2>
using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type;
/// @cond undocumented
template<typename _R1, typename _R2>
struct __ratio_divide
{
......@@ -329,6 +340,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_divide<_R1, _R2>::den;
/// @endcond
/// ratio_divide
template<typename _R1, typename _R2>
using ratio_divide = typename __ratio_divide<_R1, _R2>::type;
......@@ -345,6 +358,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: integral_constant<bool, !ratio_equal<_R1, _R2>::value>
{ };
/// @cond undocumented
// Both numbers are positive.
template<typename _R1, typename _R2,
typename _Left = __big_mul<_R1::num,_R2::den>,
......@@ -375,6 +390,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
ratio<-_R1::num, _R1::den> >::type
{ };
/// @endcond
/// ratio_less
template<typename _R1, typename _R2>
struct ratio_less
......@@ -416,6 +433,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
= ratio_greater_equal<_R1, _R2>::value;
#endif // C++17
/// @cond undocumented
template<typename _R1, typename _R2,
bool = (_R1::num >= 0),
bool = (_R2::num >= 0),
......@@ -499,10 +518,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_add<_R1, _R2>::den;
/// @endcond
/// ratio_add
template<typename _R1, typename _R2>
using ratio_add = typename __ratio_add<_R1, _R2>::type;
/// @cond undocumented
template<typename _R1, typename _R2>
struct __ratio_subtract
{
......@@ -520,6 +543,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _R1, typename _R2>
constexpr intmax_t __ratio_subtract<_R1, _R2>::den;
/// @endcond
/// ratio_subtract
template<typename _R1, typename _R2>
using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type;
......
......@@ -45,7 +45,7 @@ test04()
std::ratio<1,0> r1 __attribute__((unused)); // { dg-error "required from here" }
}
// { dg-error "denominator cannot be zero" "" { target *-*-* } 263 }
// { dg-error "out of range" "" { target *-*-* } 264 }
// { dg-error "overflow in constant expression" "" { target *-*-* } 59 }
// { dg-error "denominator cannot be zero" "" { target *-*-* } 0 }
// { dg-error "out of range" "" { target *-*-* } 0 }
// { dg-error "overflow in constant expression" "" { target *-*-* } 0 }
// { dg-prune-output "not a member" }
......@@ -41,10 +41,10 @@ test02()
// { dg-error "required from here" "" { target *-*-* } 28 }
// { dg-error "expected initializer" "" { target *-*-* } 35 }
// { dg-error "expected initializer" "" { target *-*-* } 37 }
// { dg-error "overflow in addition" "" { target *-*-* } 450 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 95 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 97 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 99 }
// { dg-error "overflow in constant expression" "" { target *-*-* } 106 }
// { dg-error "overflow in addition" "" { target *-*-* } 0 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 98 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 100 }
// { dg-error "overflow in multiplication" "" { target *-*-* } 102 }
// { dg-error "overflow in constant expression" "" { target *-*-* } 0 }
// { dg-prune-output "out of range" }
// { dg-prune-output "not usable in a constant expression" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment