From: Jonathan Wakely Date: Mon, 23 Oct 2017 11:10:28 +0000 (+0100) Subject: PR libstdc++/82644 document IS 29124 support X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=908d1d3aeaf1a40d9308dc09aac6e94d78991af1;p=gcc.git PR libstdc++/82644 document IS 29124 support Also fix declarations of special functions in C++17, to import them into the global namespace in , and to prevent defining the non-standard hypergeometric functions in strict mode. PR libstdc++/82644 * doc/xml/manual/intro.xml: Include new section. * doc/xml/manual/status_cxxis29124.xml: New section on IS 29124 status. * include/bits/specfun.h [__STRICT_ANSI__] (hyperg, hypergf, hypergl) (conf_hyperg, conf_hypergf, conf_hypergl): Don't declare. * include/c_compatibility/math.h: Import special functions into global namespace for C++17. * testsuite/26_numerics/headers/cmath/82644.cc: New test. * testsuite/26_numerics/headers/cmath/functions_global_c++17.cc: New test. From-SVN: r254004 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 18a8feb74c3..d22a9b93da5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,17 @@ +2017-10-23 Jonathan Wakely + + PR libstdc++/82644 + * doc/xml/manual/intro.xml: Include new section. + * doc/xml/manual/status_cxxis29124.xml: New section on IS 29124 + status. + * include/bits/specfun.h [__STRICT_ANSI__] (hyperg, hypergf, hypergl) + (conf_hyperg, conf_hypergf, conf_hypergl): Don't declare. + * include/c_compatibility/math.h: Import special functions into + global namespace for C++17. + * testsuite/26_numerics/headers/cmath/82644.cc: New test. + * testsuite/26_numerics/headers/cmath/functions_global_c++17.cc: New + test. + 2017-10-21 Jonathan Wakely * testsuite/experimental/filesystem/path/itr/traversal.cc: Do not diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml index 3b243e57c8b..2df9c5fa6a7 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -50,6 +50,10 @@ + + + + diff --git a/libstdc++-v3/doc/xml/manual/status_cxxis29124.xml b/libstdc++-v3/doc/xml/manual/status_cxxis29124.xml new file mode 100644 index 00000000000..40a90fc9944 --- /dev/null +++ b/libstdc++-v3/doc/xml/manual/status_cxxis29124.xml @@ -0,0 +1,315 @@ +
+ + +C++ IS 29124 + + ISO C++ + Special Functions + + + + +This table is based on the table of contents of ISO/IEC FDIS 29124 +Doc No: N3060 Date: 2010-03-06 +Extensions to the C++ Library to support mathematical special functions + + + +Complete support for IS 29124 is in GCC 6.1 and later releases, when using +at least C++11 (for older releases or C++98/C++03 use TR1 instead). +For C++11 and C++14 the additions to the library are not declared by their +respective headers unless __STDCPP_WANT_MATH_SPEC_FUNCS__ +is defined as a macro that expands to a non-zero integer constant. +For C++17 the special functions are always declared (since GCC 7.1). + + + +When the special functions are declared the macro +__STDCPP_MATH_SPEC_FUNCS__ is defined to 201003L. + + + +In addition to the special functions defined in IS 29124, for +non-strict modes (i.e. -std=gnu++NN modes) the +hypergeometric functions and confluent hypergeometric functions +from TR1 are also provided, defined in namespace +__gnu_cxx. + + + + + +C++ Special Functions Implementation Status + + + + + + + + + + Section + Description + Status + Comments + + + + + + 7 + Macro names + Partial + No diagnostic for inconsistent definitions of + __STDCPP_WANT_MATH_SPEC_FUNCS__ + + + 8 + Mathematical special functions + Y + + + + 8.1 + Additions to header <cmath> synopsis + Y + + + + 8.1.1 + associated Laguerre polynomials + Y + + + + 8.1.2 + associated Legendre functions + Y + + + + 8.1.3 + beta function + Y + + + + 8.1.4 + (complete) elliptic integral of the first kind + Y + + + + 8.1.5 + (complete) elliptic integral of the second kind + Y + + + + 8.1.6 + (complete) elliptic integral of the third kind + Y + + + + 8.1.7 + regular modified cylindrical Bessel functions + Y + + + + 8.1.8 + cylindrical Bessel functions (of the first kind) + Y + + + + 8.1.9 + irregular modified cylindrical Bessel functions + Y + + + + 8.1.10 + cylindrical Neumann functions + Y + + + + 8.1.11 + (incomplete) elliptic integral of the first kind + Y + + + + 8.1.12 + (incomplete) elliptic integral of the second kind + Y + + + + 8.1.13 + (incomplete) elliptic integral of the third kind + Y + + + + 8.1.14 + exponential integral + Y + + + + 8.1.15 + Hermite polynomials + Y + + + + 8.1.16 + Laguerre polynomials + Y + + + + 8.1.17 + Legendre polynomials + Y + + + + 8.1.18 + Riemann zeta function + Y + + + + 8.1.19 + spherical Bessel functions (of the first kind) + Y + + + + 8.1.20 + spherical associated Legendre functions + Y + + + + 8.1.21 + spherical Neumann functions + Y + + + + 8.2 + Additions to header <math.h> + Y + + + + + 8.3 + The header <ctgmath> + Partial + Conflicts with C++ 2011 requirements. + + + + 8.4 + The header <tgmath.h> + N + Conflicts with C++ 2011 requirements. + + + +
+ +
Implementation Specific Behavior + + For behaviour which is specified by the 2011 standard, + see C++ 2011 Implementation + Specific Behavior. This section documents behaviour which + is required by IS 29124. + + + + 7.2 [macro.user]/3 /4 The functions declared in + Clause 8 are only declared when + __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1 + (or in C++17 mode, for GCC 7.1 and later). + + + + 8.1.1 [sf.cmath.Lnm]/1 The effect of calling + these functions with n >= 128 or m >= 128 + should be described here. + + + + 8.1.2 [sf.cmath.Plm]/3 The effect of calling + these functions with l >= 128 should be described here. + + + + 8.1.3 [sf.cmath.I]/3 The effect of calling + these functions with nu >= 128 should be described here. + + + + 8.1.8 [sf.cmath.J]/3 The effect of calling + these functions with nu >= 128 should be described here. + + + + 8.1.9 [sf.cmath.K]/3 The effect of calling + these functions with nu >= 128 should be described here. + + + + 8.1.10 [sf.cmath.N]/3 The effect of calling + these functions with nu >= 128 should be described here. + + + + 8.1.15 [sf.cmath.Hn]/3 The effect of calling + these functions with n >= 128 should be described here. + + + + 8.1.16 [sf.cmath.Ln]/3 The effect of calling + these functions with n >= 128 should be described here. + + + + 8.1.17 [sf.cmath.Pl]/3 The effect of calling + these functions with l >= 128 should be described here. + + + + 8.1.19 [sf.cmath.j]/3 The effect of calling + these functions with n >= 128 should be described here. + + + + 8.1.20 [sf.cmath.Ylm]/3 The effect of calling + these functions with l >= 128 should be described here. + + + + 8.1.21 [sf.cmath.n]/3 The effect of calling + these functions with n >= 128 should be described here. + + +
+ +
diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h index 0aaebeab7ac..6bb3ec09681 100644 --- a/libstdc++-v3/include/bits/specfun.h +++ b/libstdc++-v3/include/bits/specfun.h @@ -1201,6 +1201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std +#ifndef __STRICT_ANSI__ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1305,6 +1306,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace __gnu_cxx +#endif // __STRICT_ANSI__ #pragma GCC visibility pop diff --git a/libstdc++-v3/include/c_compatibility/math.h b/libstdc++-v3/include/c_compatibility/math.h index 84755c8c35c..28c7c8368f0 100644 --- a/libstdc++-v3/include/c_compatibility/math.h +++ b/libstdc++-v3/include/c_compatibility/math.h @@ -111,7 +111,7 @@ using std::tgamma; using std::trunc; #endif // C++11 && _GLIBCXX_USE_C99_MATH_TR1 -#if __STDCPP_WANT_MATH_SPEC_FUNCS__ == 1 +#if _GLIBCXX_USE_STD_SPEC_FUNCS using std::assoc_laguerref; using std::assoc_laguerrel; using std::assoc_laguerre; @@ -175,7 +175,7 @@ using std::sph_legendre; using std::sph_neumannf; using std::sph_neumannl; using std::sph_neumann; -#endif // __STDCPP_WANT_MATH_SPEC_FUNCS__ +#endif // _GLIBCXX_USE_STD_SPEC_FUNCS #endif // _GLIBCXX_MATH_H #endif // __cplusplus diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/82644.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/82644.cc new file mode 100644 index 00000000000..956541a67d9 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/82644.cc @@ -0,0 +1,27 @@ +// Copyright (C) 2017 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 +// . + +// { dg-options "-D__STDCPP_WANT_MATH_SPEC_FUNCS__ -D__STRICT_ANSI__" } +// { dg-do compile { target c++11 } } + +#define conf_hyperg 1 +#define conf_hypergf 2 +#define conf_hypergl 3 +#define hyperg 4 +#define hypergf 5 +#define hypergl 6 +#include // PR libstdc++/82644 diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_global_c++17.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_global_c++17.cc new file mode 100644 index 00000000000..ce3a0dd4ac2 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_global_c++17.cc @@ -0,0 +1,111 @@ +// Copyright (C) 2017 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 +// . + +// { dg-options "-std=gnu++17" } +// { dg-do compile } + +#include + +namespace gnu +{ + using ::acos; + using ::asin; + using ::atan; + using ::atan2; + using ::ceil; + using ::cos; + using ::cosh; + using ::exp; + using ::fabs; + using ::floor; + using ::fmod; + using ::frexp; + using ::ldexp; + using ::log; + using ::log10; + using ::modf; + using ::pow; + using ::sin; + using ::sinh; + using ::sqrt; + using ::tan; + using ::tanh; + + using ::assoc_laguerre; + using ::assoc_laguerref; + using ::assoc_laguerrel; + using ::assoc_legendre; + using ::assoc_legendref; + using ::assoc_legendrel; + using ::beta; + using ::betaf; + using ::betal; + using ::comp_ellint_1; + using ::comp_ellint_1f; + using ::comp_ellint_1l; + using ::comp_ellint_2; + using ::comp_ellint_2f; + using ::comp_ellint_2l; + using ::comp_ellint_3; + using ::comp_ellint_3f; + using ::comp_ellint_3l; + using ::cyl_bessel_i; + using ::cyl_bessel_if; + using ::cyl_bessel_il; + using ::cyl_bessel_j; + using ::cyl_bessel_jf; + using ::cyl_bessel_jl; + using ::cyl_bessel_k; + using ::cyl_bessel_kf; + using ::cyl_bessel_kl; + using ::cyl_neumann; + using ::cyl_neumannf; + using ::cyl_neumannl; + using ::ellint_1; + using ::ellint_1f; + using ::ellint_1l; + using ::ellint_2; + using ::ellint_2f; + using ::ellint_2l; + using ::ellint_3; + using ::ellint_3f; + using ::ellint_3l; + using ::expint; + using ::expintf; + using ::expintl; + using ::hermite; + using ::hermitef; + using ::hermitel; + using ::laguerre; + using ::laguerref; + using ::laguerrel; + using ::legendre; + using ::legendref; + using ::legendrel; + using ::riemann_zeta; + using ::riemann_zetaf; + using ::riemann_zetal; + using ::sph_bessel; + using ::sph_besself; + using ::sph_bessell; + using ::sph_legendre; + using ::sph_legendref; + using ::sph_legendrel; + using ::sph_neumann; + using ::sph_neumannf; + using ::sph_neumannl; +}