Rationalise PCH headers and 17_intro/headers tests.

PR libstdc++/64857
	* doc/xml/manual/using.xml: Improve aggregate header documentation.
	* doc/html/manual/*: Regenerate.
	* include/precompiled/extc++.h: Include <bits/stdc++.h> for C++11
	and later and include more extension headers.
	* testsuite/17_intro/headers/c++1998/all_attributes.cc: Remove
	redundant header.
	* testsuite/17_intro/headers/c++200x/: Rename to c++2011.
	* testsuite/17_intro/headers/c++2014/all_attributes.cc: Remove
	redundant headers.
	* testsuite/17_intro/headers/c++2014/all_no_exceptions.cc: New.
	* testsuite/17_intro/headers/c++2014/all_no_rtti.cc: New.
	* testsuite/17_intro/headers/c++2014/all_pedantic_errors.cc: New.
	* testsuite/17_intro/headers/c++2014/operator_names.cc: New.
	* testsuite/17_intro/headers/c++2014/stdc++.cc: New.
	* testsuite/17_intro/headers/c++2014/stdc++_multiple_inclusion.cc:
	New.

From-SVN: r227684
This commit is contained in:
Jonathan Wakely 2015-09-11 13:25:43 +01:00 committed by Jonathan Wakely
parent f5548c3916
commit f12ddb6249
22 changed files with 330 additions and 17 deletions

View file

@ -1,5 +1,23 @@
2015-09-11 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/64857
* doc/xml/manual/using.xml: Improve aggregate header documentation.
* doc/html/manual/*: Regenerate.
* include/precompiled/extc++.h: Include <bits/stdc++.h> for C++11
and later and include more extension headers.
* testsuite/17_intro/headers/c++1998/all_attributes.cc: Remove
redundant header.
* testsuite/17_intro/headers/c++200x/: Rename to c++2011.
* testsuite/17_intro/headers/c++2014/all_attributes.cc: Remove
redundant headers.
* testsuite/17_intro/headers/c++2014/all_no_exceptions.cc: New.
* testsuite/17_intro/headers/c++2014/all_no_rtti.cc: New.
* testsuite/17_intro/headers/c++2014/all_pedantic_errors.cc: New.
* testsuite/17_intro/headers/c++2014/operator_names.cc: New.
* testsuite/17_intro/headers/c++2014/stdc++.cc: New.
* testsuite/17_intro/headers/c++2014/stdc++_multiple_inclusion.cc:
New.
PR libstdc++/58265
* doc/xml/manual/intro.xml: Document LWG 2063 and 2064 resolutions.
* doc/html/manual/bugs.html: Regenerate.

View file

@ -11,7 +11,8 @@
The standard library conforms to the dialect of C++ specified by the
<code class="option">-std</code> option passed to the compiler.
By default, <span class="command"><strong>g++</strong></span> is equivalent to
<span class="command"><strong>g++ -std=gnu++98</strong></span>.
<span class="command"><strong>g++ -std=gnu++14</strong></span> since GCC 6, and
<span class="command"><strong>g++ -std=gnu++98</strong></span> for older releases.
</p><div class="table"><a id="table.cmd_options"></a><p class="title"><strong>Table 3.1. C++ Command Options</strong></p><div class="table-contents"><table summary="C++ Command Options" border="1"><colgroup><col align="left" class="c1" /><col align="left" class="c2" /></colgroup><thead><tr><th align="left">Option Flags</th><th align="left">Description</th></tr></thead><tbody><tr><td align="left"><code class="literal">-std=c++98</code> or <code class="literal">-std=c++03</code>
</td><td align="left">Use the 1998 ISO C++ standard plus amendments.</td></tr><tr><td align="left"><code class="literal">-std=gnu++98</code> or <code class="literal">-std=gnu++03</code>
</td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++11</code></td><td align="left">Use the 2011 ISO C++ standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++11</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-std=c++14</code></td><td align="left">Use the 2014 ISO C++ standard.</td></tr><tr><td align="left"><code class="literal">-std=gnu++14</code></td><td align="left">As directly above, with GNU extensions.</td></tr><tr><td align="left"><code class="literal">-fexceptions</code></td><td align="left">See <a class="link" href="using_exceptions.html#intro.using.exception.no" title="Doing without">exception-free dialect</a></td></tr><tr><td align="left"><code class="literal">-frtti</code></td><td align="left">As above, but RTTI-free dialect.</td></tr><tr><td align="left"><code class="literal">-pthread</code> or <code class="literal">-pthreads</code></td><td align="left">For ISO C++11

View file

@ -74,12 +74,15 @@ of <code class="code">std::sinf</code>, <code class="code">std::sin</code>,
and <code class="code">std::sinl</code>.
</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="manual.intro.using.headers.pre"></a>Precompiled Headers</h3></div></div></div><p>There are three base header files that are provided. They can be
used to precompile the standard headers and extensions into binary
files that may the be used to speed compiles that use these headers.
files that may then be used to speed up compilations that use these headers.
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>stdc++.h</p><p>Includes all standard headers. Actual content varies depending on
language dialect.
<a class="link" href="using.html#manual.intro.using.flags" title="Command Options">language dialect</a>.
</p></li><li class="listitem"><p>stdtr1c++.h</p><p>Includes all of &lt;stdc++.h&gt;, and adds all the TR1 headers.
</p></li><li class="listitem"><p>extc++.h</p><p>Includes all of &lt;stdtr1c++.h&gt;, and adds all the Extension headers.
</p></li></ul></div><p>How to construct a .gch file from one of these base header files.</p><p>First, find the include directory for the compiler. One way to do
</p></li><li class="listitem"><p>extc++.h</p><p>Includes all of &lt;stdc++.h&gt;, and adds all the Extension headers
(and in C++98 mode also adds all the TR1 headers by including all of
&lt;stdtr1c++.h&gt;).
</p></li></ul></div><p>To construct a .gch file from one of these base header files,
first find the include directory for the compiler. One way to do
this is:</p><pre class="programlisting">
g++ -v hello.cc

View file

@ -16,7 +16,8 @@
The standard library conforms to the dialect of C++ specified by the
<option>-std</option> option passed to the compiler.
By default, <command>g++</command> is equivalent to
<command>g++ -std=gnu++98</command>.
<command>g++ -std=gnu++14</command> since GCC 6, and
<command>g++ -std=gnu++98</command> for older releases.
</para>
<table frame="all" xml:id="table.cmd_options">
@ -718,7 +719,7 @@ and <code>std::sinl</code>.
<para>There are three base header files that are provided. They can be
used to precompile the standard headers and extensions into binary
files that may the be used to speed compiles that use these headers.
files that may then be used to speed up compilations that use these headers.
</para>
@ -726,7 +727,7 @@ files that may the be used to speed compiles that use these headers.
<listitem>
<para>stdc++.h</para>
<para>Includes all standard headers. Actual content varies depending on
language dialect.
<link linkend="manual.intro.using.flags">language dialect</link>.
</para>
</listitem>
@ -737,13 +738,14 @@ language dialect.
</listitem>
<listitem><para>extc++.h</para>
<para>Includes all of &lt;stdtr1c++.h&gt;, and adds all the Extension headers.
<para>Includes all of &lt;stdc++.h&gt;, and adds all the Extension headers
(and in C++98 mode also adds all the TR1 headers by including all of
&lt;stdtr1c++.h&gt;).
</para></listitem>
</itemizedlist>
<para>How to construct a .gch file from one of these base header files.</para>
<para>First, find the include directory for the compiler. One way to do
<para>To construct a .gch file from one of these base header files,
first find the include directory for the compiler. One way to do
this is:</para>
<programlisting>

View file

@ -28,15 +28,25 @@
#if __cplusplus < 201103L
#include <bits/stdtr1c++.h>
#else
#include <bits/stdc++.h>
#endif
#include <ext/algorithm>
#if __cplusplus >= 201103L
# include <ext/aligned_buffer.h>
#endif
#include <ext/alloc_traits.h>
#include <ext/array_allocator.h>
#include <ext/atomicity.h>
#include <ext/bitmap_allocator.h>
#include <ext/cast.h>
#if __cplusplus >= 201103L
# include <ext/cmath>
#endif
#include <ext/concurrence.h>
#include <ext/debug_allocator.h>
#include <ext/enc_filebuf.h>
#include <ext/extptr_allocator.h>
#include <ext/functional>
#include <ext/iterator>
@ -45,9 +55,13 @@
#include <ext/mt_allocator.h>
#include <ext/new_allocator.h>
#include <ext/numeric>
#include <ext/numeric_traits.h>
#include <ext/pod_char_traits.h>
#include <ext/pointer.h>
#include <ext/pool_allocator.h>
#if __cplusplus >= 201103L
# include <ext/random>
#endif
#include <ext/rb_tree>
#include <ext/rope>
#include <ext/slist>

View file

@ -35,7 +35,6 @@
#define unused 1
#endif
#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
#include <bits/extc++.h>
int

View file

@ -19,5 +19,4 @@
// { dg-do compile }
// libstdc++/67309
#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
#include <bits/extc++.h>

View file

@ -34,7 +34,6 @@
#define unused 1
#endif
#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
#include <bits/extc++.h>
int

View file

@ -34,8 +34,6 @@
#define unused 1
#endif
#include <bits/stdc++.h> // TODO: this is missing from <bits/extc++.h>
#include <shared_mutex> // TODO: this is missing from <bits/stdc++.h>
#include <bits/extc++.h>
int

View file

@ -0,0 +1,21 @@
// { dg-do compile }
// { dg-options "-std=gnu++14 -fno-exceptions" }
// Copyright (C) 2015 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/>.
#include <bits/extc++.h>

View file

@ -0,0 +1,21 @@
// { dg-do compile }
// { dg-options "-std=gnu++14 -fno-rtti" }
// Copyright (C) 2015 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/>.
#include <bits/extc++.h>

View file

@ -0,0 +1,21 @@
// { dg-do compile }
// { dg-options "-std=gnu++14 -pedantic-errors" }
// Copyright (C) 2015 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/>.
#include <bits/extc++.h>

View file

@ -0,0 +1,30 @@
// { dg-do compile }
// { dg-options "-std=gnu++14 -fno-operator-names" }
// Copyright (C) 2015 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/>.
// libstdc++/47662
// Avoid using PCH
#include <cerrno>
#include <bits/stdc++.h>
#include <bits/stdtr1c++.h>
#include <bits/extc++.h>
int or, xor, and;

View file

@ -0,0 +1,70 @@
// FreeBSD wants warning clean system headers:
// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* *-*-dragonfly* } }
// { dg-options "-std=gnu++14" }
// { dg-do compile }
// Copyright (C) 2015 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/>.
// 17.4.1.2 Headers
#include <bits/stdc++.h>
// "C" compatibility headers
#include <assert.h>
#ifdef _GLIBCXX_HAVE_COMPLEX_H
#include <complex.h>
#endif
#include <ctype.h>
#include <errno.h>
#ifdef _GLIBCXX_HAVE_FENV_H
#include <fenv.h>
#endif
#include <float.h>
#ifdef _GLIBCXX_HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <iso646.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#ifdef _GLIBCXX_HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#include <stddef.h>
#ifdef _GLIBCXX_HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _GLIBCXX_HAVE_TGMATH_H
#include <tgmath.h>
#endif
#include <time.h>
#if __has_include(<uchar.h>)
#include <uchar.h>
#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
#ifdef _GLIBCXX_HAVE_WCTYPE_H
#include <wctype.h>
#endif

View file

@ -0,0 +1,117 @@
// FreeBSD wants warning clean system headers:
// { dg-options "-Wall -Wsystem-headers" { target *-*-freebsd* *-*-dragonfly* } }
// { dg-options "-std=gnu++14" }
// { dg-do compile }
// Copyright (C) 2015 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/>.
// 17.4.1.2 Headers
#include <bits/stdc++.h>
// "C" compatibility headers
#include <assert.h>
#ifdef _GLIBCXX_HAVE_COMPLEX_H
#include <complex.h>
#endif
#include <ctype.h>
#include <errno.h>
#ifdef _GLIBCXX_HAVE_FENV_H
#include <fenv.h>
#endif
#include <float.h>
#ifdef _GLIBCXX_HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <iso646.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#ifdef _GLIBCXX_HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#include <stddef.h>
#ifdef _GLIBCXX_HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _GLIBCXX_HAVE_TGMATH_H
#include <tgmath.h>
#endif
#include <time.h>
#if __has_include(<uchar.h>)
#include <uchar.h>
#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
#ifdef _GLIBCXX_HAVE_WCTYPE_H
#include <wctype.h>
#endif
#include <bits/stdc++.h>
// "C" compatibility headers
#include <assert.h>
#ifdef _GLIBCXX_HAVE_COMPLEX_H
#include <complex.h>
#endif
#include <ctype.h>
#include <errno.h>
#ifdef _GLIBCXX_HAVE_FENV_H
#include <fenv.h>
#endif
#include <float.h>
#ifdef _GLIBCXX_HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <iso646.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#ifdef _GLIBCXX_HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#include <stddef.h>
#ifdef _GLIBCXX_HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _GLIBCXX_HAVE_TGMATH_H
#include <tgmath.h>
#endif
#include <time.h>
#if __has_include(<uchar.h>)
#include <uchar.h>
#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
#ifdef _GLIBCXX_HAVE_WCTYPE_H
#include <wctype.h>
#endif