diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2017-10-23 12:10:28 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2017-10-23 12:10:28 +0100 |
commit | 908d1d3aeaf1a40d9308dc09aac6e94d78991af1 (patch) | |
tree | 82b188dba5472017bf9c97d9ccaea52cf744580d | |
parent | 2a31c3216c53ffaeb21ec76e4491611bb40792b4 (diff) | |
download | gcc-908d1d3aeaf1a40d9308dc09aac6e94d78991af1.zip gcc-908d1d3aeaf1a40d9308dc09aac6e94d78991af1.tar.gz gcc-908d1d3aeaf1a40d9308dc09aac6e94d78991af1.tar.bz2 |
PR libstdc++/82644 document IS 29124 support
Also fix declarations of special functions in C++17, to import them into
the global namespace in <math.h>, 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
-rw-r--r-- | libstdc++-v3/ChangeLog | 14 | ||||
-rw-r--r-- | libstdc++-v3/doc/xml/manual/intro.xml | 4 | ||||
-rw-r--r-- | libstdc++-v3/doc/xml/manual/status_cxxis29124.xml | 315 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/specfun.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/c_compatibility/math.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/26_numerics/headers/cmath/82644.cc | 27 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_global_c++17.cc | 111 |
7 files changed, 475 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 18a8feb..d22a9b9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,17 @@ +2017-10-23 Jonathan Wakely <jwakely@redhat.com> + + 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 <jwakely@redhat.com> * 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 3b243e5..2df9c5f 100644 --- a/libstdc++-v3/doc/xml/manual/intro.xml +++ b/libstdc++-v3/doc/xml/manual/intro.xml @@ -50,6 +50,10 @@ <!-- Section 01.6 : Status C++ TR24733 --> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" href="status_cxxtr24733.xml"> </xi:include> + + <!-- Section 01.7 : Status C++ IS 24733 --> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="xml" href="status_cxxis29124.xml"> + </xi:include> </section> <!-- Section 02 : License --> 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 0000000..40a90fc --- /dev/null +++ b/libstdc++-v3/doc/xml/manual/status_cxxis29124.xml @@ -0,0 +1,315 @@ +<section xmlns="http://docbook.org/ns/docbook" version="5.0" + xml:id="status.iso.specfun" xreflabel="Status C++ 29124"> +<?dbhtml filename="status_iso_cxxis29124.html"?> + +<info><title>C++ IS 29124</title> + <keywordset> + <keyword>ISO C++</keyword> + <keyword>Special Functions</keyword> + </keywordset> +</info> + +<para> +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 +</para> + +<para> +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 <code>__STDCPP_WANT_MATH_SPEC_FUNCS__</code> +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). +</para> + +<para> +When the special functions are declared the macro +<code>__STDCPP_MATH_SPEC_FUNCS__</code> is defined to <code>201003L</code>. +</para> + +<para> +In addition to the special functions defined in IS 29124, for +non-strict modes (i.e. <code>-std=gnu++NN</code> modes) the +hypergeometric functions and confluent hypergeometric functions +from TR1 are also provided, defined in namespace +<code>__gnu_cxx</code>. +</para> + +<!-- Status is Yes or No, Broken/Partial--> +<!-- + Yes + + No + <?dbhtml bgcolor="#C8B0B0" ?> + Broken/Partial + <?dbhtml bgcolor="#B0B0B0" ?> +--> +<table frame="all" xml:id="table.specfun_status"> +<title>C++ Special Functions Implementation Status</title> + +<tgroup cols="4" align="left" colsep="0" rowsep="1"> +<colspec colname="c1"/> +<colspec colname="c2"/> +<colspec colname="c3"/> +<colspec colname="c4"/> + + <thead> + <row> + <entry>Section</entry> + <entry>Description</entry> + <entry>Status</entry> + <entry>Comments</entry> + </row> + </thead> + <tbody> + <row> + <?dbhtml bgcolor="#B0B0B0" ?> + <entry>7</entry> + <entry>Macro names</entry> + <entry>Partial</entry> + <entry>No diagnostic for inconsistent definitions of + <code>__STDCPP_WANT_MATH_SPEC_FUNCS__</code></entry> + </row> + <row> + <entry>8</entry> + <entry>Mathematical special functions</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1</entry> + <entry>Additions to header <code><cmath></code> synopsis</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.1</entry> + <entry>associated Laguerre polynomials</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.2</entry> + <entry>associated Legendre functions</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.3</entry> + <entry>beta function</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.4</entry> + <entry>(complete) elliptic integral of the first kind</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.5</entry> + <entry>(complete) elliptic integral of the second kind</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.6</entry> + <entry>(complete) elliptic integral of the third kind</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.7</entry> + <entry>regular modified cylindrical Bessel functions</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.8</entry> + <entry>cylindrical Bessel functions (of the first kind)</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.9</entry> + <entry>irregular modified cylindrical Bessel functions</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.10</entry> + <entry>cylindrical Neumann functions</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.11</entry> + <entry>(incomplete) elliptic integral of the first kind</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.12</entry> + <entry>(incomplete) elliptic integral of the second kind</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.13</entry> + <entry>(incomplete) elliptic integral of the third kind</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.14</entry> + <entry>exponential integral</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.15</entry> + <entry>Hermite polynomials</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.16</entry> + <entry>Laguerre polynomials</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.17</entry> + <entry>Legendre polynomials</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.18</entry> + <entry>Riemann zeta function</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.19</entry> + <entry>spherical Bessel functions (of the first kind)</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.20</entry> + <entry>spherical associated Legendre functions</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.1.21</entry> + <entry>spherical Neumann functions</entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <entry>8.2</entry> + <entry>Additions to header <code><math.h></code></entry> + <entry>Y</entry> + <entry/> + </row> + <row> + <?dbhtml bgcolor="#B0B0B0" ?> + <entry>8.3</entry> + <entry>The header <code><ctgmath></code></entry> + <entry>Partial</entry> + <entry>Conflicts with C++ 2011 requirements.</entry> + </row> + <row> + <?dbhtml bgcolor="#C8B0B0" ?> + <entry>8.4</entry> + <entry>The header <code><tgmath.h></code></entry> + <entry>N</entry> + <entry>Conflicts with C++ 2011 requirements.</entry> + </row> + </tbody> +</tgroup> +</table> + +<section xml:id="iso.specfun.specific" xreflabel="Implementation Specific"><info><title>Implementation Specific Behavior</title></info> + + <para>For behaviour which is specified by the 2011 standard, + see <link linkend="iso.2011.specific">C++ 2011 Implementation + Specific Behavior</link>. This section documents behaviour which + is required by IS 29124. + </para> + + <para> + <emphasis>7.2 [macro.user]/3 /4</emphasis> The functions declared in + Clause 8 are only declared when + <code>__STDCPP_WANT_MATH_SPEC_FUNCS__ == 1</code> + (or in C++17 mode, for GCC 7.1 and later). + </para> + + <para> + <emphasis>8.1.1 [sf.cmath.Lnm]/1</emphasis> The effect of calling + these functions with <code>n >= 128</code> or <code>m >= 128</code> + should be described here. + </para> + + <para> + <emphasis>8.1.2 [sf.cmath.Plm]/3</emphasis> The effect of calling + these functions with <code>l >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.3 [sf.cmath.I]/3</emphasis> The effect of calling + these functions with <code>nu >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.8 [sf.cmath.J]/3</emphasis> The effect of calling + these functions with <code>nu >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.9 [sf.cmath.K]/3</emphasis> The effect of calling + these functions with <code>nu >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.10 [sf.cmath.N]/3</emphasis> The effect of calling + these functions with <code>nu >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.15 [sf.cmath.Hn]/3</emphasis> The effect of calling + these functions with <code>n >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.16 [sf.cmath.Ln]/3</emphasis> The effect of calling + these functions with <code>n >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.17 [sf.cmath.Pl]/3</emphasis> The effect of calling + these functions with <code>l >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.19 [sf.cmath.j]/3</emphasis> The effect of calling + these functions with <code>n >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.20 [sf.cmath.Ylm]/3</emphasis> The effect of calling + these functions with <code>l >= 128</code> should be described here. + </para> + + <para> + <emphasis>8.1.21 [sf.cmath.n]/3</emphasis> The effect of calling + these functions with <code>n >= 128</code> should be described here. + </para> + +</section> + +</section> diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h index 0aaebea..6bb3ec0 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 84755c8..28c7c83 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 0000000..956541a --- /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 +// <http://www.gnu.org/licenses/>. + +// { 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 <cmath> // 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 0000000..ce3a0dd --- /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 +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++17" } +// { dg-do compile } + +#include <math.h> + +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; +} |