Enable Mathematical Special Functions for C++17

* include/bits/c++config (_GLIBCXX_USE_STD_SPEC_FUNCS): Define for
	C++17, or for C++11/C++14 when __STDCPP_WANT_MATH_SPEC_FUNCS__ is
	true.
	* include/bits/specfun.h [!__STDCPP_WANT_MATH_SPEC_FUNCS__]: Don't
	do #error for C++17.
	* include/c_global/cmath: Check _GLIBCXX_USE_STD_SPEC_FUNCS instead
	of __STDCPP_WANT_MATH_SPEC_FUNCS__.
	* include/tr1/bessel_function.tcc: Likewise.
	* include/tr1/beta_function.tcc: Likewise.
	* include/tr1/cmath: Likewise.
	* include/tr1/ell_integral.tcc: Likewise.
	* include/tr1/exp_integral.tcc: Likewise.
	* include/tr1/gamma.tcc: Likewise.
	* include/tr1/hypergeometric.tcc: Likewise.
	* include/tr1/legendre_function.tcc: Likewise.
	* include/tr1/modified_bessel_func.tcc: Likewise.
	* include/tr1/poly_hermite.tcc: Likewise.
	* include/tr1/poly_laguerre.tcc: Likewise.
	* include/tr1/riemann_zeta.tcc: Likewise.
	* include/tr1/special_function_util.h: Likewise.
	* testsuite/26_numerics/headers/cmath/functions_std_c++17.cc: New.

From-SVN: r239081
This commit is contained in:
Jonathan Wakely 2016-08-03 16:54:13 +01:00 committed by Jonathan Wakely
parent 27631a2542
commit f8571e5150
18 changed files with 169 additions and 29 deletions

View File

@ -1,5 +1,27 @@
2016-08-03 Jonathan Wakely <jwakely@redhat.com>
* include/bits/c++config (_GLIBCXX_USE_STD_SPEC_FUNCS): Define for
C++17, or for C++11/C++14 when __STDCPP_WANT_MATH_SPEC_FUNCS__ is
true.
* include/bits/specfun.h [!__STDCPP_WANT_MATH_SPEC_FUNCS__]: Don't
do #error for C++17.
* include/c_global/cmath: Check _GLIBCXX_USE_STD_SPEC_FUNCS instead
of __STDCPP_WANT_MATH_SPEC_FUNCS__.
* include/tr1/bessel_function.tcc: Likewise.
* include/tr1/beta_function.tcc: Likewise.
* include/tr1/cmath: Likewise.
* include/tr1/ell_integral.tcc: Likewise.
* include/tr1/exp_integral.tcc: Likewise.
* include/tr1/gamma.tcc: Likewise.
* include/tr1/hypergeometric.tcc: Likewise.
* include/tr1/legendre_function.tcc: Likewise.
* include/tr1/modified_bessel_func.tcc: Likewise.
* include/tr1/poly_hermite.tcc: Likewise.
* include/tr1/poly_laguerre.tcc: Likewise.
* include/tr1/riemann_zeta.tcc: Likewise.
* include/tr1/special_function_util.h: Likewise.
* testsuite/26_numerics/headers/cmath/functions_std_c++17.cc: New.
* include/std/type_traits (has_trivial_default_constructor): Remove.
(has_trivial_copy_constructor, has_trivial_copy_assign): Likewise.
* testsuite/20_util/has_trivial_copy_assign/requirements/

View File

@ -532,6 +532,13 @@ namespace std
#define _GLIBCXX_TXN_SAFE_DYN
#endif
#if __cplusplus > 201402L
// In C++17 mathematical special functions are in namespace std.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#elif __cplusplus >= 201103L && __STDCPP_WANT_MATH_SPEC_FUNCS__ != 0
// For C++11 and C++14 they are in namespace std when requested.
# define _GLIBCXX_USE_STD_SPEC_FUNCS 1
#endif
// The remainder of the prewritten config is automatic; all the
// user hooks are listed above.

View File

@ -38,7 +38,7 @@
#define __cpp_lib_math_special_functions 201603L
#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
#if __cplusplus <= 201403L && __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0
# error include <cmath> and define __STDCPP_WANT_MATH_SPEC_FUNCS__
#endif

View File

@ -1790,7 +1790,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
#endif // C++11
#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# include <bits/specfun.h>
#endif

View File

