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/
#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.
#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
#endif // C++11
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
# include <bits/specfun.h>
#endif
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
_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 _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
_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
}
}
}
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
namespace std _GLIBCXX_VISIBILITY(default)
{
}
}
-#else // ! __STDCPP_WANT_MATH_SPEC_FUNCS__
+#else // ! _GLIBCXX_USE_STD_SPEC_FUNCS
#include <bits/stl_algobase.h>
#include <limits>
_GLIBCXX_END_NAMESPACE_VERSION
}
}
-#endif // __STDCPP_WANT_MATH_SPEC_FUNCS__
+#endif // _GLIBCXX_USE_STD_SPEC_FUNCS
#endif // _GLIBCXX_TR1_CMATH
namespace std _GLIBCXX_VISIBILITY(default)
{
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
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
}
namespace std _GLIBCXX_VISIBILITY(default)
{
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
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
}
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
_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
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
_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 _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
_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 _GLIBCXX_VISIBILITY(default)
{
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
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
}
namespace std _GLIBCXX_VISIBILITY(default)
{
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
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
}
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
_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 _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
_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 _GLIBCXX_VISIBILITY(default)
{
-#if __STDCPP_WANT_MATH_SPEC_FUNCS__
+#if _GLIBCXX_USE_STD_SPEC_FUNCS
#elif defined(_GLIBCXX_TR1_CMATH)
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
}
--- /dev/null
+// 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;
+}