@ -50,7 +50,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
@ -630,7 +630,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -48,7 +48,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
@ -199,7 +199,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -1141,7 +1141,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
}
}
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
namespace std _GLIBCXX_VISIBILITY(default)
{
@ -1254,7 +1254,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
}
}
#else // ! __STDCPP_WANT_MATH_SPEC_FUNCS__
#else // ! _GLIBCXX_USE_STD_SPEC_FUNCS
#include <bits/stl_algobase.h>
#include <limits>
@ -1683,6 +1683,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
}
}
#endif // __STDCPP_WANT_MATH_SPEC_FUNCS__
#endif // _GLIBCXX_USE_STD_SPEC_FUNCS
#endif // _GLIBCXX_TR1_CMATH

View File

@ -44,7 +44,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
@ -748,7 +748,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -49,7 +49,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
@ -525,7 +525,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -50,7 +50,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
@ -470,7 +470,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
} // namespace std

View File

@ -43,7 +43,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
@ -777,7 +777,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -48,7 +48,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
@ -305,7 +305,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -50,7 +50,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
@ -433,7 +433,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -41,7 +41,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
@ -123,7 +123,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -43,7 +43,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
@ -321,7 +321,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -46,7 +46,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
# define _GLIBCXX_MATH_NS ::std
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
@ -435,7 +435,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#undef _GLIBCXX_MATH_NS
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -38,7 +38,7 @@
namespace std _GLIBCXX_VISIBILITY(default)
{
#if __STDCPP_WANT_MATH_SPEC_FUNCS__
#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
namespace tr1
{
@ -133,7 +133,7 @@ namespace tr1
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace __detail
#if ! __STDCPP_WANT_MATH_SPEC_FUNCS__ && defined(_GLIBCXX_TR1_CMATH)
#if ! _GLIBCXX_USE_STD_SPEC_FUNCS && defined(_GLIBCXX_TR1_CMATH)
} // namespace tr1
#endif
}

View File

@ -0,0 +1,111 @@
// Copyright (C) 2016 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// { dg-options "-std=gnu++17" }
// { dg-do compile }
#include <cmath>
namespace gnu
{
using std::acos;
using std::asin;
using std::atan;
using std::atan2;
using std::ceil;
using std::cos;
using std::cosh;
using std::exp;
using std::fabs;
using std::floor;
using std::fmod;
using std::frexp;
using std::ldexp;
using std::log;
using std::log10;
using std::modf;
using std::pow;
using std::sin;
using std::sinh;
using std::sqrt;
using std::tan;
using std::tanh;
using std::assoc_laguerre;
using std::assoc_laguerref;
using std::assoc_laguerrel;
using std::assoc_legendre;
using std::assoc_legendref;
using std::assoc_legendrel;
using std::beta;
using std::betaf;
using std::betal;
using std::comp_ellint_1;
using std::comp_ellint_1f;
using std::comp_ellint_1l;
using std::comp_ellint_2;
using std::comp_ellint_2f;
using std::comp_ellint_2l;
using std::comp_ellint_3;
using std::comp_ellint_3f;
using std::comp_ellint_3l;
using std::cyl_bessel_i;
using std::cyl_bessel_if;
using std::cyl_bessel_il;
using std::cyl_bessel_j;
using std::cyl_bessel_jf;
using std::cyl_bessel_jl;
using std::cyl_bessel_k;
using std::cyl_bessel_kf;
using std::cyl_bessel_kl;
using std::cyl_neumann;
using std::cyl_neumannf;
using std::cyl_neumannl;
using std::ellint_1;
using std::ellint_1f;
using std::ellint_1l;
using std::ellint_2;
using std::ellint_2f;
using std::ellint_2l;
using std::ellint_3;
using std::ellint_3f;
using std::ellint_3l;
using std::expint;
using std::expintf;
using std::expintl;
using std::hermite;
using std::hermitef;
using std::hermitel;
using std::laguerre;
using std::laguerref;
using std::laguerrel;
using std::legendre;
using std::legendref;
using std::legendrel;
using std::riemann_zeta;
using std::riemann_zetaf;
using std::riemann_zetal;
using std::sph_bessel;
using std::sph_besself;
using std::sph_bessell;
using std::sph_legendre;
using std::sph_legendref;
using std::sph_legendrel;
using std::sph_neumann;
using std::sph_neumannf;
using std::sph_neumannl;
}