From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libstdc++-v3/doc/html/manual/abi.html | 522 ++++++++++++ libstdc++-v3/doc/html/manual/algorithms.html | 61 ++ libstdc++-v3/doc/html/manual/api.html | 240 ++++++ .../doc/html/manual/appendix_contributing.html | 117 +++ libstdc++-v3/doc/html/manual/appendix_free.html | 126 +++ libstdc++-v3/doc/html/manual/appendix_gfdl.html | 449 ++++++++++ libstdc++-v3/doc/html/manual/appendix_gpl.html | 683 +++++++++++++++ libstdc++-v3/doc/html/manual/appendix_porting.html | 230 ++++++ libstdc++-v3/doc/html/manual/associative.html | 192 +++++ libstdc++-v3/doc/html/manual/atomics.html | 31 + libstdc++-v3/doc/html/manual/backwards.html | 920 +++++++++++++++++++++ libstdc++-v3/doc/html/manual/bitmap_allocator.html | 340 ++++++++ libstdc++-v3/doc/html/manual/bk01pt02.html | 46 ++ libstdc++-v3/doc/html/manual/bk01pt02ch05s02.html | 50 ++ libstdc++-v3/doc/html/manual/bk01pt03ch17s02.html | 55 ++ libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html | 24 + libstdc++-v3/doc/html/manual/bk01pt03ch17s04.html | 412 +++++++++ libstdc++-v3/doc/html/manual/bk01pt03ch18s02.html | 11 + libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html | 66 ++ libstdc++-v3/doc/html/manual/bk01pt03ch18s04.html | 213 +++++ libstdc++-v3/doc/html/manual/bk01pt03ch18s05.html | 26 + libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html | 122 +++ libstdc++-v3/doc/html/manual/bk01pt03ch19s03.html | 10 + libstdc++-v3/doc/html/manual/bk01pt03ch19s04.html | 18 + libstdc++-v3/doc/html/manual/bk01pt03ch19s05.html | 51 ++ libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html | 68 ++ libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html | 558 +++++++++++++ libstdc++-v3/doc/html/manual/bk01pt03ch21s02.html | 43 + libstdc++-v3/doc/html/manual/bk01pt03ch21s03.html | 50 ++ libstdc++-v3/doc/html/manual/bk01pt03ch28s02.html | 41 + libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html | 36 + libstdc++-v3/doc/html/manual/bk01pt03pr01.html | 26 + libstdc++-v3/doc/html/manual/bk01pt04.html | 21 + libstdc++-v3/doc/html/manual/bugs.html | 352 ++++++++ libstdc++-v3/doc/html/manual/concurrency.html | 42 + libstdc++-v3/doc/html/manual/configure.html | 211 +++++ libstdc++-v3/doc/html/manual/containers.html | 55 ++ libstdc++-v3/doc/html/manual/containers_and_c.html | 90 ++ libstdc++-v3/doc/html/manual/debug.html | 231 ++++++ libstdc++-v3/doc/html/manual/debug_mode.html | 37 + libstdc++-v3/doc/html/manual/diagnostics.html | 43 + .../doc/html/manual/documentation_hacking.html | 442 ++++++++++ libstdc++-v3/doc/html/manual/dynamic_memory.html | 72 ++ libstdc++-v3/doc/html/manual/ext_algorithms.html | 23 + libstdc++-v3/doc/html/manual/ext_allocators.html | 397 +++++++++ .../doc/html/manual/ext_compile_checks.html | 40 + libstdc++-v3/doc/html/manual/ext_concurrency.html | 91 ++ libstdc++-v3/doc/html/manual/ext_containers.html | 9 + libstdc++-v3/doc/html/manual/ext_demangling.html | 74 ++ libstdc++-v3/doc/html/manual/ext_io.html | 50 ++ libstdc++-v3/doc/html/manual/ext_iterators.html | 14 + libstdc++-v3/doc/html/manual/ext_numerics.html | 20 + libstdc++-v3/doc/html/manual/ext_utilities.html | 41 + libstdc++-v3/doc/html/manual/extensions.html | 9 + libstdc++-v3/doc/html/manual/facets.html | 728 ++++++++++++++++ libstdc++-v3/doc/html/manual/fstreams.html | 150 ++++ .../manual/generalized_numeric_operations.html | 32 + libstdc++-v3/doc/html/manual/internals.html | 371 +++++++++ libstdc++-v3/doc/html/manual/intro.html | 9 + libstdc++-v3/doc/html/manual/io.html | 121 +++ libstdc++-v3/doc/html/manual/io_and_c.html | 57 ++ libstdc++-v3/doc/html/manual/iterators.html | 130 +++ libstdc++-v3/doc/html/manual/license.html | 105 +++ libstdc++-v3/doc/html/manual/localization.html | 436 ++++++++++ libstdc++-v3/doc/html/manual/make.html | 9 + libstdc++-v3/doc/html/manual/memory.html | 699 ++++++++++++++++ libstdc++-v3/doc/html/manual/numerics.html | 30 + libstdc++-v3/doc/html/manual/numerics_and_c.html | 37 + libstdc++-v3/doc/html/manual/pairs.html | 45 + libstdc++-v3/doc/html/manual/parallel_mode.html | 24 + libstdc++-v3/doc/html/manual/profile_mode.html | 146 ++++ libstdc++-v3/doc/html/manual/setup.html | 102 +++ .../doc/html/manual/source_code_style.html | 620 ++++++++++++++ .../doc/html/manual/source_design_notes.html | 863 +++++++++++++++++++ .../doc/html/manual/source_organization.html | 97 +++ libstdc++-v3/doc/html/manual/spine.html | 67 ++ libstdc++-v3/doc/html/manual/status.html | 283 +++++++ libstdc++-v3/doc/html/manual/streambufs.html | 137 +++ libstdc++-v3/doc/html/manual/strings.html | 366 ++++++++ libstdc++-v3/doc/html/manual/stringstreams.html | 37 + libstdc++-v3/doc/html/manual/support.html | 130 +++ libstdc++-v3/doc/html/manual/termination.html | 124 +++ libstdc++-v3/doc/html/manual/test.html | 639 ++++++++++++++ libstdc++-v3/doc/html/manual/traits.html | 10 + libstdc++-v3/doc/html/manual/using.html | 15 + .../doc/html/manual/using_concurrency.html | 205 +++++ .../doc/html/manual/using_dynamic_or_shared.html | 109 +++ libstdc++-v3/doc/html/manual/using_exceptions.html | 307 +++++++ libstdc++-v3/doc/html/manual/using_headers.html | 104 +++ libstdc++-v3/doc/html/manual/using_macros.html | 77 ++ libstdc++-v3/doc/html/manual/using_namespaces.html | 61 ++ libstdc++-v3/doc/html/manual/utilities.html | 17 + 92 files changed, 15700 insertions(+) create mode 100644 libstdc++-v3/doc/html/manual/abi.html create mode 100644 libstdc++-v3/doc/html/manual/algorithms.html create mode 100644 libstdc++-v3/doc/html/manual/api.html create mode 100644 libstdc++-v3/doc/html/manual/appendix_contributing.html create mode 100644 libstdc++-v3/doc/html/manual/appendix_free.html create mode 100644 libstdc++-v3/doc/html/manual/appendix_gfdl.html create mode 100644 libstdc++-v3/doc/html/manual/appendix_gpl.html create mode 100644 libstdc++-v3/doc/html/manual/appendix_porting.html create mode 100644 libstdc++-v3/doc/html/manual/associative.html create mode 100644 libstdc++-v3/doc/html/manual/atomics.html create mode 100644 libstdc++-v3/doc/html/manual/backwards.html create mode 100644 libstdc++-v3/doc/html/manual/bitmap_allocator.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt02.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt02ch05s02.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch17s02.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch17s04.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch18s02.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch18s04.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch18s05.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch19s03.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch19s04.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch19s05.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch21s02.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch21s03.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch28s02.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt03pr01.html create mode 100644 libstdc++-v3/doc/html/manual/bk01pt04.html create mode 100644 libstdc++-v3/doc/html/manual/bugs.html create mode 100644 libstdc++-v3/doc/html/manual/concurrency.html create mode 100644 libstdc++-v3/doc/html/manual/configure.html create mode 100644 libstdc++-v3/doc/html/manual/containers.html create mode 100644 libstdc++-v3/doc/html/manual/containers_and_c.html create mode 100644 libstdc++-v3/doc/html/manual/debug.html create mode 100644 libstdc++-v3/doc/html/manual/debug_mode.html create mode 100644 libstdc++-v3/doc/html/manual/diagnostics.html create mode 100644 libstdc++-v3/doc/html/manual/documentation_hacking.html create mode 100644 libstdc++-v3/doc/html/manual/dynamic_memory.html create mode 100644 libstdc++-v3/doc/html/manual/ext_algorithms.html create mode 100644 libstdc++-v3/doc/html/manual/ext_allocators.html create mode 100644 libstdc++-v3/doc/html/manual/ext_compile_checks.html create mode 100644 libstdc++-v3/doc/html/manual/ext_concurrency.html create mode 100644 libstdc++-v3/doc/html/manual/ext_containers.html create mode 100644 libstdc++-v3/doc/html/manual/ext_demangling.html create mode 100644 libstdc++-v3/doc/html/manual/ext_io.html create mode 100644 libstdc++-v3/doc/html/manual/ext_iterators.html create mode 100644 libstdc++-v3/doc/html/manual/ext_numerics.html create mode 100644 libstdc++-v3/doc/html/manual/ext_utilities.html create mode 100644 libstdc++-v3/doc/html/manual/extensions.html create mode 100644 libstdc++-v3/doc/html/manual/facets.html create mode 100644 libstdc++-v3/doc/html/manual/fstreams.html create mode 100644 libstdc++-v3/doc/html/manual/generalized_numeric_operations.html create mode 100644 libstdc++-v3/doc/html/manual/internals.html create mode 100644 libstdc++-v3/doc/html/manual/intro.html create mode 100644 libstdc++-v3/doc/html/manual/io.html create mode 100644 libstdc++-v3/doc/html/manual/io_and_c.html create mode 100644 libstdc++-v3/doc/html/manual/iterators.html create mode 100644 libstdc++-v3/doc/html/manual/license.html create mode 100644 libstdc++-v3/doc/html/manual/localization.html create mode 100644 libstdc++-v3/doc/html/manual/make.html create mode 100644 libstdc++-v3/doc/html/manual/memory.html create mode 100644 libstdc++-v3/doc/html/manual/numerics.html create mode 100644 libstdc++-v3/doc/html/manual/numerics_and_c.html create mode 100644 libstdc++-v3/doc/html/manual/pairs.html create mode 100644 libstdc++-v3/doc/html/manual/parallel_mode.html create mode 100644 libstdc++-v3/doc/html/manual/profile_mode.html create mode 100644 libstdc++-v3/doc/html/manual/setup.html create mode 100644 libstdc++-v3/doc/html/manual/source_code_style.html create mode 100644 libstdc++-v3/doc/html/manual/source_design_notes.html create mode 100644 libstdc++-v3/doc/html/manual/source_organization.html create mode 100644 libstdc++-v3/doc/html/manual/spine.html create mode 100644 libstdc++-v3/doc/html/manual/status.html create mode 100644 libstdc++-v3/doc/html/manual/streambufs.html create mode 100644 libstdc++-v3/doc/html/manual/strings.html create mode 100644 libstdc++-v3/doc/html/manual/stringstreams.html create mode 100644 libstdc++-v3/doc/html/manual/support.html create mode 100644 libstdc++-v3/doc/html/manual/termination.html create mode 100644 libstdc++-v3/doc/html/manual/test.html create mode 100644 libstdc++-v3/doc/html/manual/traits.html create mode 100644 libstdc++-v3/doc/html/manual/using.html create mode 100644 libstdc++-v3/doc/html/manual/using_concurrency.html create mode 100644 libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html create mode 100644 libstdc++-v3/doc/html/manual/using_exceptions.html create mode 100644 libstdc++-v3/doc/html/manual/using_headers.html create mode 100644 libstdc++-v3/doc/html/manual/using_macros.html create mode 100644 libstdc++-v3/doc/html/manual/using_namespaces.html create mode 100644 libstdc++-v3/doc/html/manual/utilities.html (limited to 'libstdc++-v3/doc/html/manual') diff --git a/libstdc++-v3/doc/html/manual/abi.html b/libstdc++-v3/doc/html/manual/abi.html new file mode 100644 index 000000000..dc4bf5a75 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/abi.html @@ -0,0 +1,522 @@ + + +ABI Policy and Guidelines

+

+ C++ applications often depend on specific language support + routines, say for throwing exceptions, or catching exceptions, and + perhaps also depend on features in the C++ Standard Library. +

+ The C++ Standard Library has many include files, types defined in + those include files, specific named functions, and other + behavior. The text of these behaviors, as written in source include + files, is called the Application Programing Interface, or API. +

+ Furthermore, C++ source that is compiled into object files is + transformed by the compiler: it arranges objects with specific + alignment and in a particular layout, mangling names according to a + well-defined algorithm, has specific arrangements for the support of + virtual functions, etc. These details are defined as the compiler + Application Binary Interface, or ABI. The GNU C++ compiler uses an + industry-standard C++ ABI starting with version 3. Details can be + found in the ABI + specification. +

+ The GNU C++ compiler, g++, has a compiler command line option to + switch between various different C++ ABIs. This explicit version + switch is the flag -fabi-version. In addition, some + g++ command line options may change the ABI as a side-effect of + use. Such flags include -fpack-struct and + -fno-exceptions, but include others: see the complete + list in the GCC manual under the heading Options + for Code Generation Conventions. +

+ The configure options used when building a specific libstdc++ + version may also impact the resulting library ABI. The available + configure options, and their impact on the library ABI, are + documented +here. +

Putting all of these ideas together results in the C++ Standard +library ABI, which is the compilation of a given library API by a +given compiler ABI. In a nutshell: +

+ + library API + compiler ABI = library ABI + +

+ The library ABI is mostly of interest for end-users who have + unresolved symbols and are linking dynamically to the C++ Standard + library, and who thus must be careful to compile their application + with a compiler that is compatible with the available C++ Standard + library binary. In this case, compatible is defined with the equation + above: given an application compiled with a given compiler ABI and + library API, it will work correctly with a Standard C++ Library + created with the same constraints. +

+ To use a specific version of the C++ ABI, one must use a + corresponding GNU C++ toolchain (i.e., g++ and libstdc++) that + implements the C++ ABI in question. +

The C++ interface has evolved throughout the history of the GNU +C++ toolchain. With each release, various details have been changed so +as to give distinct versions to the C++ interface. +

+ How can this complexity be managed? What does C++ versioning mean? + Because library and compiler changes often make binaries compiled + with one version of the GNU tools incompatible with binaries + compiled with other (either newer or older) versions of the same GNU + tools, specific techniques are used to make managing this complexity + easier. +

+ The following techniques are used: +

  1. Release versioning on the libgcc_s.so binary.

    This is implemented via file names and the ELF + DT_SONAME mechanism (at least on ELF + systems). It is versioned as follows: +

    For m68k-linux the versions differ as follows:

    For hppa-linux the versions differ as follows:

  2. Symbol versioning on the libgcc_s.so binary.

    It is versioned with the following labels and version + definitions, where the version definition is the maximum for a + particular release. Labels are cumulative. If a particular release + is not listed, it has the same version labels as the preceding + release.

    This corresponds to the mapfile: gcc/libgcc-std.ver

  3. + Release versioning on the libstdc++.so binary, implemented in + the same way as the libgcc_s.so binary above. Listed is the + filename: DT_SONAME can be deduced from + the filename by removing the last two period-delimited numbers. For + example, filename libstdc++.so.5.0.4 + corresponds to a DT_SONAME of + libstdc++.so.5. Binaries with equivalent + DT_SONAMEs are forward-compatibile: in + the table below, releases incompatible with the previous + one are explicitly noted. +

    It is versioned as follows: +

    + Note 1: Error should be libstdc++.so.3.0.3. +

    + Note 2: Not strictly required. +

    + Note 3: This release (but not previous or subsequent) has one + known incompatibility, see 33678 + in the GCC bug database. +

  4. Symbol versioning on the libstdc++.so binary.

    mapfile: libstdc++-v3/config/abi/pre/gnu.ver

    It is versioned with the following labels and version + definitions, where the version definition is the maximum for a + particular release. Note, only symbols which are newly introduced + will use the maximum version definition. Thus, for release series + with the same label, but incremented version definitions, the later + release has both versions. (An example of this would be the + gcc-3.2.1 release, which has GLIBCPP_3.2.1 for new symbols and + GLIBCPP_3.2 for symbols that were introduced in the gcc-3.2.0 + release.) If a particular release is not listed, it has the same + version labels as the preceding release. +

    • gcc-3.0.0: (Error, not versioned)

    • gcc-3.0.1: (Error, not versioned)

    • gcc-3.0.2: (Error, not versioned)

    • gcc-3.0.3: (Error, not versioned)

    • gcc-3.0.4: (Error, not versioned)

    • gcc-3.1.0: GLIBCPP_3.1, CXXABI_1

    • gcc-3.1.1: GLIBCPP_3.1, CXXABI_1

    • gcc-3.2.0: GLIBCPP_3.2, CXXABI_1.2

    • gcc-3.2.1: GLIBCPP_3.2.1, CXXABI_1.2

    • gcc-3.2.2: GLIBCPP_3.2.2, CXXABI_1.2

    • gcc-3.2.3: GLIBCPP_3.2.2, CXXABI_1.2

    • gcc-3.3.0: GLIBCPP_3.2.2, CXXABI_1.2.1

    • gcc-3.3.1: GLIBCPP_3.2.3, CXXABI_1.2.1

    • gcc-3.3.2: GLIBCPP_3.2.3, CXXABI_1.2.1

    • gcc-3.3.3: GLIBCPP_3.2.3, CXXABI_1.2.1

    • gcc-3.4.0: GLIBCXX_3.4, CXXABI_1.3

    • gcc-3.4.1: GLIBCXX_3.4.1, CXXABI_1.3

    • gcc-3.4.2: GLIBCXX_3.4.2

    • gcc-3.4.3: GLIBCXX_3.4.3

    • gcc-4.0.0: GLIBCXX_3.4.4, CXXABI_1.3.1

    • gcc-4.0.1: GLIBCXX_3.4.5

    • gcc-4.0.2: GLIBCXX_3.4.6

    • gcc-4.0.3: GLIBCXX_3.4.7

    • gcc-4.1.1: GLIBCXX_3.4.8

    • gcc-4.2.0: GLIBCXX_3.4.9

    • gcc-4.3.0: GLIBCXX_3.4.10, CXXABI_1.3.2

    • gcc-4.4.0: GLIBCXX_3.4.11, CXXABI_1.3.3

    • gcc-4.4.1: GLIBCXX_3.4.12, CXXABI_1.3.3

    • gcc-4.4.2: GLIBCXX_3.4.13, CXXABI_1.3.3

    • gcc-4.5.0: GLIBCXX_3.4.14, CXXABI_1.3.4

  5. Incremental bumping of a compiler pre-defined macro, + __GXX_ABI_VERSION. This macro is defined as the version of the + compiler v3 ABI, with g++ 3.0.x being version 100. This macro will + be automatically defined whenever g++ is used (the curious can + test this by invoking g++ with the '-v' flag.) +

    + This macro was defined in the file "lang-specs.h" in the gcc/cp directory. + Later versions defined it in "c-common.c" in the gcc directory, and from + G++ 3.4 it is defined in c-cppbuiltin.c and its value determined by the + '-fabi-version' command line option. +

    + It is versioned as follows, where 'n' is given by '-fabi-version=n': +

    • gcc-3.0.x: 100

    • gcc-3.1.x: 100 (Error, should be 101)

    • gcc-3.2.x: 102

    • gcc-3.3.x: 102

    • gcc-3.4.x, gcc-4.[0-5].x: 102 (when n=1)

    • gcc-3.4.x, gcc-4.[0-5].x: 1000 + n (when n>1)

    • gcc-3.4.x, gcc-4.[0-5].x: 999999 (when n=0)

  6. Changes to the default compiler option for + -fabi-version. +

    + It is versioned as follows: +

    • gcc-3.0.x: (Error, not versioned)

    • gcc-3.1.x: (Error, not versioned)

    • gcc-3.2.x: -fabi-version=1

    • gcc-3.3.x: -fabi-version=1

    • gcc-3.4.x, gcc-4.[0-5].x: -fabi-version=2 (Incompatible with previous)

  7. Incremental bumping of a library pre-defined macro. For releases + before 3.4.0, the macro is __GLIBCPP__. For later releases, it's + __GLIBCXX__. (The libstdc++ project generously changed from CPP to + CXX throughout its source to allow the "C" pre-processor the CPP + macro namespace.) These macros are defined as the date the library + was released, in compressed ISO date format, as an unsigned long. +

    + This macro is defined in the file "c++config" in the + "libstdc++-v3/include/bits" directory. (Up to gcc-4.1.0, it was + changed every night by an automated script. Since gcc-4.1.0, it is + the same value as gcc/DATESTAMP.) +

    + It is versioned as follows: +

    • gcc-3.0.0: 20010615

    • gcc-3.0.1: 20010819

    • gcc-3.0.2: 20011023

    • gcc-3.0.3: 20011220

    • gcc-3.0.4: 20020220

    • gcc-3.1.0: 20020514

    • gcc-3.1.1: 20020725

    • gcc-3.2.0: 20020814

    • gcc-3.2.1: 20021119

    • gcc-3.2.2: 20030205

    • gcc-3.2.3: 20030422

    • gcc-3.3.0: 20030513

    • gcc-3.3.1: 20030804

    • gcc-3.3.2: 20031016

    • gcc-3.3.3: 20040214

    • gcc-3.4.0: 20040419

    • gcc-3.4.1: 20040701

    • gcc-3.4.2: 20040906

    • gcc-3.4.3: 20041105

    • gcc-3.4.4: 20050519

    • gcc-3.4.5: 20051201

    • gcc-3.4.6: 20060306

    • gcc-4.0.0: 20050421

    • gcc-4.0.1: 20050707

    • gcc-4.0.2: 20050921

    • gcc-4.0.3: 20060309

    • gcc-4.1.0: 20060228

    • gcc-4.1.1: 20060524

    • gcc-4.1.2: 20070214

    • gcc-4.2.0: 20070514

    • gcc-4.2.1: 20070719

    • gcc-4.2.2: 20071007

    • gcc-4.2.3: 20080201

    • gcc-4.2.4: 20080519

    • gcc-4.3.0: 20080306

    • gcc-4.3.1: 20080606

    • gcc-4.3.2: 20080827

    • gcc-4.3.3: 20090124

    • gcc-4.4.0: 20090421

    • gcc-4.4.1: 20090722

    • gcc-4.4.2: 20091015

  8. + Incremental bumping of a library pre-defined macro, + _GLIBCPP_VERSION. This macro is defined as the released version of + the library, as a string literal. This is only implemented in + gcc-3.1.0 releases and higher, and is deprecated in 3.4 (where it + is called _GLIBCXX_VERSION). +

    + This macro is defined in the file "c++config" in the + "libstdc++-v3/include/bits" directory and is generated + automatically by autoconf as part of the configure-time generation + of config.h. +

    + It is versioned as follows: +

    • gcc-3.0.0: "3.0.0"

    • gcc-3.0.1: "3.0.0" (Error, should be "3.0.1")

    • gcc-3.0.2: "3.0.0" (Error, should be "3.0.2")

    • gcc-3.0.3: "3.0.0" (Error, should be "3.0.3")

    • gcc-3.0.4: "3.0.0" (Error, should be "3.0.4")

    • gcc-3.1.0: "3.1.0"

    • gcc-3.1.1: "3.1.1"

    • gcc-3.2.0: "3.2"

    • gcc-3.2.1: "3.2.1"

    • gcc-3.2.2: "3.2.2"

    • gcc-3.2.3: "3.2.3"

    • gcc-3.3.0: "3.3"

    • gcc-3.3.1: "3.3.1"

    • gcc-3.3.2: "3.3.2"

    • gcc-3.3.3: "3.3.3"

    • gcc-3.4.x: "version-unused"

    • gcc-4.[0-5].x: "version-unused"

  9. + Matching each specific C++ compiler release to a specific set of + C++ include files. This is only implemented in gcc-3.1.1 releases + and higher. +

    + All C++ includes are installed in include/c++, then nest in a + directory hierarchy corresponding to the C++ compiler's released + version. This version corresponds to the variable "gcc_version" in + "libstdc++-v3/acinclude.m4," and more details can be found in that + file's macro GLIBCXX_CONFIGURE (GLIBCPP_CONFIGURE before gcc-3.4.0). +

    + C++ includes are versioned as follows: +

    • gcc-3.0.0: include/g++-v3

    • gcc-3.0.1: include/g++-v3

    • gcc-3.0.2: include/g++-v3

    • gcc-3.0.3: include/g++-v3

    • gcc-3.0.4: include/g++-v3

    • gcc-3.1.0: include/g++-v3

    • gcc-3.1.1: include/c++/3.1.1

    • gcc-3.2.0: include/c++/3.2

    • gcc-3.2.1: include/c++/3.2.1

    • gcc-3.2.2: include/c++/3.2.2

    • gcc-3.2.3: include/c++/3.2.3

    • gcc-3.3.0: include/c++/3.3

    • gcc-3.3.1: include/c++/3.3.1

    • gcc-3.3.2: include/c++/3.3.2

    • gcc-3.3.3: include/c++/3.3.3

    • gcc-3.4.0: include/c++/3.4.0

    • gcc-3.4.1: include/c++/3.4.1

    • gcc-3.4.2: include/c++/3.4.2

    • gcc-3.4.3: include/c++/3.4.3

    • gcc-3.4.4: include/c++/3.4.4

    • gcc-3.4.5: include/c++/3.4.5

    • gcc-3.4.6: include/c++/3.4.6

    • gcc-4.0.0: include/c++/4.0.0

    • gcc-4.0.1: include/c++/4.0.1

    • gcc-4.0.2: include/c++/4.0.2

    • gcc-4.0.3: include/c++/4.0.3

    • gcc-4.1.0: include/c++/4.1.0

    • gcc-4.1.1: include/c++/4.1.1

    • gcc-4.1.2: include/c++/4.1.2

    • gcc-4.2.0: include/c++/4.2.0

    • gcc-4.2.1: include/c++/4.2.1

    • gcc-4.2.2: include/c++/4.2.2

    • gcc-4.2.3: include/c++/4.2.3

    • gcc-4.2.4: include/c++/4.2.4

    • gcc-4.3.0: include/c++/4.3.0

    • gcc-4.3.1: include/c++/4.3.1

    • gcc-4.3.3: include/c++/4.3.3

    • gcc-4.3.4: include/c++/4.3.4

    • gcc-4.4.0: include/c++/4.4.0

    • gcc-4.4.1: include/c++/4.4.1

    • gcc-4.4.2: include/c++/4.4.2

    • gcc-4.5.0: include/c++/4.5.0

+ Taken together, these techniques can accurately specify interface + and implementation changes in the GNU C++ tools themselves. Used + properly, they allow both the GNU C++ tools implementation, and + programs using them, an evolving yet controlled development that + maintains backward compatibility. +

+ It turns out that most of the configure options that change + default behavior will impact the mangled names of exported + symbols, and thus impact versioning and compatibility. +

+ For more information on configure options, including ABI + impacts, see: + here +

+ There is one flag that explicitly deals with symbol versioning: + --enable-symvers. +

+ In particular, libstdc++-v3/acinclude.m4 has a macro called + GLIBCXX_ENABLE_SYMVERS that defaults to yes (or the argument + passed in via --enable-symvers=foo). At that point, the macro + attempts to make sure that all the requirement for symbol + versioning are in place. For more information, please consult + acinclude.m4. +

  1. + Separation of interface and implementation +

    + This is accomplished by two techniques that separate the API from + the ABI: forcing undefined references to link against a library + binary for definitions. +

    + In addition, these techniques have the additional benefit that they + reduce binary size, which can increase runtime performance. +

  2. + Namespaces linking symbol definitions to export mapfiles +

    + All symbols in the shared library binary are processed by a + linker script at build time that either allows or disallows + external linkage. Because of this, some symbols, regardless of + normal C/C++ linkage, are not visible. Symbols that are internal + have several appealing characteristics: by not exporting the + symbols, there are no relocations when the shared library is + started and thus this makes for faster runtime loading + performance by the underlying dynamic loading mechanism. In + addition, they have the possibility of changing without impacting + ABI compatibility. +

    The following namespaces are transformed by the mapfile:

    +

  3. Freezing the API

    Disallowed changes, as above, are not made on a stable release +branch. Enforcement tends to be less strict with GNU extensions that +standard includes.

+ Testing for GNU C++ ABI changes is composed of two distinct + areas: testing the C++ compiler (g++) for compiler changes, and + testing the C++ library (libstdc++) for library changes. +

+ Testing the C++ compiler ABI can be done various ways. +

+ One. Intel ABI checker. +

+Two. +The second is yet unreleased, but has been announced on the gcc +mailing list. It is yet unspecified if these tools will be freely +available, and able to be included in a GNU project. Please contact +Mark Mitchell (mark@codesourcery.com) for more details, and current +status. +

+Three. +Involves using the vlad.consistency test framework. This has also been +discussed on the gcc mailing lists. +

+Testing the C++ library ABI can also be done various ways. +

+One. +(Brendan Kehoe, Jeff Law suggestion to run 'make check-c++' two ways, +one with a new compiler and an old library, and the other with an old +compiler and a new library, and look for testsuite regressions) +

+Details on how to set this kind of test up can be found here: +http://gcc.gnu.org/ml/gcc/2002-08/msg00142.html +

+Two. +Use the 'make check-abi' rule in the libstdc++ Makefile. +

+This is a proactive check of the library ABI. Currently, exported symbol +names that are either weak or defined are checked against a last known +good baseline. Currently, this baseline is keyed off of 3.4.0 +binaries, as this was the last time the .so number was incremented. In +addition, all exported names are demangled, and the exported objects +are checked to make sure they are the same size as the same object in +the baseline. + +Notice that each baseline is relative to a default +configured library and compiler: in particular, if options such as +--enable-clocale, or --with-cpu, in case of multilibs, are used at +configure time, the check may fail, either because of substantive +differences or because of limitations of the current checking +machinery. +

+This dataset is insufficient, yet a start. Also needed is a +comprehensive check for all user-visible types part of the standard +library for sizeof() and alignof() changes. +

+Verifying compatible layouts of objects is not even attempted. It +should be possible to use sizeof, alignof, and offsetof to compute +offsets for each structure and type in the standard library, saving to +another datafile. Then, compute this in a similar way for new +binaries, and look for differences. +

+Another approach might be to use the -fdump-class-hierarchy flag to +get information. However, currently this approach gives insufficient +data for use in library testing, as class data members, their offsets, +and other detailed data is not displayed with this flag. +(See PR g++/7470 on how this was used to find bugs.) +

+Perhaps there are other C++ ABI checkers. If so, please notify +us. We'd like to know about them! +

+A "C" application, dynamically linked to two shared libraries, liba, +libb. The dependent library liba is a C++ shared library compiled with +gcc-3.3.x, and uses io, exceptions, locale, etc. The dependent library +libb is a C++ shared library compiled with gcc-3.4.x, and also uses io, +exceptions, locale, etc. +

As above, libone is constructed as follows:

+%$bld/H-x86-gcc-3.4.0/bin/g++ -fPIC -DPIC -c a.cc
+
+%$bld/H-x86-gcc-3.4.0/bin/g++ -shared -Wl,-soname -Wl,libone.so.1 -Wl,-O1 -Wl,-z,defs a.o -o libone.so.1.0.0
+
+%ln -s libone.so.1.0.0 libone.so
+
+%$bld/H-x86-gcc-3.4.0/bin/g++ -c a.cc
+
+%ar cru libone.a a.o
+

And, libtwo is constructed as follows:

+%$bld/H-x86-gcc-3.3.3/bin/g++ -fPIC -DPIC -c b.cc
+
+%$bld/H-x86-gcc-3.3.3/bin/g++ -shared -Wl,-soname -Wl,libtwo.so.1 -Wl,-O1 -Wl,-z,defs b.o -o libtwo.so.1.0.0
+
+%ln -s libtwo.so.1.0.0 libtwo.so
+
+%$bld/H-x86-gcc-3.3.3/bin/g++ -c b.cc
+
+%ar cru libtwo.a b.o
+

...with the resulting libraries looking like

+
+%ldd libone.so.1.0.0
+	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40016000)
+	libm.so.6 => /lib/tls/libm.so.6 (0x400fa000)
+	libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x4011c000)
+	libc.so.6 => /lib/tls/libc.so.6 (0x40125000)
+	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
+
+%ldd libtwo.so.1.0.0
+	libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40027000)
+	libm.so.6 => /lib/tls/libm.so.6 (0x400e1000)
+	libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x40103000)
+	libc.so.6 => /lib/tls/libc.so.6 (0x4010c000)
+	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
+
+

+ Then, the "C" compiler is used to compile a source file that uses + functions from each library. +

+gcc test.c -g -O2 -L. -lone -ltwo /usr/lib/libstdc++.so.5 /usr/lib/libstdc++.so.6
+

+ Which gives the expected: +

+
+%ldd a.out
+	libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00764000)
+	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40015000)
+	libc.so.6 => /lib/tls/libc.so.6 (0x0036d000)
+	libm.so.6 => /lib/tls/libm.so.6 (0x004a8000)
+	libgcc_s.so.1 => /mnt/hd/bld/gcc/gcc/libgcc_s.so.1 (0x400e5000)
+	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00355000)
+
+

+ This resulting binary, when executed, will be able to safely use + code from both liba, and the dependent libstdc++.so.6, and libb, + with the dependent libstdc++.so.5. +

diff --git a/libstdc++-v3/doc/html/manual/algorithms.html b/libstdc++-v3/doc/html/manual/algorithms.html new file mode 100644 index 000000000..ba91e4e05 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/algorithms.html @@ -0,0 +1,61 @@ + + +Chapter 11.  Algorithms

+ The neatest accomplishment of the algorithms sect1 is that all the + work is done via iterators, not containers directly. This means two + important things: +

  1. + Anything that behaves like an iterator can be used in one of + these algorithms. Raw pointers make great candidates, thus + built-in arrays are fine containers, as well as your own + iterators. +

  2. + The algorithms do not (and cannot) affect the container as a + whole; only the things between the two iterator endpoints. If + you pass a range of iterators only enclosing the middle third of + a container, then anything outside that range is inviolate. +

+ Even strings can be fed through the algorithms here, although the + string class has specialized versions of many of these functions + (for example, string::find()). Most of the examples + on this page will use simple arrays of integers as a playground + for algorithms, just to keep things simple. The use of + N as a size in the examples is to keep things + easy to read but probably won't be valid code. You can use wrappers + such as those described in + the containers sect1 to keep + real code readable. +

+ The single thing that trips people up the most is the definition + of range used with iterators; the famous + "past-the-end" rule that everybody loves to hate. The + iterators sect1 of this + document has a complete explanation of this simple rule that seems + to cause so much confusion. Once you + get range into your head (it's not that hard, + honest!), then the algorithms are a cakewalk. +

diff --git a/libstdc++-v3/doc/html/manual/api.html b/libstdc++-v3/doc/html/manual/api.html new file mode 100644 index 000000000..2cb3500fd --- /dev/null +++ b/libstdc++-v3/doc/html/manual/api.html @@ -0,0 +1,240 @@ + + +API Evolution and Deprecation History

+A list of user-visible changes, in chronological order +

+

+Large file support. +

Extensions for generic characters and char_traits added in ext/pod_char_traits.h. +

+Support for wchar_t specializations of basic_filebuf enhanced to support UTF-8 and Unicode, depending on host. More hosts support basic wchar_t functionality. +

+Support for char_traits beyond builtin types. +

+Conformant allocator class and usage in containers. As +part of this, the following extensions are +added: ext/bitmap_allocator.h, ext/debug_allocator.h, ext/mt_allocator.h, ext/malloc_allocator.h,ext/new_allocator.h, ext/pool_allocator.h. +

+This is a change from all previous versions, and may require +source-level changes due to allocator-related changes to structures +names and template parameters, filenames, and file locations. Some, +like __simple_alloc, __allocator, __alloc, and +_Alloc_traits have been removed. +

Default behavior of std::allocator has changed.

+ Previous versions prior to 3.4 cache allocations in a memory + pool, instead of passing through to call the global allocation + operators (i.e., __gnu_cxx::pool_allocator). More + recent versions default to the + simpler __gnu_cxx::new_allocator. +

Previously, all allocators were written to the SGI + style, and all STL containers expected this interface. This + interface had a traits class called _Alloc_traits that + attempted to provide more information for compile-time allocation + selection and optimization. This traits class had another allocator + wrapper, __simple_alloc<T,A>, which was a + wrapper around another allocator, A, which itself is an allocator + for instances of T. But wait, there's more: + __allocator<T,A> is another adapter. Many of + the provided allocator classes were SGI style: such classes can be + changed to a conforming interface with this wrapper: + __allocator<T, __alloc> is thus the same as + allocator<T>. +

The class allocator used the typedef + __alloc to select an underlying allocator that + satisfied memory allocation requests. The selection of this + underlying allocator was not user-configurable. +


Releases after gcc-3.4 have continued to add to the collection + of available allocators. All of these new allocators are + standard-style. The following table includes details, along with + the first released version of GCC that included the extension allocator. +


+Debug mode first appears. +

+Precompiled header support PCH support. +

+Macro guard for changed, from _GLIBCPP_ to _GLIBCXX_. +

+Extension ext/stdio_sync_filebuf.h added. +

+Extension ext/demangle.h added. +

diff --git a/libstdc++-v3/doc/html/manual/appendix_contributing.html b/libstdc++-v3/doc/html/manual/appendix_contributing.html new file mode 100644 index 000000000..bbaadbdc7 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/appendix_contributing.html @@ -0,0 +1,117 @@ + + +Appendix A.  Contributing

+ The GNU C++ Library follows an open development model. Active + contributors are assigned maintainer-ship responsibility, and given + write access to the source repository. First time contributors + should follow this procedure: +

diff --git a/libstdc++-v3/doc/html/manual/appendix_free.html b/libstdc++-v3/doc/html/manual/appendix_free.html new file mode 100644 index 000000000..84f44035d --- /dev/null +++ b/libstdc++-v3/doc/html/manual/appendix_free.html @@ -0,0 +1,126 @@ + + +Appendix C.  Free Software Needs Free Documentation

+The biggest deficiency in free operating systems is not in the +software--it is the lack of good free manuals that we can include in +these systems. Many of our most important programs do not come with +full manuals. Documentation is an essential part of any software +package; when an important free software package does not come with a +free manual, that is a major gap. We have many such gaps today. +

+Once upon a time, many years ago, I thought I would learn Perl. I got +a copy of a free manual, but I found it hard to read. When I asked +Perl users about alternatives, they told me that there were better +introductory manuals--but those were not free. +

+Why was this? The authors of the good manuals had written them for +O'Reilly Associates, which published them with restrictive terms--no +copying, no modification, source files not available--which exclude +them from the free software community. +

+That wasn't the first time this sort of thing has happened, and (to +our community's great loss) it was far from the last. Proprietary +manual publishers have enticed a great many authors to restrict their +manuals since then. Many times I have heard a GNU user eagerly tell +me about a manual that he is writing, with which he expects to help +the GNU project--and then had my hopes dashed, as he proceeded to +explain that he had signed a contract with a publisher that would +restrict it so that we cannot use it. +

+Given that writing good English is a rare skill among programmers, we +can ill afford to lose manuals this way. +

+ Free documentation, like free software, is a matter of freedom, +not price. The problem with these manuals was not that O'Reilly +Associates charged a price for printed copies--that in itself is fine. +(The Free Software Foundation sells printed copies of +free GNU manuals, too.) But GNU manuals are available in source code +form, while these manuals are available only on paper. GNU manuals +come with permission to copy and modify; the Perl manuals do not. +These restrictions are the problems. +

+The criterion for a free manual is pretty much the same as for free +software: it is a matter of giving all users certain freedoms. +Redistribution (including commercial redistribution) must be +permitted, so that the manual can accompany every copy of the program, +on-line or on paper. Permission for modification is crucial too. +

+As a general rule, I don't believe that it is essential for people to +have permission to modify all sorts of articles and books. The issues +for writings are not necessarily the same as those for software. For +example, I don't think you or I are obliged to give permission to +modify articles like this one, which describe our actions and our +views. +

+But there is a particular reason why the freedom to modify is crucial +for documentation for free software. When people exercise their right +to modify the software, and add or change its features, if they are +conscientious they will change the manual too--so they can provide +accurate and usable documentation with the modified program. A manual +which forbids programmers to be conscientious and finish the job, or +more precisely requires them to write a new manual from scratch if +they change the program, does not fill our community's needs. +

+While a blanket prohibition on modification is unacceptable, some +kinds of limits on the method of modification pose no problem. For +example, requirements to preserve the original author's copyright +notice, the distribution terms, or the list of authors, are ok. It is +also no problem to require modified versions to include notice that +they were modified, even to have entire sections that may not be +deleted or changed, as long as these sections deal with nontechnical +topics. (Some GNU manuals have them.) +

+These kinds of restrictions are not a problem because, as a practical +matter, they don't stop the conscientious programmer from adapting the +manual to fit the modified program. In other words, they don't block +the free software community from making full use of the manual. +

+However, it must be possible to modify all the technical +content of the manual, and then distribute the result in all the usual +media, through all the usual channels; otherwise, the restrictions do +block the community, the manual is not free, and so we need another +manual. +

+Unfortunately, it is often hard to find someone to write another +manual when a proprietary manual exists. The obstacle is that many +users think that a proprietary manual is good enough--so they don't +see the need to write a free manual. They do not see that the free +operating system has a gap that needs filling. +

+Why do users think that proprietary manuals are good enough? Some +have not considered the issue. I hope this article will do something +to change that. +

+Other users consider proprietary manuals acceptable for the same +reason so many people consider proprietary software acceptable: they +judge in purely practical terms, not using freedom as a criterion. +These people are entitled to their opinions, but since those opinions +spring from values which do not include freedom, they are no guide for +those of us who do value freedom. +

+Please spread the word about this issue. We continue to lose manuals +to proprietary publishing. If we spread the word that proprietary +manuals are not sufficient, perhaps the next person who wants to help +GNU by writing documentation will realize, before it is too late, that +he must above all make it free. +

+We can also encourage commercial publishers to sell free, copylefted +manuals instead of proprietary ones. One way you can help this is to +check the distribution terms of a manual before you buy it, and +prefer copylefted manuals to non-copylefted ones. +

+[Note: We now maintain a web page +that lists free books available from other publishers]. +

Copyright © 2004, 2005, 2006, 2007 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

Verbatim copying and distribution of this entire article are +permitted worldwide, without royalty, in any medium, provided this +notice is preserved.

Report any problems or suggestions to .

diff --git a/libstdc++-v3/doc/html/manual/appendix_gfdl.html b/libstdc++-v3/doc/html/manual/appendix_gfdl.html new file mode 100644 index 000000000..9a46f18d1 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/appendix_gfdl.html @@ -0,0 +1,449 @@ + + +Appendix E. GNU Free Documentation License

Version 1.3, 3 November 2008

+ Copyright © 2000, 2001, 2002, 2007, 2008 + Free Software Foundation, Inc. +

+ Everyone is permitted to copy and distribute verbatim copies of this + license document, but changing it is not allowed. +

+ 0. PREAMBLE +

+ The purpose of this License is to make a manual, textbook, or other + functional and useful document “free” in the sense of freedom: + to assure everyone the effective freedom to copy and redistribute it, with + or without modifying it, either commercially or + noncommercially. Secondarily, this License preserves for the author and + publisher a way to get credit for their work, while not being considered + responsible for modifications made by others. +

+ This License is a kind of “copyleft”, which means that + derivative works of the document must themselves be free in the same + sense. It complements the GNU General Public License, which is a copyleft + license designed for free software. +

+ We have designed this License in order to use it for manuals for free + software, because free software needs free documentation: a free program + should come with manuals providing the same freedoms that the software + does. But this License is not limited to software manuals; it can be used + for any textual work, regardless of subject matter or whether it is + published as a printed book. We recommend this License principally for + works whose purpose is instruction or reference. +

+ 1. APPLICABILITY AND DEFINITIONS +

+ This License applies to any manual or other work, in any medium, that + contains a notice placed by the copyright holder saying it can be + distributed under the terms of this License. Such a notice grants a + world-wide, royalty-free license, unlimited in duration, to use that work + under the conditions stated herein. The “Document”, below, + refers to any such manual or work. Any member of the public is a licensee, + and is addressed as “you”. You accept the license if you copy, + modify or distribute the work in a way requiring permission under + copyright law. +

+ A “Modified Version” of the Document means any work containing + the Document or a portion of it, either copied verbatim, or with + modifications and/or translated into another language. +

+ A “Secondary Section” is a named appendix or a front-matter + section of the Document that deals exclusively with the relationship of + the publishers or authors of the Document to the Document’s overall + subject (or to related matters) and contains nothing that could fall + directly within that overall subject. (Thus, if the Document is in part a + textbook of mathematics, a Secondary Section may not explain any + mathematics.) The relationship could be a matter of historical connection + with the subject or with related matters, or of legal, commercial, + philosophical, ethical or political position regarding them. +

+ The “Invariant Sections” are certain Secondary Sections whose + titles are designated, as being those of Invariant Sections, in the notice + that says that the Document is released under this License. If a section + does not fit the above definition of Secondary then it is not allowed to + be designated as Invariant. The Document may contain zero Invariant + Sections. If the Document does not identify any Invariant Sections then + there are none. +

+ The “Cover Texts” are certain short passages of text that are + listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says + that the Document is released under this License. A Front-Cover Text may + be at most 5 words, and a Back-Cover Text may be at most 25 words. +

+ A “Transparent” copy of the Document means a machine-readable + copy, represented in a format whose specification is available to the + general public, that is suitable for revising the document + straightforwardly with generic text editors or (for images composed of + pixels) generic paint programs or (for drawings) some widely available + drawing editor, and that is suitable for input to text formatters or for + automatic translation to a variety of formats suitable for input to text + formatters. A copy made in an otherwise Transparent file format whose + markup, or absence of markup, has been arranged to thwart or discourage + subsequent modification by readers is not Transparent. An image format is + not Transparent if used for any substantial amount of text. A copy that is + not “Transparent” is called “Opaque”. +

+ Examples of suitable formats for Transparent copies include plain ASCII + without markup, Texinfo input format, LaTeX input format, SGML or XML + using a publicly available DTD, and standard-conforming simple HTML, + PostScript or PDF designed for human modification. Examples of transparent + image formats include PNG, XCF and JPG. Opaque formats include proprietary + formats that can be read and edited only by proprietary word processors, + SGML or XML for which the DTD and/or processing tools are not generally + available, and the machine-generated HTML, PostScript or PDF produced by + some word processors for output purposes only. +

+ The “Title Page” means, for a printed book, the title page + itself, plus such following pages as are needed to hold, legibly, the + material this License requires to appear in the title page. For works in + formats which do not have any title page as such, “Title Page” + means the text near the most prominent appearance of the work’s + title, preceding the beginning of the body of the text. +

+ The “publisher” means any person or entity that distributes + copies of the Document to the public. +

+ A section “Entitled XYZ” means a named subunit of the Document + whose title either is precisely XYZ or contains XYZ in parentheses + following text that translates XYZ in another language. (Here XYZ stands + for a specific section name mentioned below, such as + “Acknowledgements”, “Dedications”, + “Endorsements”, or “History”.) To “Preserve + the Title” of such a section when you modify the Document means that + it remains a section “Entitled XYZ” according to this + definition. +

+ The Document may include Warranty Disclaimers next to the notice which + states that this License applies to the Document. These Warranty + Disclaimers are considered to be included by reference in this License, + but only as regards disclaiming warranties: any other implication that + these Warranty Disclaimers may have is void and has no effect on the + meaning of this License. +

+ 2. VERBATIM COPYING +

+ You may copy and distribute the Document in any medium, either + commercially or noncommercially, provided that this License, the copyright + notices, and the license notice saying this License applies to the + Document are reproduced in all copies, and that you add no other + conditions whatsoever to those of this License. You may not use technical + measures to obstruct or control the reading or further copying of the + copies you make or distribute. However, you may accept compensation in + exchange for copies. If you distribute a large enough number of copies you + must also follow the conditions in section 3. +

+ You may also lend copies, under the same conditions stated above, and you + may publicly display copies. +

+ 3. COPYING IN QUANTITY +

+ If you publish printed copies (or copies in media that commonly have + printed covers) of the Document, numbering more than 100, and the + Document’s license notice requires Cover Texts, you must enclose + the copies in covers that carry, clearly and legibly, all these Cover + Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the + back cover. Both covers must also clearly and legibly identify you as the + publisher of these copies. The front cover must present the full title + with all words of the title equally prominent and visible. You may add + other material on the covers in addition. Copying with changes limited to + the covers, as long as they preserve the title of the Document and satisfy + these conditions, can be treated as verbatim copying in other respects. +

+ If the required texts for either cover are too voluminous to fit legibly, + you should put the first ones listed (as many as fit reasonably) on the + actual cover, and continue the rest onto adjacent pages. +

+ If you publish or distribute Opaque copies of the Document numbering more + than 100, you must either include a machine-readable Transparent copy + along with each Opaque copy, or state in or with each Opaque copy a + computer-network location from which the general network-using public has + access to download using public-standard network protocols a complete + Transparent copy of the Document, free of added material. If you use the + latter option, you must take reasonably prudent steps, when you begin + distribution of Opaque copies in quantity, to ensure that this Transparent + copy will remain thus accessible at the stated location until at least one + year after the last time you distribute an Opaque copy (directly or + through your agents or retailers) of that edition to the public. +

+ It is requested, but not required, that you contact the authors of the + Document well before redistributing any large number of copies, to give + them a chance to provide you with an updated version of the Document. +

+ 4. MODIFICATIONS +

+ You may copy and distribute a Modified Version of the Document under the + conditions of sections 2 and 3 above, provided that you release the + Modified Version under precisely this License, with the Modified Version + filling the role of the Document, thus licensing distribution and + modification of the Modified Version to whoever possesses a copy of it. In + addition, you must do these things in the Modified Version: +

  1. + Use in the Title Page (and on the covers, if any) a title distinct + from that of the Document, and from those of previous versions (which + should, if there were any, be listed in the History section of the + Document). You may use the same title as a previous version if the + original publisher of that version gives permission. +
  2. + List on the Title Page, as authors, one or more persons or entities + responsible for authorship of the modifications in the Modified + Version, together with at least five of the principal authors of the + Document (all of its principal authors, if it has fewer than five), + unless they release you from this requirement. +
  3. + State on the Title page the name of the publisher of the Modified + Version, as the publisher. +
  4. + Preserve all the copyright notices of the Document. +
  5. + Add an appropriate copyright notice for your modifications adjacent to + the other copyright notices. +
  6. + Include, immediately after the copyright notices, a license notice + giving the public permission to use the Modified Version under the + terms of this License, in the form shown in the Addendum below. +
  7. + Preserve in that license notice the full lists of Invariant Sections + and required Cover Texts given in the Document’s license + notice. +
  8. + Include an unaltered copy of this License. +
  9. + Preserve the section Entitled “History”, Preserve its + Title, and add to it an item stating at least the title, year, new + authors, and publisher of the Modified Version as given on the Title + Page. If there is no section Entitled “History” in the + Document, create one stating the title, year, authors, and publisher + of the Document as given on its Title Page, then add an item + describing the Modified Version as stated in the previous sentence. +
  10. + Preserve the network location, if any, given in the Document for + public access to a Transparent copy of the Document, and likewise the + network locations given in the Document for previous versions it was + based on. These may be placed in the “History” + section. You may omit a network location for a work that was published + at least four years before the Document itself, or if the original + publisher of the version it refers to gives permission. +
  11. + For any section Entitled “Acknowledgements” or + “Dedications”, Preserve the Title of the section, and + preserve in the section all the substance and tone of each of the + contributor acknowledgements and/or dedications given therein. +
  12. + Preserve all the Invariant Sections of the Document, unaltered in + their text and in their titles. Section numbers or the equivalent are + not considered part of the section titles. +
  13. + Delete any section Entitled “Endorsements”. Such a section + may not be included in the Modified Version. +
  14. + Do not retitle any existing section to be Entitled + “Endorsements” or to conflict in title with any Invariant + Section. +
  15. + Preserve any Warranty Disclaimers. +

+ If the Modified Version includes new front-matter sections or appendices + that qualify as Secondary Sections and contain no material copied from the + Document, you may at your option designate some or all of these sections + as invariant. To do this, add their titles to the list of Invariant + Sections in the Modified Version’s license notice. These titles + must be distinct from any other section titles. +

+ You may add a section Entitled “Endorsements”, provided it + contains nothing but endorsements of your Modified Version by various + parties — for example, statements of peer review or that the text + has been approved by an organization as the authoritative definition of a + standard. +

+ You may add a passage of up to five words as a Front-Cover Text, and a + passage of up to 25 words as a Back-Cover Text, to the end of the list of + Cover Texts in the Modified Version. Only one passage of Front-Cover Text + and one of Back-Cover Text may be added by (or through arrangements made + by) any one entity. If the Document already includes a cover text for the + same cover, previously added by you or by arrangement made by the same + entity you are acting on behalf of, you may not add another; but you may + replace the old one, on explicit permission from the previous publisher + that added the old one. +

+ The author(s) and publisher(s) of the Document do not by this License give + permission to use their names for publicity for or to assert or imply + endorsement of any Modified Version. +

+ 5. COMBINING DOCUMENTS +

+ You may combine the Document with other documents released under this + License, under the terms defined in section 4 above for modified versions, + provided that you include in the combination all of the Invariant Sections + of all of the original documents, unmodified, and list them all as + Invariant Sections of your combined work in its license notice, and that + you preserve all their Warranty Disclaimers. +

+ The combined work need only contain one copy of this License, and multiple + identical Invariant Sections may be replaced with a single copy. If there + are multiple Invariant Sections with the same name but different contents, + make the title of each such section unique by adding at the end of it, in + parentheses, the name of the original author or publisher of that section + if known, or else a unique number. Make the same adjustment to the section + titles in the list of Invariant Sections in the license notice of the + combined work. +

+ In the combination, you must combine any sections Entitled + “History” in the various original documents, forming one + section Entitled “History”; likewise combine any sections + Entitled “Acknowledgements”, and any sections Entitled + “Dedications”. You must delete all sections Entitled + “Endorsements”. +

+ 6. COLLECTIONS OF DOCUMENTS +

+ You may make a collection consisting of the Document and other documents + released under this License, and replace the individual copies of this + License in the various documents with a single copy that is included in + the collection, provided that you follow the rules of this License for + verbatim copying of each of the documents in all other respects. +

+ You may extract a single document from such a collection, and distribute + it individually under this License, provided you insert a copy of this + License into the extracted document, and follow this License in all other + respects regarding verbatim copying of that document. +

+ 7. AGGREGATION WITH INDEPENDENT WORKS +

+ A compilation of the Document or its derivatives with other separate and + independent documents or works, in or on a volume of a storage or + distribution medium, is called an “aggregate” if the copyright + resulting from the compilation is not used to limit the legal rights of + the compilation’s users beyond what the individual works + permit. When the Document is included in an aggregate, this License does + not apply to the other works in the aggregate which are not themselves + derivative works of the Document. +

+ If the Cover Text requirement of section 3 is applicable to these copies + of the Document, then if the Document is less than one half of the entire + aggregate, the Document’s Cover Texts may be placed on covers that + bracket the Document within the aggregate, or the electronic equivalent of + covers if the Document is in electronic form. Otherwise they must appear + on printed covers that bracket the whole aggregate. +

+ 8. TRANSLATION +

+ Translation is considered a kind of modification, so you may distribute + translations of the Document under the terms of section 4. Replacing + Invariant Sections with translations requires special permission from + their copyright holders, but you may include translations of some or all + Invariant Sections in addition to the original versions of these Invariant + Sections. You may include a translation of this License, and all the + license notices in the Document, and any Warranty Disclaimers, provided + that you also include the original English version of this License and the + original versions of those notices and disclaimers. In case of a + disagreement between the translation and the original version of this + License or a notice or disclaimer, the original version will prevail. +

+ If a section in the Document is Entitled “Acknowledgements”, + “Dedications”, or “History”, the requirement + (section 4) to Preserve its Title (section 1) will typically require + changing the actual title. +

+ 9. TERMINATION +

+ You may not copy, modify, sublicense, or distribute the Document except as + expressly provided under this License. Any attempt otherwise to copy, + modify, sublicense, or distribute it is void, and will automatically + terminate your rights under this License. +

+ However, if you cease all violation of this License, then your license + from a particular copyright holder is reinstated (a) provisionally, unless + and until the copyright holder explicitly and finally terminates your + license, and (b) permanently, if the copyright holder fails to notify you + of the violation by some reasonable means prior to 60 days after the + cessation. +

+ Moreover, your license from a particular copyright holder is reinstated + permanently if the copyright holder notifies you of the violation by some + reasonable means, this is the first time you have received notice of + violation of this License (for any work) from that copyright holder, and + you cure the violation prior to 30 days after your receipt of the notice. +

+ Termination of your rights under this section does not terminate the + licenses of parties who have received copies or rights from you under this + License. If your rights have been terminated and not permanently + reinstated, receipt of a copy of some or all of the same material does not + give you any rights to use it. +

+ 10. FUTURE REVISIONS OF THIS LICENSE +

+ The Free Software Foundation may publish new, revised versions of the GNU + Free Documentation License from time to time. Such new versions will be + similar in spirit to the present version, but may differ in detail to + address new problems or concerns. See + Copyleft. +

+ Each version of the License is given a distinguishing version number. If + the Document specifies that a particular numbered version of this License + “or any later version” applies to it, you have the option of + following the terms and conditions either of that specified version or of + any later version that has been published (not as a draft) by the Free + Software Foundation. If the Document does not specify a version number of + this License, you may choose any version ever published (not as a draft) + by the Free Software Foundation. If the Document specifies that a proxy + can decide which future versions of this License can be used, that + proxy’s public statement of acceptance of a version permanently + authorizes you to choose that version for the Document. +

+ 11. RELICENSING +

+ “Massive Multiauthor Collaboration Site” (or “MMC + Site”) means any World Wide Web server that publishes copyrightable + works and also provides prominent facilities for anybody to edit those + works. A public wiki that anybody can edit is an example of such a + server. A “Massive Multiauthor Collaboration” (or + “MMC”) contained in the site means any set of copyrightable + works thus published on the MMC site. +

+ “CC-BY-SA” means the Creative Commons Attribution-Share Alike + 3.0 license published by Creative Commons Corporation, a not-for-profit + corporation with a principal place of business in San Francisco, + California, as well as future copyleft versions of that license published + by that same organization. +

+ “Incorporate” means to publish or republish a Document, in + whole or in part, as part of another Document. +

+ An MMC is “eligible for relicensing” if it is licensed under + this License, and if all works that were first published under this + License somewhere other than this MMC, and subsequently incorporated in + whole or in part into the MMC, (1) had no cover texts or invariant + sections, and (2) were thus incorporated prior to November 1, 2008. +

+ The operator of an MMC Site may republish an MMC contained in the site + under CC-BY-SA on the same site at any time before August 1, 2009, + provided the MMC is eligible for relicensing. +

+ ADDENDUM: How to use this License for your documents +

+ To use this License in a document you have written, include a copy of the + License in the document and put the following copyright and license + notices just after the title page: +

Copyright © YEAR YOUR NAME
+
+Permission is granted to copy, distribute and/or modify this document under the
+terms of the GNU Free Documentation License, Version 1.3 or any later version
+published by the Free Software Foundation; with no Invariant Sections, no
+Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in
+the section entitled “GNU Free Documentation License”.

+ If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, + replace the “with… Texts.” line with this: +

with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts
+being LIST, and with the Back-Cover Texts being LIST.

+ If you have Invariant Sections without Cover Texts, or some other + combination of the three, merge those two alternatives to suit the + situation. +

+ If your document contains nontrivial examples of program code, we + recommend releasing these examples in parallel under your choice of free + software license, such as the GNU General Public License, to permit their + use in free software. +

diff --git a/libstdc++-v3/doc/html/manual/appendix_gpl.html b/libstdc++-v3/doc/html/manual/appendix_gpl.html new file mode 100644 index 000000000..58d1308dc --- /dev/null +++ b/libstdc++-v3/doc/html/manual/appendix_gpl.html @@ -0,0 +1,683 @@ + + +Appendix D.  GNU General Public License version 3

+ Version 3, 29 June 2007 +

+ Copyright © 2007 Free Software Foundation, Inc. + http://www.fsf.org/ +

+ Everyone is permitted to copy and distribute verbatim copies of this license + document, but changing it is not allowed. +

+ Preamble +

+ The GNU General Public License is a free, copyleft + license for software and other kinds of works. +

+ The licenses for most software and other practical works are designed to + take away your freedom to share and change the works. By contrast, the + GNU General Public License is intended to guarantee your + freedom to share and change all versions of a program—to make sure it + remains free software for all its users. We, the Free Software Foundation, + use the GNU General Public License for most of our + software; it applies also to any other work released this way by its + authors. You can apply it to your programs, too. +

+ When we speak of free software, we are referring to freedom, not price. Our + General Public Licenses are designed to make sure that you have the freedom + to distribute copies of free software (and charge for them if you wish), + that you receive source code or can get it if you want it, that you can + change the software or use pieces of it in new free programs, and that you + know you can do these things. +

+ To protect your rights, we need to prevent others from denying you these + rights or asking you to surrender the rights. Therefore, you have certain + responsibilities if you distribute copies of the software, or if you modify + it: responsibilities to respect the freedom of others. +

+ For example, if you distribute copies of such a program, whether gratis or + for a fee, you must pass on to the recipients the same freedoms that you + received. You must make sure that they, too, receive or can get the source + code. And you must show them these terms so they know their rights. +

+ Developers that use the GNU GPL + protect your rights with two steps: (1) assert copyright on the software, + and (2) offer you this License giving you legal permission to copy, + distribute and/or modify it. +

+ For the developers’ and authors’ protection, the + GPL clearly explains that there is no warranty for this + free software. For both users’ and authors’ sake, the + GPL requires that modified versions be marked as changed, + so that their problems will not be attributed erroneously to authors of + previous versions. +

+ Some devices are designed to deny users access to install or run modified + versions of the software inside them, although the manufacturer can do so. + This is fundamentally incompatible with the aim of protecting users’ + freedom to change the software. The systematic pattern of such abuse occurs + in the area of products for individuals to use, which is precisely where it + is most unacceptable. Therefore, we have designed this version of the + GPL to prohibit the practice for those products. If such + problems arise substantially in other domains, we stand ready to extend this + provision to those domains in future versions of the GPL, + as needed to protect the freedom of users. +

+ Finally, every program is threatened constantly by software patents. States + should not allow patents to restrict development and use of software on + general-purpose computers, but in those that do, we wish to avoid the + special danger that patents applied to a free program could make it + effectively proprietary. To prevent this, the GPL + assures that patents cannot be used to render the program non-free. +

+ The precise terms and conditions for copying, distribution and modification + follow. +

+ TERMS AND CONDITIONS +

+ 0. Definitions. +

+ “This License” refers to version 3 of the GNU + General Public License. +

+ “Copyright” also means copyright-like laws that apply to other + kinds of works, such as semiconductor masks. +

+ “The Program” refers to any copyrightable work licensed under + this License. Each licensee is addressed as “you”. + “Licensees” and “recipients” may be individuals or + organizations. +

+ To “modify” a work means to copy from or adapt all or part of + the work in a fashion requiring copyright permission, other than the making + of an exact copy. The resulting work is called a “modified + version” of the earlier work or a work “based on” the + earlier work. +

+ A “covered work” means either the unmodified Program or a work + based on the Program. +

+ To “propagate” a work means to do anything with it that, without + permission, would make you directly or secondarily liable for infringement + under applicable copyright law, except executing it on a computer or + modifying a private copy. Propagation includes copying, distribution (with + or without modification), making available to the public, and in some + countries other activities as well. +

+ To “convey” a work means any kind of propagation that enables + other parties to make or receive copies. Mere interaction with a user + through a computer network, with no transfer of a copy, is not conveying. +

+ An interactive user interface displays “Appropriate Legal + Notices” to the extent that it includes a convenient and prominently + visible feature that (1) displays an appropriate copyright notice, and (2) + tells the user that there is no warranty for the work (except to the extent + that warranties are provided), that licensees may convey the work under this + License, and how to view a copy of this License. If the interface presents + a list of user commands or options, such as a menu, a prominent item in the + list meets this criterion. +

+ 1. Source Code. +

+ The “source code” for a work means the preferred form of the + work for making modifications to it. “Object code” means any + non-source form of a work. +

+ A “Standard Interface” means an interface that either is an + official standard defined by a recognized standards body, or, in the case of + interfaces specified for a particular programming language, one that is + widely used among developers working in that language. +

+ The “System Libraries” of an executable work include anything, + other than the work as a whole, that (a) is included in the normal form of + packaging a Major Component, but which is not part of that Major Component, + and (b) serves only to enable use of the work with that Major Component, or + to implement a Standard Interface for which an implementation is available + to the public in source code form. A “Major Component”, in this + context, means a major essential component (kernel, window system, and so + on) of the specific operating system (if any) on which the executable work + runs, or a compiler used to produce the work, or an object code interpreter + used to run it. +

+ The “Corresponding Source” for a work in object code form means + all the source code needed to generate, install, and (for an executable + work) run the object code and to modify the work, including scripts to + control those activities. However, it does not include the work’s + System Libraries, or general-purpose tools or generally available free + programs which are used unmodified in performing those activities but which + are not part of the work. For example, Corresponding Source includes + interface definition files associated with source files for the work, and + the source code for shared libraries and dynamically linked subprograms that + the work is specifically designed to require, such as by intimate data + communication or control flow between those subprograms and other parts of + the work. +

+ The Corresponding Source need not include anything that users can regenerate + automatically from other parts of the Corresponding Source. +

+ The Corresponding Source for a work in source code form is that same work. +

+ 2. Basic Permissions. +

+ All rights granted under this License are granted for the term of copyright + on the Program, and are irrevocable provided the stated conditions are met. + This License explicitly affirms your unlimited permission to run the + unmodified Program. The output from running a covered work is covered by + this License only if the output, given its content, constitutes a covered + work. This License acknowledges your rights of fair use or other + equivalent, as provided by copyright law. +

+ You may make, run and propagate covered works that you do not convey, + without conditions so long as your license otherwise remains in force. You + may convey covered works to others for the sole purpose of having them make + modifications exclusively for you, or provide you with facilities for + running those works, provided that you comply with the terms of this License + in conveying all material for which you do not control copyright. Those + thus making or running the covered works for you must do so exclusively on + your behalf, under your direction and control, on terms that prohibit them + from making any copies of your copyrighted material outside their + relationship with you. +

+ Conveying under any other circumstances is permitted solely under the + conditions stated below. Sublicensing is not allowed; section 10 makes it + unnecessary. +

+ 3. Protecting Users’ Legal Rights From Anti-Circumvention Law. +

+ No covered work shall be deemed part of an effective technological measure + under any applicable law fulfilling obligations under article 11 of the WIPO + copyright treaty adopted on 20 December 1996, or similar laws prohibiting or + restricting circumvention of such measures. +

+ When you convey a covered work, you waive any legal power to forbid + circumvention of technological measures to the extent such circumvention is + effected by exercising rights under this License with respect to the covered + work, and you disclaim any intention to limit operation or modification of + the work as a means of enforcing, against the work’s users, your or + third parties’ legal rights to forbid circumvention of technological + measures. +

+ 4. Conveying Verbatim Copies. +

+ You may convey verbatim copies of the Program’s source code as you + receive it, in any medium, provided that you conspicuously and appropriately + publish on each copy an appropriate copyright notice; keep intact all + notices stating that this License and any non-permissive terms added in + accord with section 7 apply to the code; keep intact all notices of the + absence of any warranty; and give all recipients a copy of this License + along with the Program. +

+ You may charge any price or no price for each copy that you convey, and you + may offer support or warranty protection for a fee. +

+ 5. Conveying Modified Source Versions. +

+ You may convey a work based on the Program, or the modifications to produce + it from the Program, in the form of source code under the terms of section + 4, provided that you also meet all of these conditions: +

+ A compilation of a covered work with other separate and independent works, + which are not by their nature extensions of the covered work, and which are + not combined with it such as to form a larger program, in or on a volume of + a storage or distribution medium, is called an “aggregate” if + the compilation and its resulting copyright are not used to limit the access + or legal rights of the compilation’s users beyond what the individual works + permit. Inclusion of a covered work in an aggregate does not cause + this License to apply to the other parts of the aggregate. +

+ 6. Conveying Non-Source Forms. +

+ You may convey a covered work in object code form under the terms of + sections 4 and 5, provided that you also convey the machine-readable + Corresponding Source under the terms of this License, in one of these ways: +

  1. + Convey the object code in, or embodied in, a physical product (including + a physical distribution medium), accompanied by the Corresponding Source + fixed on a durable physical medium customarily used for software + interchange. +

  2. + Convey the object code in, or embodied in, a physical product (including + a physical distribution medium), accompanied by a written offer, valid + for at least three years and valid for as long as you offer spare parts + or customer support for that product model, to give anyone who possesses + the object code either (1) a copy of the Corresponding Source for all + the software in the product that is covered by this License, on a + durable physical medium customarily used for software interchange, for a + price no more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding Source from + a network server at no charge. +

  3. + Convey individual copies of the object code with a copy of the written + offer to provide the Corresponding Source. This alternative is allowed + only occasionally and noncommercially, and only if you received the + object code with such an offer, in accord with subsection 6b. +

  4. + Convey the object code by offering access from a designated place + (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to copy + the object code is a network server, the Corresponding Source may be on + a different server (operated by you or a third party) that supports + equivalent copying facilities, provided you maintain clear directions + next to the object code saying where to find the Corresponding Source. + Regardless of what server hosts the Corresponding Source, you remain + obligated to ensure that it is available for as long as needed to + satisfy these requirements. +

  5. + Convey the object code using peer-to-peer transmission, provided you + inform other peers where the object code and Corresponding Source of the + work are being offered to the general public at no charge under + subsection 6d. +

+ A separable portion of the object code, whose source code is excluded from + the Corresponding Source as a System Library, need not be included in + conveying the object code work. +

+ A “User Product” is either (1) a “consumer product”, + which means any tangible personal property which is normally used for + personal, family, or household purposes, or (2) anything designed or sold + for incorporation into a dwelling. In determining whether a product is a + consumer product, doubtful cases shall be resolved in favor of coverage. + For a particular product received by a particular user, “normally + used” refers to a typical or common use of that class of product, + regardless of the status of the particular user or of the way in which the + particular user actually uses, or expects or is expected to use, the + product. A product is a consumer product regardless of whether the product + has substantial commercial, industrial or non-consumer uses, unless such + uses represent the only significant mode of use of the product. +

+ “Installation Information” for a User Product means any methods, + procedures, authorization keys, or other information required to install and + execute modified versions of a covered work in that User Product from a + modified version of its Corresponding Source. The information must suffice + to ensure that the continued functioning of the modified object code is in + no case prevented or interfered with solely because modification has been + made. +

+ If you convey an object code work under this section in, or with, or + specifically for use in, a User Product, and the conveying occurs as part of + a transaction in which the right of possession and use of the User Product + is transferred to the recipient in perpetuity or for a fixed term + (regardless of how the transaction is characterized), the Corresponding + Source conveyed under this section must be accompanied by the Installation + Information. But this requirement does not apply if neither you nor any + third party retains the ability to install modified object code on the User + Product (for example, the work has been installed in + ROM). +

+ The requirement to provide Installation Information does not include a + requirement to continue to provide support service, warranty, or updates for + a work that has been modified or installed by the recipient, or for the User + Product in which it has been modified or installed. Access to a network may + be denied when the modification itself materially and adversely affects the + operation of the network or violates the rules and protocols for + communication across the network. +

+ Corresponding Source conveyed, and Installation Information provided, in + accord with this section must be in a format that is publicly documented + (and with an implementation available to the public in source code form), + and must require no special password or key for unpacking, reading or + copying. +

+ 7. Additional Terms. +

+ “Additional permissions” are terms that supplement the terms of + this License by making exceptions from one or more of its conditions. + Additional permissions that are applicable to the entire Program shall be + treated as though they were included in this License, to the extent that + they are valid under applicable law. If additional permissions apply only + to part of the Program, that part may be used separately under those + permissions, but the entire Program remains governed by this License + without regard to the additional permissions. +

+ When you convey a copy of a covered work, you may at your option remove any + additional permissions from that copy, or from any part of it. (Additional + permissions may be written to require their own removal in certain cases + when you modify the work.) You may place additional permissions on + material, added by you to a covered work, for which you have or can give + appropriate copyright permission. +

+ Notwithstanding any other provision of this License, for material you add + to a covered work, you may (if authorized by the copyright holders of that + material) supplement the terms of this License with terms: +

+ All other non-permissive additional terms are considered “further + restrictions” within the meaning of section 10. If the Program as + you received it, or any part of it, contains a notice stating that it is + governed by this License along with a term that is a further restriction, + you may remove that term. If a license document contains a further + restriction but permits relicensing or conveying under this License, you + may add to a covered work material governed by the terms of that license + document, provided that the further restriction does not survive such + relicensing or conveying. +

+ If you add terms to a covered work in accord with this section, you must + place, in the relevant source files, a statement of the additional terms + that apply to those files, or a notice indicating where to find the + applicable terms. +

+ Additional terms, permissive or non-permissive, may be stated in the form + of a separately written license, or stated as exceptions; the above + requirements apply either way. +

+ 8. Termination. +

+ You may not propagate or modify a covered work except as expressly provided + under this License. Any attempt otherwise to propagate or modify it is + void, and will automatically terminate your rights under this License + (including any patent licenses granted under the third paragraph of section + 11). +

+ However, if you cease all violation of this License, then your license from + a particular copyright holder is reinstated (a) provisionally, unless and + until the copyright holder explicitly and finally terminates your license, + and (b) permanently, if the copyright holder fails to notify you of the + violation by some reasonable means prior to 60 days after the cessation. +

+ Moreover, your license from a particular copyright holder is reinstated + permanently if the copyright holder notifies you of the violation by some + reasonable means, this is the first time you have received notice of + violation of this License (for any work) from that copyright holder, and + you cure the violation prior to 30 days after your receipt of the notice. +

+ Termination of your rights under this section does not terminate the + licenses of parties who have received copies or rights from you under this + License. If your rights have been terminated and not permanently + reinstated, you do not qualify to receive new licenses for the same + material under section 10. +

+ 9. Acceptance Not Required for Having Copies. +

+ You are not required to accept this License in order to receive or run a + copy of the Program. Ancillary propagation of a covered work occurring + solely as a consequence of using peer-to-peer transmission to receive a + copy likewise does not require acceptance. However, nothing other than + this License grants you permission to propagate or modify any covered work. + These actions infringe copyright if you do not accept this License. + Therefore, by modifying or propagating a covered work, you indicate your + acceptance of this License to do so. +

+ 10. Automatic Licensing of Downstream Recipients. +

+ Each time you convey a covered work, the recipient automatically receives a + license from the original licensors, to run, modify and propagate that + work, subject to this License. You are not responsible for enforcing + compliance by third parties with this License. +

+ An “entity transaction” is a transaction transferring control + of an organization, or substantially all assets of one, or subdividing an + organization, or merging organizations. If propagation of a covered work + results from an entity transaction, each party to that transaction who + receives a copy of the work also receives whatever licenses to the work the + party’s predecessor in interest had or could give under the previous + paragraph, plus a right to possession of the Corresponding Source of the + work from the predecessor in interest, if the predecessor has it or can get + it with reasonable efforts. +

+ You may not impose any further restrictions on the exercise of the rights + granted or affirmed under this License. For example, you may not impose a + license fee, royalty, or other charge for exercise of rights granted under + this License, and you may not initiate litigation (including a cross-claim + or counterclaim in a lawsuit) alleging that any patent claim is infringed + by making, using, selling, offering for sale, or importing the Program or + any portion of it. +

+ 11. Patents. +

+ A “contributor” is a copyright holder who authorizes use under + this License of the Program or a work on which the Program is based. The + work thus licensed is called the contributor’s “contributor + version”. +

+ A contributor’s “essential patent claims” are all patent + claims owned or controlled by the contributor, whether already acquired or + hereafter acquired, that would be infringed by some manner, permitted by + this License, of making, using, or selling its contributor version, but do + not include claims that would be infringed only as a consequence of further + modification of the contributor version. For purposes of this definition, + “control” includes the right to grant patent sublicenses in a + manner consistent with the requirements of this License. +

+ Each contributor grants you a non-exclusive, worldwide, royalty-free patent + license under the contributor’s essential patent claims, to make, use, + sell, offer for sale, import and otherwise run, modify and propagate the + contents of its contributor version. +

+ In the following three paragraphs, a “patent license” is any + express agreement or commitment, however denominated, not to enforce a + patent (such as an express permission to practice a patent or covenant not + to sue for patent infringement). To “grant” such a patent + license to a party means to make such an agreement or commitment not to + enforce a patent against the party. +

+ If you convey a covered work, knowingly relying on a patent license, and the + Corresponding Source of the work is not available for anyone to copy, free + of charge and under the terms of this License, through a publicly available + network server or other readily accessible means, then you must either (1) + cause the Corresponding Source to be so available, or (2) arrange to deprive + yourself of the benefit of the patent license for this particular work, or + (3) arrange, in a manner consistent with the requirements of this License, + to extend the patent license to downstream recipients. “Knowingly + relying” means you have actual knowledge that, but for the patent + license, your conveying the covered work in a country, or your + recipient’s use of the covered work in a country, would infringe one + or more identifiable patents in that country that you have reason to believe + are valid. +

+ If, pursuant to or in connection with a single transaction or arrangement, + you convey, or propagate by procuring conveyance of, a covered work, and + grant a patent license to some of the parties receiving the covered work + authorizing them to use, propagate, modify or convey a specific copy of the + covered work, then the patent license you grant is automatically extended to + all recipients of the covered work and works based on it. +

+ A patent license is “discriminatory” if it does not include + within the scope of its coverage, prohibits the exercise of, or is + conditioned on the non-exercise of one or more of the rights that are + specifically granted under this License. You may not convey a covered work + if you are a party to an arrangement with a third party that is in the + business of distributing software, under which you make payment to the third + party based on the extent of your activity of conveying the work, and under + which the third party grants, to any of the parties who would receive the + covered work from you, a discriminatory patent license (a) in connection + with copies of the covered work conveyed by you (or copies made from those + copies), or (b) primarily for and in connection with specific products or + compilations that contain the covered work, unless you entered into that + arrangement, or that patent license was granted, prior to 28 March 2007. +

+ Nothing in this License shall be construed as excluding or limiting any + implied license or other defenses to infringement that may otherwise be + available to you under applicable patent law. +

+ 12. No Surrender of Others’ Freedom. +

+ If conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot convey a + covered work so as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a consequence you may + not convey it at all. For example, if you agree to terms that obligate you + to collect a royalty for further conveying from those to whom you convey the + Program, the only way you could satisfy both those terms and this License + would be to refrain entirely from conveying the Program. +

+ 13. Use with the GNU Affero General Public License. +

+ Notwithstanding any other provision of this License, you have permission to + link or combine any covered work with a work licensed under version 3 of the + GNU Affero General Public License into a single combined + work, and to convey the resulting work. The terms of this License will + continue to apply to the part which is the covered work, but the special + requirements of the GNU Affero General Public License, + section 13, concerning interaction through a network will apply to the + combination as such. +

+ 14. Revised Versions of this License. +

+ The Free Software Foundation may publish revised and/or new versions of the + GNU General Public License from time to time. Such new + versions will be similar in spirit to the present version, but may differ in + detail to address new problems or concerns. +

+ Each version is given a distinguishing version number. If the Program + specifies that a certain numbered version of the GNU + General Public License “or any later version” applies to it, you + have the option of following the terms and conditions either of that + numbered version or of any later version published by the Free Software + Foundation. If the Program does not specify a version number of the + GNU General Public License, you may choose any version + ever published by the Free Software Foundation. +

+ If the Program specifies that a proxy can decide which future versions of + the GNU General Public License can be used, that + proxy’s public statement of acceptance of a version permanently + authorizes you to choose that version for the Program. +

+ Later license versions may give you additional or different permissions. + However, no additional obligations are imposed on any author or copyright + holder as a result of your choosing to follow a later version. +

+ 15. Disclaimer of Warranty. +

+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE + LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR + OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF + ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH + YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. +

+ 16. Limitation of Liability. +

+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL + ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE + PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY + GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE + OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA + OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), + EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF + SUCH DAMAGES. +

+ 17. Interpretation of Sections 15 and 16. +

+ If the disclaimer of warranty and limitation of liability provided above + cannot be given local legal effect according to their terms, reviewing + courts shall apply local law that most closely approximates an absolute + waiver of all civil liability in connection with the Program, unless a + warranty or assumption of liability accompanies a copy of the Program in + return for a fee. +

+ END OF TERMS AND CONDITIONS +

+ How to Apply These Terms to Your New Programs +

+ If you develop a new program, and you want it to be of the greatest possible + use to the public, the best way to achieve this is to make it free software + which everyone can redistribute and change under these terms. +

+ To do so, attach the following notices to the program. It is safest to + attach them to the start of each source file to most effectively state the + exclusion of warranty; and each file should have at least the + “copyright” line and a pointer to where the full notice is + found. +

+one line to give the program’s name and a brief idea of what it does.
+Copyright (C) year name of author
+
+This program 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 of the License, or
+(at your option) any later version.
+
+This program 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 program.  If not, see http://www.gnu.org/licenses/.
+  

+ Also add information on how to contact you by electronic and paper mail. +

+ If the program does terminal interaction, make it output a short notice like + this when it starts in an interactive mode: +

+program Copyright (C) year name of author
+This program comes with ABSOLUTELY NO WARRANTY; for details type ‘show w’.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type ‘show c’ for details.
+  

+ The hypothetical commands ‘show w’ and + ‘show c’ should show the appropriate parts of + the General Public License. Of course, your program’s commands might be + different; for a GUI interface, you would use an “about box”. +

+ You should also get your employer (if you work as a programmer) or school, + if any, to sign a “copyright disclaimer” for the program, if + necessary. For more information on this, and how to apply and follow the + GNU GPL, see + http://www.gnu.org/licenses/. +

+ The GNU General Public License does not permit + incorporating your program into proprietary programs. If your program is a + subroutine library, you may consider it more useful to permit linking + proprietary applications with the library. If this is what you want to do, + use the GNU Lesser General Public License instead of this + License. But first, please read http://www.gnu.org/philosophy/why-not-lgpl.html. +

diff --git a/libstdc++-v3/doc/html/manual/appendix_porting.html b/libstdc++-v3/doc/html/manual/appendix_porting.html new file mode 100644 index 000000000..8cb4398ff --- /dev/null +++ b/libstdc++-v3/doc/html/manual/appendix_porting.html @@ -0,0 +1,230 @@ + + +Appendix B.  Porting and Maintenance

+ As noted previously, + certain other tools are necessary for hacking on files that + control configure (configure.ac, + acinclude.m4) and make + (Makefile.am). These additional tools + (automake, and autoconf) are further + described in detail in their respective manuals. All the libraries + in GCC try to stay in sync with each other in terms of versions of + the auto-tools used, so please try to play nicely with the + neighbors. +

+ The nice thing about acinclude.m4/aclocal.m4 is that macros aren't + actually performed/called/expanded/whatever here, just loaded. So + we can arrange the contents however we like. As of this writing, + acinclude.m4 is arranged as follows: +

+    GLIBCXX_CHECK_HOST
+    GLIBCXX_TOPREL_CONFIGURE
+    GLIBCXX_CONFIGURE
+  

+ All the major variable "discovery" is done here. CXX, multilibs, + etc. +

+    fragments included from elsewhere
+  

+ Right now, "fragments" == "the math/linkage bits". +

+    GLIBCXX_CHECK_COMPILER_FEATURES
+    GLIBCXX_CHECK_LINKER_FEATURES
+    GLIBCXX_CHECK_WCHAR_T_SUPPORT
+

+ Next come extra compiler/linker feature tests. Wide character + support was placed here because I couldn't think of another place + for it. It will probably get broken apart like the math tests, + because we're still disabling wchars on systems which could actually + support them. +

+    GLIBCXX_CHECK_SETRLIMIT_ancilliary
+    GLIBCXX_CHECK_SETRLIMIT
+    GLIBCXX_CHECK_S_ISREG_OR_S_IFREG
+    GLIBCXX_CHECK_POLL
+    GLIBCXX_CHECK_WRITEV
+
+    GLIBCXX_CONFIGURE_TESTSUITE
+

+ Feature tests which only get used in one place. Here, things used + only in the testsuite, plus a couple bits used in the guts of I/O. +

+    GLIBCXX_EXPORT_INCLUDES
+    GLIBCXX_EXPORT_FLAGS
+    GLIBCXX_EXPORT_INSTALL_INFO
+

+ Installation variables, multilibs, working with the rest of the + compiler. Many of the critical variables used in the makefiles are + set here. +

+    GLIBGCC_ENABLE
+    GLIBCXX_ENABLE_C99
+    GLIBCXX_ENABLE_CHEADERS
+    GLIBCXX_ENABLE_CLOCALE
+    GLIBCXX_ENABLE_CONCEPT_CHECKS
+    GLIBCXX_ENABLE_CSTDIO
+    GLIBCXX_ENABLE_CXX_FLAGS
+    GLIBCXX_ENABLE_C_MBCHAR
+    GLIBCXX_ENABLE_DEBUG
+    GLIBCXX_ENABLE_DEBUG_FLAGS
+    GLIBCXX_ENABLE_LONG_LONG
+    GLIBCXX_ENABLE_PCH
+    GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
+    GLIBCXX_ENABLE_SYMVERS
+    GLIBCXX_ENABLE_THREADS
+

+ All the features which can be controlled with enable/disable + configure options. Note how they're alphabetized now? Keep them + like that. :-) +

+    AC_LC_MESSAGES
+    libtool bits
+

+ Things which we don't seem to use directly, but just has to be + present otherwise stuff magically goes wonky. +

+ All the GLIBCXX_ENABLE_FOO macros use a common helper, + GLIBCXX_ENABLE. (You don't have to use it, but it's easy.) The + helper does two things for us: +

Doing these things correctly takes some extra autoconf/autom4te code, + which made our macros nearly illegible. So all the ugliness is factored + out into this one helper macro. +

Many of the macros take an argument, passed from when they are expanded + in configure.ac. The argument controls the default value of the + enable/disable switch. Previously, the arguments themselves had defaults. + Now they don't, because that's extra complexity with zero gain for us. +

There are three "overloaded signatures". When reading the descriptions + below, keep in mind that the brackets are autoconf's quotation characters, + and that they will be stripped. Examples of just about everything occur + in acinclude.m4, if you want to look. +

+    GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
+    GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
+    GLIBCXX_ENABLE (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
+

+ With no other arguments, only the standard autoconf patterns are + allowed: "--{enable,disable}-foo[={yes,no}]" The + $enable_FEATURE variable is guaranteed to equal either "yes" or "no" + after the macro. If the user tries to pass something else, an + explanatory error message will be given, and configure will halt. +

+ The second signature takes a fifth argument, "[permit + a | b | c | ...]" + This allows a or b or + ... after the equals sign in the option, and $enable_FEATURE is + guaranteed to equal one of them after the macro. Note that if you + want to allow plain --enable/--disable with no "=whatever", you must + include "yes" and "no" in the list of permitted values. Also note + that whatever you passed as DEFAULT must be in the list. If the + user tries to pass something not on the list, a semi-explanatory + error message will be given, and configure will halt. Example: + [permit generic|gnu|ieee_1003.1-2001|yes|no|auto] +

+ The third signature takes a fifth argument. It is arbitrary shell + code to execute if the user actually passes the enable/disable + option. (If the user does not, the default is used. Duh.) No + argument checking at all is done in this signature. See + GLIBCXX_ENABLE_CXX_FLAGS for an example of handling, and an error + message. +

diff --git a/libstdc++-v3/doc/html/manual/associative.html b/libstdc++-v3/doc/html/manual/associative.html new file mode 100644 index 000000000..351ec9402 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/associative.html @@ -0,0 +1,192 @@ + + +Associative

+ Section [23.1.2], Table 69, of the C++ standard lists this + function for all of the associative containers (map, set, etc): +

+      a.insert(p,t);
+   

+ where 'p' is an iterator into the container 'a', and 't' is the + item to insert. The standard says that t is + inserted as close as possible to the position just prior to + p. (Library DR #233 addresses this topic, + referring to N1780. + Since version 4.2 GCC implements the resolution to DR 233, so + that insertions happen as close as possible to the hint. For + earlier releases the hint was only used as described below. +

+ Here we'll describe how the hinting works in the libstdc++ + implementation, and what you need to do in order to take + advantage of it. (Insertions can change from logarithmic + complexity to amortized constant time, if the hint is properly + used.) Also, since the current implementation is based on the + SGI STL one, these points may hold true for other library + implementations also, since the HP/SGI code is used in a lot of + places. +

+ In the following text, the phrases greater + than and less than refer to the + results of the strict weak ordering imposed on the container by + its comparison object, which defaults to (basically) + <. Using those phrases is semantically sloppy, + but I didn't want to get bogged down in syntax. I assume that if + you are intelligent enough to use your own comparison objects, + you are also intelligent enough to assign greater + and lesser their new meanings in the next + paragraph. *grin* +

+ If the hint parameter ('p' above) is equivalent to: +

  • + begin(), then the item being inserted should + have a key less than all the other keys in the container. + The item will be inserted at the beginning of the container, + becoming the new entry at begin(). +

  • + end(), then the item being inserted should have + a key greater than all the other keys in the container. The + item will be inserted at the end of the container, becoming + the new entry before end(). +

  • + neither begin() nor end(), then: + Let h be the entry in the container pointed to + by hint, that is, h = *hint. Then + the item being inserted should have a key less than that of + h, and greater than that of the item preceding + h. The new item will be inserted between + h and h's predecessor. +

+ For multimap and multiset, the + restrictions are slightly looser: greater than + should be replaced by not less thanand less + than should be replaced by not greater + than. (Why not replace greater with + greater-than-or-equal-to? You probably could in your head, but + the mathematicians will tell you that it isn't the same thing.) +

+ If the conditions are not met, then the hint is not used, and the + insertion proceeds as if you had called a.insert(t) + instead. (Note that GCC releases + prior to 3.0.2 had a bug in the case with hint == + begin() for the map and set + classes. You should not use a hint argument in those releases.) +

+ This behavior goes well with other containers' + insert() functions which take an iterator: if used, + the new item will be inserted before the iterator passed as an + argument, same as the other containers. +

+ Note also that the hint in this + implementation is a one-shot. The older insertion-with-hint + routines check the immediately surrounding entries to ensure that + the new item would in fact belong there. If the hint does not + point to the correct place, then no further local searching is + done; the search begins from scratch in logarithmic time. +

+ No, you cannot write code of the form +

+      #include <bitset>
+
+      void foo (size_t n)
+      {
+	  std::bitset<n>   bits;
+	  ....
+      }
+   

+ because n must be known at compile time. Your + compiler is correct; it is not a bug. That's the way templates + work. (Yes, it is a feature.) +

+ There are a couple of ways to handle this kind of thing. Please + consider all of them before passing judgement. They include, in + no chaptericular order: +

+ A very large N in + bitset<N>.   It has been + pointed out a few times in newsgroups that N bits only takes up + (N/8) bytes on most systems, and division by a factor of eight is + pretty impressive when speaking of memory. Half a megabyte given + over to a bitset (recall that there is zero space overhead for + housekeeping info; it is known at compile time exactly how large + the set is) will hold over four million bits. If you're using + those bits as status flags (e.g., + changed/unchanged flags), that's a + lot of state. +

+ You can then keep track of the maximum bit used + during some testing runs on representative data, make note of how + many of those bits really need to be there, and then reduce N to + a smaller number. Leave some extra space, of course. (If you + plan to write code like the incorrect example above, where the + bitset is a local variable, then you may have to talk your + compiler into allowing that much stack space; there may be zero + space overhead, but it's all allocated inside the object.) +

+ A container<bool>.   The + Committee made provision for the space savings possible with that + (N/8) usage previously mentioned, so that you don't have to do + wasteful things like Container<char> or + Container<short int>. Specifically, + vector<bool> is required to be specialized for + that space savings. +

+ The problem is that vector<bool> doesn't + behave like a normal vector anymore. There have been + journal articles which discuss the problems (the ones by Herb + Sutter in the May and July/August 1999 issues of C++ Report cover + it well). Future revisions of the ISO C++ Standard will change + the requirement for vector<bool> + specialization. In the meantime, deque<bool> + is recommended (although its behavior is sane, you probably will + not get the space savings, but the allocation scheme is different + than that of vector). +

+ Extremely weird solutions.   If + you have access to the compiler and linker at runtime, you can do + something insane, like figuring out just how many bits you need, + then writing a temporary source code file. That file contains an + instantiation of bitset for the required number of + bits, inside some wrapper functions with unchanging signatures. + Have your program then call the compiler on that file using + Position Independent Code, then open the newly-created object + file and load those wrapper functions. You'll have an + instantiation of bitset<N> for the exact + N that you need at the time. Don't forget to delete + the temporary files. (Yes, this can be, and + has been, done.) +

+ This would be the approach of either a visionary genius or a + raving lunatic, depending on your programming and management + style. Probably the latter. +

+ Which of the above techniques you use, if any, are up to you and + your intended application. Some time/space profiling is + indicated if it really matters (don't just guess). And, if you + manage to do anything along the lines of the third category, the + author would love to hear from you... +

+ Also note that the implementation of bitset used in libstdc++ has + some extensions. +

diff --git a/libstdc++-v3/doc/html/manual/atomics.html b/libstdc++-v3/doc/html/manual/atomics.html new file mode 100644 index 000000000..68052a741 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/atomics.html @@ -0,0 +1,31 @@ + + +Chapter 14.  Atomics

+ Facilities for atomic operations. +

diff --git a/libstdc++-v3/doc/html/manual/backwards.html b/libstdc++-v3/doc/html/manual/backwards.html new file mode 100644 index 000000000..2ac6d789e --- /dev/null +++ b/libstdc++-v3/doc/html/manual/backwards.html @@ -0,0 +1,920 @@ + + +Backwards Compatibility

The first generation GNU C++ library was called libg++. It was a +separate GNU project, although reliably paired with GCC. Rumors imply +that it had a working relationship with at least two kinds of +dinosaur. +

Some background: libg++ was designed and created when there was no +ISO standard to provide guidance. Classes like linked lists are now +provided for by list<T> and do not need to be +created by genclass. (For that matter, templates exist +now and are well-supported, whereas genclass (mostly) predates them.) +

There are other classes in libg++ that are not specified in the +ISO Standard (e.g., statistical analysis). While there are a lot of +really useful things that are used by a lot of people, the Standards +Committee couldn't include everything, and so a lot of those +obvious classes didn't get included. +

Known Issues include many of the limitations of its immediate ancestor.

Portability notes and known implementation limitations are as follows.

+ The second generation GNU C++ library was called libstdc++, or + libstdc++-v2. It spans the time between libg++ and pre-ISO C++ + standardization and is usually associated with the following GCC + releases: egcs 1.x, gcc 2.95, and gcc 2.96. +

+ The STL portions of this library are based on SGI/HP STL release 3.11. +

+ This project is no longer maintained or supported, and the sources + archived. The code is considered replaced and rewritten. +

+ Portability notes and known implementation limitations are as follows. +

+ Some care is required to support C++ compiler and or library + implementation that do not have the standard library in + namespace std. +

+ The following sections list some possible solutions to support compilers + that cannot ignore std::-qualified names. +

+ First, see if the compiler has a flag for this. Namespace + back-portability-issues are generally not a problem for g++ + compilers that do not have libstdc++ in std::, as the + compilers use -fno-honor-std (ignore + std::, :: = std::) by default. That is, + the responsibility for enabling or disabling std:: is + on the user; the maintainer does not have to care about it. This + probably applies to some other compilers as well. +

+ Second, experiment with a variety of pre-processor tricks. +

+ By defining std as a macro, fully-qualified namespace + calls become global. Volia. +

+#ifdef WICKEDLY_OLD_COMPILER
+# define std
+#endif
+

+ Thanks to Juergen Heinzl who posted this solution on gnu.gcc.help. +

+ Another pre-processor based approach is to define a macro + NAMESPACE_STD, which is defined to either + or std based on a compile-type + test. On GNU systems, this can be done with autotools by means of + an autoconf test (see below) for HAVE_NAMESPACE_STD, + then using that to set a value for the NAMESPACE_STD + macro. At that point, one is able to use + NAMESPACE_STD::string, which will evaluate to + std::string or ::string (i.e., in the + global namespace on systems that do not put string in + std::). +

+dnl @synopsis AC_CXX_NAMESPACE_STD
+dnl
+dnl If the compiler supports namespace std, define
+dnl HAVE_NAMESPACE_STD.
+dnl
+dnl @category Cxx
+dnl @author Todd Veldhuizen
+dnl @author Luc Maisonobe <luc@spaceroots.org>
+dnl @version 2004-02-04
+dnl @license AllPermissive
+AC_DEFUN([AC_CXX_NAMESPACE_STD], [
+  AC_CACHE_CHECK(if g++ supports namespace std,
+  ac_cv_cxx_have_std_namespace,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([#include <iostream>
+		  std::istream& is = std::cin;],,
+  ac_cv_cxx_have_std_namespace=yes, ac_cv_cxx_have_std_namespace=no)
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_have_std_namespace" = yes; then
+    AC_DEFINE(HAVE_NAMESPACE_STD,,[Define if g++ supports namespace std. ])
+  fi
+])
+

+ Although the ISO standard i/ostringstream-classes are + provided, (sstream), for + compatibility with older implementations the pre-ISO + i/ostrstream (strstream) interface is also provided, + with these caveats: +

+ You can then use output-stringstreams like this: +

+#ifdef HAVE_SSTREAM
+# include <sstream>
+#else
+# include <strstream>
+#endif
+
+#ifdef HAVE_SSTREAM
+  std::ostringstream oss;
+#else
+  std::ostrstream oss;
+#endif
+
+oss << Name= << m_name << , number= << m_number << std::endl;
+...
+#ifndef HAVE_SSTREAM
+  oss << std::ends; // terminate the char*-string
+#endif
+
+// str() returns char* for ostrstream and a string for ostringstream
+// this also causes ostrstream to think that the buffer's memory
+// is yours
+m_label.set_text(oss.str());
+#ifndef HAVE_SSTREAM
+  // let the ostrstream take care of freeing the memory
+  oss.freeze(false);
+#endif
+

+ Input-stringstreams can be used similarly: +

+std::string input;
+...
+#ifdef HAVE_SSTREAM
+std::istringstream iss(input);
+#else
+std::istrstream iss(input.c_str());
+#endif
+
+int i;
+iss >> i;
+

One (the only?) restriction is that an istrstream cannot be re-filled: +

+std::istringstream iss(numerator);
+iss >> m_num;
+// this is not possible with istrstream
+iss.clear();
+iss.str(denominator);
+iss >> m_den;
+

+If you don't care about speed, you can put these conversions in + a template-function: +

+template <class X>
+void fromString(const string& input, X& any)
+{
+#ifdef HAVE_SSTREAM
+std::istringstream iss(input);
+#else
+std::istrstream iss(input.c_str());
+#endif
+X temp;
+iss >> temp;
+if (iss.fail())
+throw runtime_error(..)
+any = temp;
+}
+

+ Another example of using stringstreams is in this howto. +

There is additional information in the libstdc++-v2 info files, in +particular info iostream. +

+ Earlier GCC releases had a somewhat different approach to + threading configuration and proper compilation. Before GCC 3.0, + configuration of the threading model was dictated by compiler + command-line options and macros (both of which were somewhat + thread-implementation and port-specific). There were no + guarantees related to being able to link code compiled with one + set of options and macro setting with another set. +

+ For GCC 3.0, configuration of the threading model used with + libraries and user-code is performed when GCC is configured and + built using the --enable-threads and --disable-threads options. + The ABI is stable for symbol name-mangling and limited functional + compatibility exists between code compiled under different + threading models. +

+ The libstdc++ library has been designed so that it can be used in + multithreaded applications (with libstdc++-v2 this was only true + of the STL parts.) The first problem is finding a + fast method of implementation portable to + all platforms. Due to historical reasons, some of the library is + written against per-CPU-architecture spinlocks and other parts + against the gthr.h abstraction layer which is provided by gcc. A + minor problem that pops up every so often is different + interpretations of what "thread-safe" means for a + library (not a general program). We currently use the same + definition that SGI uses for their STL subset. However, + the exception for read-only containers only applies to the STL + components. This definition is widely-used and something similar + will be used in the next version of the C++ standard library. +

+ Here is a small link farm to threads (no pun) in the mail + archives that discuss the threading problem. Each link is to the + first relevant message in the thread; from there you can use + "Thread Next" to move down the thread. This farm is in + latest-to-oldest order. +

  • + Our threading expert Loren gives a breakdown of the + six situations involving threads for the 3.0 + release series. +

  • + + This message inspired a recent updating of issues with + threading and the SGI STL library. It also contains some + example POSIX-multithreaded STL code. +

+ (A large selection of links to older messages has been removed; + many of the messages from 1999 were lost in a disk crash, and the + few people with access to the backup tapes have been too swamped + with work to restore them. Many of the points have been + superseded anyhow.) +

The third generation GNU C++ library is called libstdc++, or +libstdc++-v3. +

The subset commonly known as the Standard Template Library + (chapters 23 through 25, mostly) is adapted from the final release + of the SGI STL (version 3.3), with extensive changes. +

A more formal description of the V3 goals can be found in the + official design document. +

Portability notes and known implementation limitations are as follows.

The pre-ISO C++ headers + (iostream.h, defalloc.h etc.) are + available, unlike previous libstdc++ versions, but inclusion + generates a warning that you are using deprecated headers. +

This compatibility layer is constructed by including the + standard C++ headers, and injecting any items in + std:: into the global namespace. +

For those of you new to ISO C++ (welcome, time travelers!), no, + that isn't a typo. Yes, the headers really have new names. + Marshall Cline's C++ FAQ Lite has a good explanation in item + [27.4]. +

Some include adjustment may be required. What follows is an +autoconf test that defines PRE_STDCXX_HEADERS when they +exist.

+# AC_HEADER_PRE_STDCXX
+AC_DEFUN([AC_HEADER_PRE_STDCXX], [
+  AC_CACHE_CHECK(for pre-ISO C++ include files,
+  ac_cv_cxx_pre_stdcxx,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -Wno-deprecated"
+
+  # Omit defalloc.h, as compilation with newer compilers is problematic.
+  AC_TRY_COMPILE([
+  #include <new.h>
+  #include <iterator.h>
+  #include <alloc.h>
+  #include <set.h>
+  #include <hashtable.h>
+  #include <hash_set.h>
+  #include <fstream.h>
+  #include <tempbuf.h>
+  #include <istream.h>
+  #include <bvector.h>
+  #include <stack.h>
+  #include <rope.h>
+  #include <complex.h>
+  #include <ostream.h>
+  #include <heap.h>
+  #include <iostream.h>
+  #include <function.h>
+  #include <multimap.h>
+  #include <pair.h>
+  #include <stream.h>
+  #include <iomanip.h>
+  #include <slist.h>
+  #include <tree.h>
+  #include <vector.h>
+  #include <deque.h>
+  #include <multiset.h>
+  #include <list.h>
+  #include <map.h>
+  #include <algobase.h>
+  #include <hash_map.h>
+  #include <algo.h>
+  #include <queue.h>
+  #include <streambuf.h>
+  ],,
+  ac_cv_cxx_pre_stdcxx=yes, ac_cv_cxx_pre_stdcxx=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_pre_stdcxx" = yes; then
+    AC_DEFINE(PRE_STDCXX_HEADERS,,[Define if pre-ISO C++ header files are present. ])
+  fi
+])
+

Porting between pre-ISO headers and ISO headers is simple: headers +like vector.h can be replaced with vector and a using +directive using namespace std; can be put at the global +scope. This should be enough to get this code compiling, assuming the +other usage is correct. +

At this time most of the features of the SGI STL extension have been + replaced by standardized libraries. + In particular, the unordered_map and unordered_set containers of TR1 + are suitable replacement for the non-standard hash_map and hash_set + containers in the SGI STL. +

Header files hash_map and hash_set moved +to ext/hash_map and ext/hash_set, +respectively. At the same time, all types in these files are enclosed +in namespace __gnu_cxx. Later versions move deprecate +these files, and suggest using TR1's unordered_map +and unordered_set instead. +

The extensions are no longer in the global or std + namespaces, instead they are declared in the __gnu_cxx + namespace. For maximum portability, consider defining a namespace + alias to use to talk about extensions, e.g.: +

+      #ifdef __GNUC__
+      #if __GNUC__ < 3
+	#include <hash_map.h>
+	namespace extension { using ::hash_map; }; // inherit globals
+      #else
+	#include <backward/hash_map>
+	#if __GNUC__ == 3 && __GNUC_MINOR__ == 0
+	  namespace extension = std;               // GCC 3.0
+	#else
+	  namespace extension = ::__gnu_cxx;       // GCC 3.1 and later
+	#endif
+      #endif
+      #else      // ...  there are other compilers, right?
+	namespace extension = std;
+      #endif
+
+      extension::hash_map<int,int> my_map;
+      

This is a bit cleaner than defining typedefs for all the + instantiations you might need. +

The following autoconf tests check for working HP/SGI hash containers. +

+# AC_HEADER_EXT_HASH_MAP
+AC_DEFUN([AC_HEADER_EXT_HASH_MAP], [
+  AC_CACHE_CHECK(for ext/hash_map,
+  ac_cv_cxx_ext_hash_map,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -Werror"
+  AC_TRY_COMPILE([#include <ext/hash_map>], [using __gnu_cxx::hash_map;],
+  ac_cv_cxx_ext_hash_map=yes, ac_cv_cxx_ext_hash_map=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_ext_hash_map" = yes; then
+    AC_DEFINE(HAVE_EXT_HASH_MAP,,[Define if ext/hash_map is present. ])
+  fi
+])
+
+# AC_HEADER_EXT_HASH_SET
+AC_DEFUN([AC_HEADER_EXT_HASH_SET], [
+  AC_CACHE_CHECK(for ext/hash_set,
+  ac_cv_cxx_ext_hash_set,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -Werror"
+  AC_TRY_COMPILE([#include <ext/hash_set>], [using __gnu_cxx::hash_set;],
+  ac_cv_cxx_ext_hash_set=yes, ac_cv_cxx_ext_hash_set=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_ext_hash_set" = yes; then
+    AC_DEFINE(HAVE_EXT_HASH_SET,,[Define if ext/hash_set is present. ])
+  fi
+])
+

Check for library coverage of the TR1 standard. +

+# AC_HEADER_STDCXX_TR1
+AC_DEFUN([AC_HEADER_STDCXX_TR1], [
+  AC_CACHE_CHECK(for ISO C++ TR1 include files,
+  ac_cv_cxx_stdcxx_tr1,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  #include <tr1/array>
+  #include <tr1/ccomplex>
+  #include <tr1/cctype>
+  #include <tr1/cfenv>
+  #include <tr1/cfloat>
+  #include <tr1/cinttypes>
+  #include <tr1/climits>
+  #include <tr1/cmath>
+  #include <tr1/complex>
+  #include <tr1/cstdarg>
+  #include <tr1/cstdbool>
+  #include <tr1/cstdint>
+  #include <tr1/cstdio>
+  #include <tr1/cstdlib>
+  #include <tr1/ctgmath>
+  #include <tr1/ctime>
+  #include <tr1/cwchar>
+  #include <tr1/cwctype>
+  #include <tr1/functional>
+  #include <tr1/memory>
+  #include <tr1/random>
+  #include <tr1/regex>
+  #include <tr1/tuple>
+  #include <tr1/type_traits>
+  #include <tr1/unordered_set>
+  #include <tr1/unordered_map>
+  #include <tr1/utility>
+  ],,
+  ac_cv_cxx_stdcxx_tr1=yes, ac_cv_cxx_stdcxx_tr1=no)
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_stdcxx_tr1" = yes; then
+    AC_DEFINE(STDCXX_TR1_HEADERS,,[Define if ISO C++ TR1 header files are present. ])
+  fi
+])
+

An alternative is to check just for specific TR1 includes, such as <unordered_map> and <unordered_set>. +

+# AC_HEADER_TR1_UNORDERED_MAP
+AC_DEFUN([AC_HEADER_TR1_UNORDERED_MAP], [
+  AC_CACHE_CHECK(for tr1/unordered_map,
+  ac_cv_cxx_tr1_unordered_map,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([#include <tr1/unordered_map>], [using std::tr1::unordered_map;],
+  ac_cv_cxx_tr1_unordered_map=yes, ac_cv_cxx_tr1_unordered_map=no)
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_tr1_unordered_map" = yes; then
+    AC_DEFINE(HAVE_TR1_UNORDERED_MAP,,[Define if tr1/unordered_map is present. ])
+  fi
+])
+
+# AC_HEADER_TR1_UNORDERED_SET
+AC_DEFUN([AC_HEADER_TR1_UNORDERED_SET], [
+  AC_CACHE_CHECK(for tr1/unordered_set,
+  ac_cv_cxx_tr1_unordered_set,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([#include <tr1/unordered_set>], [using std::tr1::unordered_set;],
+  ac_cv_cxx_tr1_unordered_set=yes, ac_cv_cxx_tr1_unordered_set=no)
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_tr1_unordered_set" = yes; then
+    AC_DEFINE(HAVE_TR1_UNORDERED_SET,,[Define if tr1/unordered_set is present. ])
+  fi
+])
+

Check for baseline language coverage in the compiler for the C++0xstandard. +

+# AC_COMPILE_STDCXX_OX
+AC_DEFUN([AC_COMPILE_STDCXX_0X], [
+  AC_CACHE_CHECK(if g++ supports C++0x features without additional flags,
+  ac_cv_cxx_compile_cxx0x_native,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = c;],,
+  ac_cv_cxx_compile_cxx0x_native=yes, ac_cv_cxx_compile_cxx0x_native=no)
+  AC_LANG_RESTORE
+  ])
+
+  AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x,
+  ac_cv_cxx_compile_cxx0x_cxx,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=c++0x"
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = c;],,
+  ac_cv_cxx_compile_cxx0x_cxx=yes, ac_cv_cxx_compile_cxx0x_cxx=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+
+  AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x,
+  ac_cv_cxx_compile_cxx0x_gxx,
+  [AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+  AC_TRY_COMPILE([
+  template <typename T>
+    struct check
+    {
+      static_assert(sizeof(int) <= sizeof(T), "not big enough");
+    };
+
+    typedef check<check<bool>> right_angle_brackets;
+
+    int a;
+    decltype(a) b;
+
+    typedef check<int> check_type;
+    check_type c;
+    check_type&& cr = c;],,
+  ac_cv_cxx_compile_cxx0x_gxx=yes, ac_cv_cxx_compile_cxx0x_gxx=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+
+  if test "$ac_cv_cxx_compile_cxx0x_native" = yes ||
+     test "$ac_cv_cxx_compile_cxx0x_cxx" = yes ||
+     test "$ac_cv_cxx_compile_cxx0x_gxx" = yes; then
+    AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ])
+  fi
+])
+

Check for library coverage of the C++0xstandard. +

+# AC_HEADER_STDCXX_0X
+AC_DEFUN([AC_HEADER_STDCXX_0X], [
+  AC_CACHE_CHECK(for ISO C++ 0x include files,
+  ac_cv_cxx_stdcxx_0x,
+  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+
+  AC_TRY_COMPILE([
+    #include <cassert>
+    #include <ccomplex>
+    #include <cctype>
+    #include <cerrno>
+    #include <cfenv>
+    #include <cfloat>
+    #include <cinttypes>
+    #include <ciso646>
+    #include <climits>
+    #include <clocale>
+    #include <cmath>
+    #include <csetjmp>
+    #include <csignal>
+    #include <cstdarg>
+    #include <cstdbool>
+    #include <cstddef>
+    #include <cstdint>
+    #include <cstdio>
+    #include <cstdlib>
+    #include <cstring>
+    #include <ctgmath>
+    #include <ctime>
+    #include <cwchar>
+    #include <cwctype>
+
+    #include <algorithm>
+    #include <array>
+    #include <bitset>
+    #include <complex>
+    #include <deque>
+    #include <exception>
+    #include <fstream>
+    #include <functional>
+    #include <iomanip>
+    #include <ios>
+    #include <iosfwd>
+    #include <iostream>
+    #include <istream>
+    #include <iterator>
+    #include <limits>
+    #include <list>
+    #include <locale>
+    #include <map>
+    #include <memory>
+    #include <new>
+    #include <numeric>
+    #include <ostream>
+    #include <queue>
+    #include <random>
+    #include <regex>
+    #include <set>
+    #include <sstream>
+    #include <stack>
+    #include <stdexcept>
+    #include <streambuf>
+    #include <string>
+    #include <tuple>
+    #include <typeinfo>
+    #include <type_traits>
+    #include <unordered_map>
+    #include <unordered_set>
+    #include <utility>
+    #include <valarray>
+    #include <vector>
+  ],,
+  ac_cv_cxx_stdcxx_0x=yes, ac_cv_cxx_stdcxx_0x=no)
+  AC_LANG_RESTORE
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  ])
+  if test "$ac_cv_cxx_stdcxx_0x" = yes; then
+    AC_DEFINE(STDCXX_0X_HEADERS,,[Define if ISO C++ 0x header files are present. ])
+  fi
+])
+

As is the case for TR1 support, these autoconf macros can be made for a finer-grained, per-header-file check. For <unordered_map> +

+# AC_HEADER_UNORDERED_MAP
+AC_DEFUN([AC_HEADER_UNORDERED_MAP], [
+  AC_CACHE_CHECK(for unordered_map,
+  ac_cv_cxx_unordered_map,
+  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+  AC_TRY_COMPILE([#include <unordered_map>], [using std::unordered_map;],
+  ac_cv_cxx_unordered_map=yes, ac_cv_cxx_unordered_map=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_unordered_map" = yes; then
+    AC_DEFINE(HAVE_UNORDERED_MAP,,[Define if unordered_map is present. ])
+  fi
+])
+
+# AC_HEADER_UNORDERED_SET
+AC_DEFUN([AC_HEADER_UNORDERED_SET], [
+  AC_CACHE_CHECK(for unordered_set,
+  ac_cv_cxx_unordered_set,
+  [AC_REQUIRE([AC_COMPILE_STDCXX_0X])
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -std=gnu++0x"
+  AC_TRY_COMPILE([#include <unordered_set>], [using std::unordered_set;],
+  ac_cv_cxx_unordered_set=yes, ac_cv_cxx_unordered_set=no)
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
+  ])
+  if test "$ac_cv_cxx_unordered_set" = yes; then
+    AC_DEFINE(HAVE_UNORDERED_SET,,[Define if unordered_set is present. ])
+  fi
+])
+
diff --git a/libstdc++-v3/doc/html/manual/bitmap_allocator.html b/libstdc++-v3/doc/html/manual/bitmap_allocator.html new file mode 100644 index 000000000..be584e403 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bitmap_allocator.html @@ -0,0 +1,340 @@ + + +bitmap_allocator

+

+ The Free List Store (referred to as FLS for the remaining part of this + document) is the Global memory pool that is shared by all instances of + the bitmapped allocator instantiated for any type. This maintains a + sorted order of all free memory blocks given back to it by the + bitmapped allocator, and is also responsible for giving memory to the + bitmapped allocator when it asks for more. +

+ Internally, there is a Free List threshold which indicates the + Maximum number of free lists that the FLS can hold internally + (cache). Currently, this value is set at 64. So, if there are + more than 64 free lists coming in, then some of them will be given + back to the OS using operator delete so that at any given time the + Free List's size does not exceed 64 entries. This is done because + a Binary Search is used to locate an entry in a free list when a + request for memory comes along. Thus, the run-time complexity of + the search would go up given an increasing size, for 64 entries + however, lg(64) == 6 comparisons are enough to locate the correct + free list if it exists. +

+ Suppose the free list size has reached it's threshold, then the + largest block from among those in the list and the new block will + be selected and given back to the OS. This is done because it + reduces external fragmentation, and allows the OS to use the + larger blocks later in an orderly fashion, possibly merging them + later. Also, on some systems, large blocks are obtained via calls + to mmap, so giving them back to free system resources becomes most + important. +

+ The function _S_should_i_give decides the policy that determines + whether the current block of memory should be given to the + allocator for the request that it has made. That's because we may + not always have exact fits for the memory size that the allocator + requests. We do this mainly to prevent external fragmentation at + the cost of a little internal fragmentation. Now, the value of + this internal fragmentation has to be decided by this function. I + can see 3 possibilities right now. Please add more as and when you + find better strategies. +

+ Currently, (3) is being used with a value of 36% Maximum wastage per + Super Block. +

+ Each Super Block will be of some size that is a multiple of the + number of Bits Per Block. Typically, this value is chosen as + Bits_Per_Byte x sizeof(size_t). On an x86 system, this gives the + figure 8 x 4 = 32. Thus, each Super Block will be of size 32 + x Some_Value. This Some_Value is sizeof(value_type). For now, let + it be called 'K'. Thus, finally, Super Block size is 32 x K bytes. +

+ This value of 32 has been chosen because each size_t has 32-bits + and Maximum use of these can be made with such a figure. +

+ Consider a block of size 64 ints. In memory, it would look like this: + (assume a 32-bit system where, size_t is a 32-bit entity). +


+ The first Column(268) represents the size of the Block in bytes as + seen by the Bitmap Allocator. Internally, a global free list is + used to keep track of the free blocks used and given back by the + bitmap allocator. It is this Free List Store that is responsible + for writing and managing this information. Actually the number of + bytes allocated in this case would be: 4 + 4 + (4x2) + (64x4) = + 272 bytes, but the first 4 bytes are an addition by the Free List + Store, so the Bitmap Allocator sees only 268 bytes. These first 4 + bytes about which the bitmapped allocator is not aware hold the + value 268. +

+ What do the remaining values represent?

+ The 2nd 4 in the expression is the sizeof(size_t) because the + Bitmapped Allocator maintains a used count for each Super Block, + which is initially set to 0 (as indicated in the diagram). This is + incremented every time a block is removed from this super block + (allocated), and decremented whenever it is given back. So, when + the used count falls to 0, the whole super block will be given + back to the Free List Store. +

+ The value 4294967295 represents the integer corresponding to the bit + representation of all bits set: 11111111111111111111111111111111. +

+ The 3rd 4x2 is size of the bitmap itself, which is the size of 32-bits + x 2, + which is 8-bytes, or 2 x sizeof(size_t). +

+ The allocate function is specialized for single object allocation + ONLY. Thus, ONLY if n == 1, will the bitmap_allocator's + specialized algorithm be used. Otherwise, the request is satisfied + directly by calling operator new. +

+ Suppose n == 1, then the allocator does the following: +

  1. + Checks to see whether a free block exists somewhere in a region + of memory close to the last satisfied request. If so, then that + block is marked as allocated in the bit map and given to the + user. If not, then (2) is executed. +

  2. + Is there a free block anywhere after the current block right + up to the end of the memory that we have? If so, that block is + found, and the same procedure is applied as above, and + returned to the user. If not, then (3) is executed. +

  3. + Is there any block in whatever region of memory that we own + free? This is done by checking +

    + Note: Here we are never touching any of the memory that the + user will be given, and we are confining all memory accesses + to a small region of memory! This helps reduce cache + misses. If this succeeds then we apply the same procedure on + that bit-map as (1), and return that block of memory to the + user. However, if this process fails, then we resort to (4). +

  4. + This process involves Refilling the internal exponentially + growing memory pool. The said effect is achieved by calling + _S_refill_pool which does the following: +

+Thus, you can clearly see that the allocate function is nothing but a +combination of the next-fit and first-fit algorithm optimized ONLY for +single object allocations. +

+ The deallocate function again is specialized for single objects ONLY. + For all n belonging to > 1, the operator delete is called without + further ado, and the deallocate function returns. +

+ However for n == 1, a series of steps are performed: +

+ Now, whenever a block is freed, the use count of that particular + super block goes down by 1. When this use count hits 0, we remove + that super block from the list of all valid super blocks stored in + the vector. While doing this, we also make sure that the basic + invariant is maintained by making sure that _S_last_request and + _S_last_dealloc_index point to valid locations within the vector. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt02.html b/libstdc++-v3/doc/html/manual/bk01pt02.html new file mode 100644 index 000000000..3a0751ab9 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt02.html @@ -0,0 +1,46 @@ + + +Part II.  Standard Contents
diff --git a/libstdc++-v3/doc/html/manual/bk01pt02ch05s02.html b/libstdc++-v3/doc/html/manual/bk01pt02ch05s02.html new file mode 100644 index 000000000..6a67bef7c --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt02ch05s02.html @@ -0,0 +1,50 @@ + + +Concept Checking

+ In 1999, SGI added concept checkers to their + implementation of the STL: code which checked the template + parameters of instantiated pieces of the STL, in order to insure + that the parameters being used met the requirements of the + standard. For example, the Standard requires that types passed as + template parameters to vector be + "Assignable" (which means what you think it means). The + checking was done during compilation, and none of the code was + executed at runtime. +

+ Unfortunately, the size of the compiler files grew significantly + as a result. The checking code itself was cumbersome. And bugs + were found in it on more than one occasion. +

+ The primary author of the checking code, Jeremy Siek, had already + started work on a replacement implementation. The new code was + formally reviewed and accepted into + the + Boost libraries, and we are pleased to incorporate it into the + GNU C++ library. +

+ The new version imposes a much smaller space overhead on the generated + object file. The checks are also cleaner and easier to read and + understand. +

+ They are off by default for all versions of GCC. + They can be enabled at configure time with + --enable-concept-checks. + You can enable them on a per-translation-unit basis with + -D_GLIBCXX_CONCEPT_CHECKS. +

+ Please note that the checks are based on the requirements in the original + C++ standard, some of which have changed in the upcoming C++0x revision. + Additionally, some correct code might be rejected by the concept checks, + for example template argument types may need to be complete when used in + a template definition, rather than at the point of instantiation. + There are no plans to address these shortcomings. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch17s02.html b/libstdc++-v3/doc/html/manual/bk01pt03ch17s02.html new file mode 100644 index 000000000..8fa7981de --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch17s02.html @@ -0,0 +1,55 @@ + + +Semantics

+

A program that uses the C++ standard library correctly + will maintain the same semantics under debug mode as it had with + the normal (release) library. All functional and exception-handling + guarantees made by the normal library also hold for the debug mode + library, with one exception: performance guarantees made by the + normal library may not hold in the debug mode library. For + instance, erasing an element in a std::list is a + constant-time operation in normal library, but in debug mode it is + linear in the number of iterators that reference that particular + list. So while your (correct) program won't change its results, it + is likely to execute more slowly.

libstdc++ includes many extensions to the C++ standard library. In + some cases the extensions are obvious, such as the hashed + associative containers, whereas other extensions give predictable + results to behavior that would otherwise be undefined, such as + throwing an exception when a std::basic_string is + constructed from a NULL character pointer. This latter category also + includes implementation-defined and unspecified semantics, such as + the growth rate of a vector. Use of these extensions is not + considered incorrect, so code that relies on them will not be + rejected by debug mode. However, use of these extensions may affect + the portability of code to other implementations of the C++ standard + library, and is therefore somewhat hazardous. For this reason, the + libstdc++ debug mode offers a "pedantic" mode (similar to + GCC's -pedantic compiler flag) that attempts to emulate + the semantics guaranteed by the C++ standard. For + instance, constructing a std::basic_string with a NULL + character pointer would result in an exception under normal mode or + non-pedantic debug mode (this is a libstdc++ extension), whereas + under pedantic debug mode libstdc++ would signal an error. To enable + the pedantic debug mode, compile your program with + both -D_GLIBCXX_DEBUG + and -D_GLIBCXX_DEBUG_PEDANTIC . + (N.B. In GCC 3.4.x and 4.0.0, due to a bug, + -D_GLIBXX_DEBUG_PEDANTIC was also needed. The problem has + been fixed in GCC 4.0.1 and later versions.)

The following library components provide extra debugging + capabilities in debug mode:

N.B. although there are precondition checks for some string operations, +e.g. operator[], +they will not always be run when using the char and +wchar_t specialisations (std::string and +std::wstring). This is because libstdc++ uses GCC's +extern template extension to provide explicit instantiations +of std::string and std::wstring, and those +explicit instantiations don't include the debug-mode checks. If the +containing functions are inlined then the checks will run, so compiling +with -O1 might be enough to enable them. Alternatively +-D_GLIBCXX_EXTERN_TEMPLATE=0 will suppress the declarations +of the explicit instantiations and cause the functions to be instantiated +with the debug-mode checks included, but this is unsupported and not +guaranteed to work. For full debug-mode support you can use the +__gnu_debug::basic_string debugging container directly, +which always works correctly. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html new file mode 100644 index 000000000..7e017b62b --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch17s03.html @@ -0,0 +1,24 @@ + + +Using

+

When it is not feasible to recompile your entire application, or + only specific containers need checking, debugging containers are + available as GNU extensions. These debugging containers are + functionally equivalent to the standard drop-in containers used in + debug mode, but they are available in a separate namespace as GNU + extensions and may be used in programs compiled with either release + mode or with debug mode. The + following table provides the names and headers of the debugging + containers: +


In addition, when compiling in C++0x mode, these additional +containers have additional debug capability. +


diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch17s04.html b/libstdc++-v3/doc/html/manual/bk01pt03ch17s04.html new file mode 100644 index 000000000..3e35af0fa --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch17s04.html @@ -0,0 +1,412 @@ + + +Design

+

+

The libstdc++ debug mode replaces unsafe (but efficient) standard + containers and iterators with semantically equivalent safe standard + containers and iterators to aid in debugging user programs. The + following goals directed the design of the libstdc++ debug mode:

+

This section provides an overall view of the design of the + libstdc++ debug mode and details the relationship between design + decisions and the stated design goals.

The libstdc++ debug mode uses a wrapper model where the + debugging versions of library components (e.g., iterators and + containers) form a layer on top of the release versions of the + library components. The debugging components first verify that the + operation is correct (aborting with a diagnostic if an error is + found) and will then forward to the underlying release-mode + container that will perform the actual work. This design decision + ensures that we cannot regress release-mode performance (because the + release-mode containers are left untouched) and partially + enables mixing debug and + release code at link time, although that will not be + discussed at this time.

Two types of wrappers are used in the implementation of the debug + mode: container wrappers and iterator wrappers. The two types of + wrappers interact to maintain relationships between iterators and + their associated containers, which are necessary to detect certain + types of standard library usage errors such as dereferencing + past-the-end iterators or inserting into a container using an + iterator from a different container.

Container wrappers provide a debugging layer over a particular + container type. Because containers vary greatly in the member + functions they support and the semantics of those member functions + (especially in the area of iterator invalidation), container + wrappers are tailored to the container they reference, e.g., the + debugging version of std::list duplicates the entire + interface of std::list, adding additional semantic + checks and then forwarding operations to the + real std::list (a public base class of the debugging + version) as appropriate. However, all safe containers inherit from + the class template __gnu_debug::_Safe_sequence, + instantiated with the type of the safe container itself (an instance + of the curiously recurring template pattern).

The iterators of a container wrapper will be + safe + iterators that reference sequences of this type and wrap the + iterators provided by the release-mode base class. The debugging + container will use only the safe iterators within its own interface + (therefore requiring the user to use safe iterators, although this + does not change correct user code) and will communicate with the + release-mode base class with only the underlying, unsafe, + release-mode iterators that the base class exports.

The debugging version of std::list will have the + following basic structure:

+template<typename _Tp, typename _Allocator = allocator<_Tp>
+  class debug-list :
+    public release-list<_Tp, _Allocator>,
+    public __gnu_debug::_Safe_sequence<debug-list<_Tp, _Allocator> >
+  {
+    typedef release-list<_Tp, _Allocator> _Base;
+    typedef debug-list<_Tp, _Allocator>   _Self;
+
+  public:
+    typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, _Self>       iterator;
+    typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, _Self> const_iterator;
+
+    // duplicate std::list interface with debugging semantics
+  };
+

The debug mode operates primarily by checking the preconditions of + all standard library operations that it supports. Preconditions that + are always checked (regardless of whether or not we are in debug + mode) are checked via the __check_xxx macros defined + and documented in the source + file include/debug/debug.h. Preconditions that may or + may not be checked, depending on the debug-mode + macro _GLIBCXX_DEBUG, are checked via + the __requires_xxx macros defined and documented in the + same source file. Preconditions are validated using any additional + information available at run-time, e.g., the containers that are + associated with a particular iterator, the position of the iterator + within those containers, the distance between two iterators that may + form a valid range, etc. In the absence of suitable information, + e.g., an input iterator that is not a safe iterator, these + precondition checks will silently succeed.

The majority of precondition checks use the aforementioned macros, + which have the secondary benefit of having prewritten debug + messages that use information about the current status of the + objects involved (e.g., whether an iterator is singular or what + sequence it is attached to) along with some static information + (e.g., the names of the function parameters corresponding to the + objects involved). When not using these macros, the debug mode uses + either the debug-mode assertion + macro _GLIBCXX_DEBUG_ASSERT , its pedantic + cousin _GLIBCXX_DEBUG_PEDASSERT, or the assertion + check macro that supports more advance formulation of error + messages, _GLIBCXX_DEBUG_VERIFY. These macros are + documented more thoroughly in the debug mode source code.

The libstdc++ debug mode is the first debug mode we know of that + is able to provide the "Per-use recompilation" (4) guarantee, that + allows release-compiled and debug-compiled code to be linked and + executed together without causing unpredictable behavior. This + guarantee minimizes the recompilation that users are required to + perform, shortening the detect-compile-debug bug hunting cycle + and making the debug mode easier to incorporate into development + environments by minimizing dependencies.

Achieving link- and run-time coexistence is not a trivial + implementation task. To achieve this goal we required a small + extension to the GNU C++ compiler (since incorporated into the C++0x language specification, described in the GCC Manual for the C++ language as + namespace + association), and a complex organization of debug- and + release-modes. The end result is that we have achieved per-use + recompilation but have had to give up some checking of the + std::basic_string class template (namely, safe + iterators). +

Both the release-mode components and the debug-mode + components need to exist within a single translation unit so that + the debug versions can wrap the release versions. However, only one + of these components should be user-visible at any particular + time with the standard name, e.g., std::list.

In release mode, we define only the release-mode version of the + component with its standard name and do not include the debugging + component at all. The release mode version is defined within the + namespace std. Minus the namespace associations, this + method leaves the behavior of release mode completely unchanged from + its behavior prior to the introduction of the libstdc++ debug + mode. Here's an example of what this ends up looking like, in + C++.

+namespace std
+{
+  template<typename _Tp, typename _Alloc = allocator<_Tp> >
+    class list
+    {
+      // ...
+     };
+} // namespace std
+

In debug mode we include the release-mode container (which is now +defined in the namespace __cxx1998) and also the +debug-mode container. The debug-mode container is defined within the +namespace __debug, which is associated with namespace +std via the C++0x namespace association language feature. This +method allows the debug and release versions of the same component to +coexist at compile-time and link-time without causing an unreasonable +maintenance burden, while minimizing confusion. Again, this boils down +to C++ code as follows:

+namespace std
+{
+  namespace __cxx1998
+  {
+    template<typename _Tp, typename _Alloc = allocator<_Tp> >
+      class list
+      {
+	// ...
+      };
+  } // namespace __gnu_norm
+
+  namespace __debug
+  {
+    template<typename _Tp, typename _Alloc = allocator<_Tp> >
+      class list
+      : public __cxx1998::list<_Tp, _Alloc>,
+	public __gnu_debug::_Safe_sequence<list<_Tp, _Alloc> >
+      {
+	// ...
+      };
+  } // namespace __cxx1998
+
+  // namespace __debug __attribute__ ((strong));
+  inline namespace __debug { }
+}
+

Because each component has a distinct and separate release and +debug implementation, there is no issue with link-time +coexistence: the separate namespaces result in different mangled +names, and thus unique linkage.

However, components that are defined and used within the C++ +standard library itself face additional constraints. For instance, +some of the member functions of std::moneypunct return +std::basic_string. Normally, this is not a problem, but +with a mixed mode standard library that could be using either +debug-mode or release-mode basic_string objects, things +get more complicated. As the return value of a function is not +encoded into the mangled name, there is no way to specify a +release-mode or a debug-mode string. In practice, this results in +runtime errors. A simplified example of this problem is as follows. +

Take this translation unit, compiled in debug-mode:

+// -D_GLIBCXX_DEBUG
+#include <string>
+
+std::string test02();
+
+std::string test01()
+{
+  return test02();
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
+

... and linked to this translation unit, compiled in release mode:

+#include <string>
+
+std::string
+test02()
+{
+  return std::string("toast");
+}
+

For this reason we cannot easily provide safe iterators for + the std::basic_string class template, as it is present + throughout the C++ standard library. For instance, locale facets + define typedefs that include basic_string: in a mixed + debug/release program, should that typedef be based on the + debug-mode basic_string or the + release-mode basic_string? While the answer could be + "both", and the difference hidden via renaming a la the + debug/release containers, we must note two things about locale + facets:

With the design of libstdc++ debug mode, we cannot effectively hide + the differences between debug and release-mode strings from the + user. Failure to hide the differences may result in unpredictable + behavior, and for this reason we have opted to only + perform basic_string changes that do not require ABI + changes. The effect on users is expected to be minimal, as there are + simple alternatives (e.g., __gnu_debug::basic_string), + and the usability benefit we gain from the ability to mix debug- and + release-compiled translation units is enormous.

The coexistence scheme above was chosen over many alternatives, + including language-only solutions and solutions that also required + extensions to the C++ front end. The following is a partial list of + solutions, with justifications for our rejection of each.

Other options may exist for implementing the debug mode, many of + which have probably been considered and others that may still be + lurking. This list may be expanded over time to include other + options that we could have implemented, but in all cases the full + ramifications of the approach (as measured against the design goals + for a libstdc++ debug mode) should be considered first. The DejaGNU + testsuite includes some testcases that check for known problems with + some solutions (e.g., the using declaration solution + that breaks user specialization), and additional testcases will be + added as we are able to identify other typical problem cases. These + test cases will serve as a benchmark by which we can compare debug + mode implementations.

+

There are several existing implementations of debug modes for C++ + standard library implementations, although none of them directly + supports debugging for programs using libstdc++. The existing + implementations include:

  • SafeSTL: + SafeSTL was the original debugging version of the Standard Template + Library (STL), implemented by Cay S. Horstmann on top of the + Hewlett-Packard STL. Though it inspired much work in this area, it + has not been kept up-to-date for use with modern compilers or C++ + standard library implementations.

  • STLport: STLport is a free + implementation of the C++ standard library derived from the SGI implementation, and + ported to many other platforms. It includes a debug mode that uses a + wrapper model (that in some ways inspired the libstdc++ debug mode + design), although at the time of this writing the debug mode is + somewhat incomplete and meets only the "Full user recompilation" (2) + recompilation guarantee by requiring the user to link against a + different library in debug mode vs. release mode.

  • Metrowerks CodeWarrior: The C++ standard library + that ships with Metrowerks CodeWarrior includes a debug mode. It is + a full debug-mode implementation (including debugging for + CodeWarrior extensions) and is easy to use, although it meets only + the "Full recompilation" (1) recompilation + guarantee.

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch18s02.html b/libstdc++-v3/doc/html/manual/bk01pt03ch18s02.html new file mode 100644 index 000000000..7a7419ac5 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch18s02.html @@ -0,0 +1,11 @@ + + +Semantics

The parallel mode STL algorithms are currently not exception-safe, +i.e. user-defined functors must not throw exceptions. +Also, the order of execution is not guaranteed for some functions, of course. +Therefore, user-defined functors should not have any concurrent side effects. +

Since the current GCC OpenMP implementation does not support +OpenMP parallel regions in concurrent threads, +it is not possible to call parallel STL algorithm in +concurrent threads, either. +It might work with other compilers, though.

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html new file mode 100644 index 000000000..b3a3db937 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch18s03.html @@ -0,0 +1,66 @@ + + +Using

+ Any use of parallel functionality requires additional compiler + and runtime support, in particular support for OpenMP. Adding this support is + not difficult: just compile your application with the compiler + flag -fopenmp. This will link + in libgomp, the GNU + OpenMP implementation, + whose presence is mandatory. +

+In addition, hardware that supports atomic operations and a compiler + capable of producing atomic operations is mandatory: GCC defaults to no + support for atomic operations on some common hardware + architectures. Activating atomic operations may require explicit + compiler flags on some targets (like sparc and x86), such + as -march=i686, + -march=native or -mcpu=v9. See + the GCC manual for more information. +

When it is not feasible to recompile your entire application, or + only specific algorithms need to be parallel-aware, individual + parallel algorithms can be made available explicitly. These + parallel algorithms are functionally equivalent to the standard + drop-in algorithms used in parallel mode, but they are available in + a separate namespace as GNU extensions and may be used in programs + compiled with either release mode or with parallel mode. +

An example of using a parallel version +of std::sort, but no other parallel algorithms, is: +

+#include <vector>
+#include <parallel/algorithm>
+
+int main()
+{
+  std::vector<int> v(100);
+
+  // ...
+
+  // Explicitly force a call to parallel sort.
+  __gnu_parallel::sort(v.begin(), v.end());
+  return 0;
+}
+

+Then compile this code with the prerequisite compiler flags +(-fopenmp and any necessary architecture-specific +flags for atomic operations.) +

The following table provides the names and headers of all the + parallel algorithms that can be used in a similar manner: +

Table 18.1. Parallel Algorithms

AlgorithmHeaderParallel algorithmParallel header
std::accumulatenumeric__gnu_parallel::accumulateparallel/numeric
std::adjacent_differencenumeric__gnu_parallel::adjacent_differenceparallel/numeric
std::inner_productnumeric__gnu_parallel::inner_productparallel/numeric
std::partial_sumnumeric__gnu_parallel::partial_sumparallel/numeric
std::adjacent_findalgorithm__gnu_parallel::adjacent_findparallel/algorithm
std::countalgorithm__gnu_parallel::countparallel/algorithm
std::count_ifalgorithm__gnu_parallel::count_ifparallel/algorithm
std::equalalgorithm__gnu_parallel::equalparallel/algorithm
std::findalgorithm__gnu_parallel::findparallel/algorithm
std::find_ifalgorithm__gnu_parallel::find_ifparallel/algorithm
std::find_first_ofalgorithm__gnu_parallel::find_first_ofparallel/algorithm
std::for_eachalgorithm__gnu_parallel::for_eachparallel/algorithm
std::generatealgorithm__gnu_parallel::generateparallel/algorithm
std::generate_nalgorithm__gnu_parallel::generate_nparallel/algorithm
std::lexicographical_comparealgorithm__gnu_parallel::lexicographical_compareparallel/algorithm
std::mismatchalgorithm__gnu_parallel::mismatchparallel/algorithm
std::searchalgorithm__gnu_parallel::searchparallel/algorithm
std::search_nalgorithm__gnu_parallel::search_nparallel/algorithm
std::transformalgorithm__gnu_parallel::transformparallel/algorithm
std::replacealgorithm__gnu_parallel::replaceparallel/algorithm
std::replace_ifalgorithm__gnu_parallel::replace_ifparallel/algorithm
std::max_elementalgorithm__gnu_parallel::max_elementparallel/algorithm
std::mergealgorithm__gnu_parallel::mergeparallel/algorithm
std::min_elementalgorithm__gnu_parallel::min_elementparallel/algorithm
std::nth_elementalgorithm__gnu_parallel::nth_elementparallel/algorithm
std::partial_sortalgorithm__gnu_parallel::partial_sortparallel/algorithm
std::partitionalgorithm__gnu_parallel::partitionparallel/algorithm
std::random_shufflealgorithm__gnu_parallel::random_shuffleparallel/algorithm
std::set_unionalgorithm__gnu_parallel::set_unionparallel/algorithm
std::set_intersectionalgorithm__gnu_parallel::set_intersectionparallel/algorithm
std::set_symmetric_differencealgorithm__gnu_parallel::set_symmetric_differenceparallel/algorithm
std::set_differencealgorithm__gnu_parallel::set_differenceparallel/algorithm
std::sortalgorithm__gnu_parallel::sortparallel/algorithm
std::stable_sortalgorithm__gnu_parallel::stable_sortparallel/algorithm
std::unique_copyalgorithm__gnu_parallel::unique_copyparallel/algorithm

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch18s04.html b/libstdc++-v3/doc/html/manual/bk01pt03ch18s04.html new file mode 100644 index 000000000..91c951d38 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch18s04.html @@ -0,0 +1,213 @@ + + +Design

+

+All parallel algorithms are intended to have signatures that are +equivalent to the ISO C++ algorithms replaced. For instance, the +std::adjacent_find function is declared as: +

+namespace std
+{
+  template<typename _FIter>
+    _FIter
+    adjacent_find(_FIter, _FIter);
+}
+

+Which means that there should be something equivalent for the parallel +version. Indeed, this is the case: +

+namespace std
+{
+  namespace __parallel
+  {
+    template<typename _FIter>
+      _FIter
+      adjacent_find(_FIter, _FIter);
+
+    ...
+  }
+}
+

But.... why the ellipses? +

The ellipses in the example above represent additional overloads +required for the parallel version of the function. These additional +overloads are used to dispatch calls from the ISO C++ function +signature to the appropriate parallel function (or sequential +function, if no parallel functions are deemed worthy), based on either +compile-time or run-time conditions. +

The available signature options are specific for the different +algorithms/algorithm classes.

The general view of overloads for the parallel algorithms look like this: +

Please note that the implementation may use additional functions +(designated with the _switch suffix) to dispatch from the +ISO C++ signature to the correct parallel version. Also, some of the +algorithms do not have support for run-time conditions, so the last +overload is therefore missing. +

+To force an algorithm to execute sequentially, even though parallelism +is switched on in general via the macro _GLIBCXX_PARALLEL, +add __gnu_parallel::sequential_tag() to the end +of the algorithm's argument list. +

+Like so: +

+std::sort(v.begin(), v.end(), __gnu_parallel::sequential_tag());
+

+Some parallel algorithm variants can be excluded from compilation by +preprocessor defines. See the doxygen documentation on +compiletime_settings.h and features.h for details. +

+For some algorithms, the desired variant can be chosen at compile-time by +appending a tag object. The available options are specific to the particular +algorithm (class). +

+For the "embarrassingly parallel" algorithms, there is only one "tag object +type", the enum _Parallelism. +It takes one of the following values, +__gnu_parallel::parallel_tag, +__gnu_parallel::balanced_tag, +__gnu_parallel::unbalanced_tag, +__gnu_parallel::omp_loop_tag, +__gnu_parallel::omp_loop_static_tag. +This means that the actual parallelization strategy is chosen at run-time. +(Choosing the variants at compile-time will come soon.) +

+For the following algorithms in general, we have +__gnu_parallel::parallel_tag and +__gnu_parallel::default_parallel_tag, in addition to +__gnu_parallel::sequential_tag. +__gnu_parallel::default_parallel_tag chooses the default +algorithm at compiletime, as does omitting the tag. +__gnu_parallel::parallel_tag postpones the decision to runtime +(see next section). +For all tags, the number of threads desired for this call can optionally be +passed to the respective tag's constructor. +

+The multiway_merge algorithm comes with the additional choices, +__gnu_parallel::exact_tag and +__gnu_parallel::sampling_tag. +Exact and sampling are the two available splitting strategies. +

+For the sort and stable_sort algorithms, there are +several additional choices, namely +__gnu_parallel::multiway_mergesort_tag, +__gnu_parallel::multiway_mergesort_exact_tag, +__gnu_parallel::multiway_mergesort_sampling_tag, +__gnu_parallel::quicksort_tag, and +__gnu_parallel::balanced_quicksort_tag. +Multiway mergesort comes with the two splitting strategies for multi-way +merging. The quicksort options cannot be used for stable_sort. +

+The default parallelization strategy, the choice of specific algorithm +strategy, the minimum threshold limits for individual parallel +algorithms, and aspects of the underlying hardware can be specified as +desired via manipulation +of __gnu_parallel::_Settings member data. +

+First off, the choice of parallelization strategy: serial, parallel, +or heuristically deduced. This corresponds +to __gnu_parallel::_Settings::algorithm_strategy and is a +value of enum __gnu_parallel::_AlgorithmStrategy +type. Choices +include: heuristic, force_sequential, +and force_parallel. The default is heuristic. +

+Next, the sub-choices for algorithm variant, if not fixed at compile-time. +Specific algorithms like find or sort +can be implemented in multiple ways: when this is the case, +a __gnu_parallel::_Settings member exists to +pick the default strategy. For +example, __gnu_parallel::_Settings::sort_algorithm can +have any values of +enum __gnu_parallel::_SortAlgorithm: MWMS, QS, +or QS_BALANCED. +

+Likewise for setting the minimal threshold for algorithm +parallelization. Parallelism always incurs some overhead. Thus, it is +not helpful to parallelize operations on very small sets of +data. Because of this, measures are taken to avoid parallelizing below +a certain, pre-determined threshold. For each algorithm, a minimum +problem size is encoded as a variable in the +active __gnu_parallel::_Settings object. This +threshold variable follows the following naming scheme: +__gnu_parallel::_Settings::[algorithm]_minimal_n. So, +for fill, the threshold variable +is __gnu_parallel::_Settings::fill_minimal_n, +

+Finally, hardware details like L1/L2 cache size can be hardwired +via __gnu_parallel::_Settings::L1_cache_size and friends. +

+

+All these configuration variables can be changed by the user, if +desired. +There exists one global instance of the class _Settings, +i. e. it is a singleton. It can be read and written by calling +__gnu_parallel::_Settings::get and +__gnu_parallel::_Settings::set, respectively. +Please note that the first call return a const object, so direct manipulation +is forbidden. +See + settings.h +for complete details. +

+A small example of tuning the default: +

+#include <parallel/algorithm>
+#include <parallel/settings.h>
+
+int main()
+{
+  __gnu_parallel::_Settings s;
+  s.algorithm_strategy = __gnu_parallel::force_parallel;
+  __gnu_parallel::_Settings::set(s);
+
+  // Do work... all algorithms will be parallelized, always.
+
+  return 0;
+}
+
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch18s05.html b/libstdc++-v3/doc/html/manual/bk01pt03ch18s05.html new file mode 100644 index 000000000..f00a4a281 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch18s05.html @@ -0,0 +1,26 @@ + + +Testing

+ Both the normal conformance and regression tests and the + supplemental performance tests work. +

+ To run the conformance and regression tests with the parallel mode + active, +

+  make check-parallel
+  

+ The log and summary files for conformance testing are in the + testsuite/parallel directory. +

+ To run the performance tests with the parallel mode active, +

+  make check-performance-parallel
+  

+ The result file for performance testing are in the + testsuite directory, in the file + libstdc++_performance.sum. In addition, the + policy-based containers have their own visualizations, which have + additional software dependencies than the usual bare-boned text + file, and can be generated by using the make + doc-performance rule in the testsuite's Makefile. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html new file mode 100644 index 000000000..ce915ddb5 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s02.html @@ -0,0 +1,122 @@ + + +Design

+


+

+ While it is likely that cost models become complex as we get into + more sophisticated analysis, we will try to follow a simple set of rules + at the beginning. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s03.html new file mode 100644 index 000000000..37d1ed8e4 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s03.html @@ -0,0 +1,10 @@ + + +Extensions for Custom Containers

+ Many large projects use their own data structures instead of the ones in the + standard library. If these data structures are similar in functionality + to the standard library, they can be instrumented with the same hooks + that are used to instrument the standard library. + The instrumentation API is exposed in file + profiler.h (look for "Instrumentation hooks"). +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s04.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s04.html new file mode 100644 index 000000000..8fc162b7c --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s04.html @@ -0,0 +1,18 @@ + + +Empirical Cost Model

+ Currently, the cost model uses formulas with predefined relative weights + for alternative containers or container implementations. For instance, + iterating through a vector is X times faster than iterating through a list. +

+ (Under development.) + We are working on customizing this to a particular machine by providing + an automated way to compute the actual relative weights for operations + on the given machine. +

+ (Under development.) + We plan to provide a performance parameter database format that can be + filled in either by hand or by an automated training mechanism. + The analysis module will then use this database instead of the built in. + generic parameters. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s05.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s05.html new file mode 100644 index 000000000..2d072f0b4 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s05.html @@ -0,0 +1,51 @@ + + +Implementation Issues
diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html new file mode 100644 index 000000000..ddcc7f570 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s06.html @@ -0,0 +1,68 @@ + + +Developer Information

Let's say the diagnostic name is "magic". +

If you need to instrument a header not already under + include/profile/*, first edit the corresponding header + under include/std/ and add a preprocessor directive such + as the one in include/std/vector: +

+#ifdef _GLIBCXX_PROFILE
+# include <profile/vector>
+#endif
+

+

If the file you need to instrument is not yet under + include/profile/, make a copy of the one in + include/debug, or the main implementation. + You'll need to include the main implementation and inherit the classes + you want to instrument. Then define the methods you want to instrument, + define the instrumentation hooks and add calls to them. + Look at include/profile/vector for an example. +

Add macros for the instrumentation hooks in + include/profile/impl/profiler.h. + Hook names must start with __profcxx_. + Make sure they transform + in no code with -D_NO_GLBICXX_PROFILE_MAGIC. + Make sure all calls to any method in namespace __gnu_profile + is protected against reentrance using macro + _GLIBCXX_PROFILE_REENTRANCE_GUARD. + All names of methods in namespace __gnu_profile called from + profiler.h must start with __trace_magic_. +

Add the implementation of the diagnostic. +

+

Add initialization and reporting calls in + include/profile/impl/profiler_trace.h. Use + __trace_vector_to_list as an example. +

Add documentation in file doc/xml/manual/profile_mode.xml. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html b/libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html new file mode 100644 index 000000000..8c134e75f --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch19s07.html @@ -0,0 +1,558 @@ + + +Diagnostics

+ The table below presents all the diagnostics we intend to implement. + Each diagnostic has a corresponding compile time switch + -D_GLIBCXX_PROFILE_<diagnostic>. + Groups of related diagnostics can be turned on with a single switch. + For instance, -D_GLIBCXX_PROFILE_LOCALITY is equivalent to + -D_GLIBCXX_PROFILE_SOFTWARE_PREFETCH + -D_GLIBCXX_PROFILE_RBTREE_LOCALITY. +

+ The benefit, cost, expected frequency and accuracy of each diagnostic + was given a grade from 1 to 10, where 10 is highest. + A high benefit means that, if the diagnostic is accurate, the expected + performance improvement is high. + A high cost means that turning this diagnostic on leads to high slowdown. + A high frequency means that we expect this to occur relatively often. + A high accuracy means that the diagnostic is unlikely to be wrong. + These grades are not perfect. They are just meant to guide users with + specific needs or time budgets. +


+Switch: + _GLIBCXX_PROFILE_CONTAINERS. +

Switch: + _GLIBCXX_PROFILE_ALGORITHMS. +

Switch: + _GLIBCXX_PROFILE_LOCALITY. +

+ The diagnostics in this group are not meant to be implemented short term. + They require compiler support to know when container elements are written + to. Instrumentation can only tell us when elements are referenced. +

Switch: + _GLIBCXX_PROFILE_MULTITHREADED. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch21s02.html b/libstdc++-v3/doc/html/manual/bk01pt03ch21s02.html new file mode 100644 index 000000000..eba8cfb31 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch21s02.html @@ -0,0 +1,43 @@ + + +HP/SGI

+

A few extensions and nods to backwards-compatibility have been made with + containers. Those dealing with older SGI-style allocators are dealt with + elsewhere. The remaining ones all deal with bits: +

The old pre-standard bit_vector class is present for + backwards compatibility. It is simply a typedef for the + vector<bool> specialization. +

The bitset class has a number of extensions, described in the + rest of this item. First, we'll mention that this implementation of + bitset<N> is specialized for cases where N number of + bits will fit into a single word of storage. If your choice of N is + within that range (<=32 on i686-pc-linux-gnu, for example), then all + of the operations will be faster. +

There are + versions of single-bit test, set, reset, and flip member functions which + do no range-checking. If we call them member functions of an instantiation + of "bitset<N>," then their names and signatures are: +

+   bitset<N>&   _Unchecked_set   (size_t pos);
+   bitset<N>&   _Unchecked_set   (size_t pos, int val);
+   bitset<N>&   _Unchecked_reset (size_t pos);
+   bitset<N>&   _Unchecked_flip  (size_t pos);
+   bool         _Unchecked_test  (size_t pos);
+   

Note that these may in fact be removed in the future, although we have + no present plans to do so (and there doesn't seem to be any immediate + reason to). +

The semantics of member function operator[] are not specified + in the C++ standard. A long-standing defect report calls for sensible + obvious semantics, which are already implemented here: op[] + on a const bitset returns a bool, and for a non-const bitset returns a + reference (a nested type). However, this implementation does + no range-checking on the index argument, which is in keeping with other + containers' op[] requirements. The defect report's proposed + resolution calls for range-checking to be done. We'll just wait and see... +

Finally, two additional searching functions have been added. They return + the index of the first "on" bit, and the index of the first + "on" bit that is after prev, respectively: +

+   size_t _Find_first() const;
+   size_t _Find_next (size_t prev) const;

The same caveat given for the _Unchecked_* functions applies here also. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch21s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch21s03.html new file mode 100644 index 000000000..2f75d608b --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch21s03.html @@ -0,0 +1,50 @@ + + +Deprecated HP/SGI

+ The SGI hashing classes hash_set and + hash_set have been deprecated by the + unordered_set, unordered_multiset, unordered_map, + unordered_multimap containers in TR1 and the upcoming C++0x, and + may be removed in future releases. +

The SGI headers

+     <hash_map>
+     <hash_set>
+     <rope>
+     <slist>
+     <rb_tree>
+   

are all here; + <hash_map> and <hash_set> + are deprecated but available as backwards-compatible extensions, + as discussed further below. <rope> is the + SGI specialization for large strings ("rope," + "large strings," get it? Love that geeky humor.) + <slist> is a singly-linked list, for when the + doubly-linked list<> is too much space + overhead, and <rb_tree> exposes the red-black + tree classes used in the implementation of the standard maps and + sets. +

Each of the associative containers map, multimap, set, and multiset + have a counterpart which uses a + hashing + function to do the arranging, instead of a strict weak ordering + function. The classes take as one of their template parameters a + function object that will return the hash value; by default, an + instantiation of + hash. + You should specialize this functor for your class, or define your own, + before trying to use one of the hashing classes. +

The hashing classes support all the usual associative container + functions, as well as some extra constructors specifying the number + of buckets, etc. +

Why would you want to use a hashing class instead of the + normalimplementations? Matt Austern writes: +

+ [W]ith a well chosen hash function, hash tables + generally provide much better average-case performance than + binary search trees, and much worse worst-case performance. So + if your implementation has hash_map, if you don't mind using + nonstandard components, and if you aren't scared about the + possibility of pathological cases, you'll probably get better + performance from hash_map. + +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch28s02.html b/libstdc++-v3/doc/html/manual/bk01pt03ch28s02.html new file mode 100644 index 000000000..4350e20b1 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch28s02.html @@ -0,0 +1,41 @@ + + +Implementation

The functions for atomic operations described above are either +implemented via compiler intrinsics (if the underlying host is +capable) or by library fallbacks.

Compiler intrinsics (builtins) are always preferred. However, as +the compiler builtins for atomics are not universally implemented, +using them directly is problematic, and can result in undefined +function calls. (An example of an undefined symbol from the use +of __sync_fetch_and_add on an unsupported host is a +missing reference to __sync_fetch_and_add_4.) +

In addition, on some hosts the compiler intrinsics are enabled +conditionally, via the -march command line flag. This makes +usage vary depending on the target hardware and the flags used during +compile. +

+If builtins are possible for bool-sized integral types, +_GLIBCXX_ATOMIC_BUILTINS_1 will be defined. +If builtins are possible for int-sized integral types, +_GLIBCXX_ATOMIC_BUILTINS_4 will be defined. +

For the following hosts, intrinsics are enabled by default. +

For others, some form of -march may work. On +non-ancient x86 hardware, -march=native usually does the +trick.

For hosts without compiler intrinsics, but with capable +hardware, hand-crafted assembly is selected. This is the case for the following hosts: +

And for the rest, a simulated atomic lock via pthreads. +

Detailed information about compiler intrinsics for atomic operations can be found in the GCC documentation. +

More details on the library fallbacks from the porting section. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html b/libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html new file mode 100644 index 000000000..b70d5a621 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03ch28s03.html @@ -0,0 +1,36 @@ + + +Use

Typical usage of the last two constructs is demonstrated as follows: +

+#include <ext/concurrence.h>
+
+namespace
+{
+  __gnu_cxx::__mutex safe_base_mutex;
+} // anonymous namespace
+
+namespace other
+{
+  void
+  foo()
+  {
+    __gnu_cxx::__scoped_lock sentry(safe_base_mutex);
+    for (int i = 0; i < max;  ++i)
+      {
+	_Safe_iterator_base* __old = __iter;
+	__iter = __iter-<_M_next;
+	__old-<_M_detach_single();
+      }
+}
+

In this sample code, an anonymous namespace is used to keep +the __mutex private to the compilation unit, +and __scoped_lock is used to guard access to the critical +section within the for loop, locking the mutex on creation and freeing +the mutex as control moves out of this block. +

Several exception classes are used to keep track of +concurrence-related errors. These classes +are: __concurrence_lock_error, __concurrence_unlock_error, __concurrence_wait_error, +and __concurrence_broadcast_error. +

diff --git a/libstdc++-v3/doc/html/manual/bk01pt03pr01.html b/libstdc++-v3/doc/html/manual/bk01pt03pr01.html new file mode 100644 index 000000000..65348b721 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt03pr01.html @@ -0,0 +1,26 @@ + + +<meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><meta name="keywords" content=" ISO C++ , library "/><link rel="home" href="../spine.html" title="The GNU C++ Library"/><link rel="up" href="extensions.html" title="Part III.  Extensions"/><link rel="prev" href="extensions.html" title="Part III.  Extensions"/><link rel="next" href="ext_compile_checks.html" title="Chapter 16. Compile Time Checks"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><th width="60%" align="center">Part III.  + Extensions + +</th><td align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr></table><hr/></div><div class="preface"><div class="titlepage"><div><div><h1 class="title"><a id="id481886"/></h1></div></div></div><p> + Here we will make an attempt at describing the non-Standard extensions to + the library. Some of these are from SGI's STL, some of these are GNU's, + and some just seemed to appear on the doorstep. +</p><p><span class="emphasis"><em>Before</em></span> you leap in and use any of these +extensions, be aware of two things: +</p><div class="orderedlist"><ol class="orderedlist"><li class="listitem"><p> + Non-Standard means exactly that. + </p><p> + The behavior, and the very + existence, of these extensions may change with little or no + warning. (Ideally, the really good ones will appear in the next + revision of C++.) Also, other platforms, other compilers, other + versions of g++ or libstdc++ may not recognize these names, or + treat them differently, or... + </p></li><li class="listitem"><p> + You should know how to access these headers properly. + </p></li></ol></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="extensions.html">Prev</a> </td><td align="center"><a accesskey="u" href="extensions.html">Up</a></td><td align="right"> <a accesskey="n" href="ext_compile_checks.html">Next</a></td></tr><tr><td align="left" valign="top">Part III.  + Extensions + + </td><td align="center"><a accesskey="h" href="../spine.html">Home</a></td><td align="right" valign="top"> Chapter 16. Compile Time Checks</td></tr></table></div></body></html> diff --git a/libstdc++-v3/doc/html/manual/bk01pt04.html b/libstdc++-v3/doc/html/manual/bk01pt04.html new file mode 100644 index 000000000..acdf72aca --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bk01pt04.html @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Part IV.  Appendices
diff --git a/libstdc++-v3/doc/html/manual/bugs.html b/libstdc++-v3/doc/html/manual/bugs.html new file mode 100644 index 000000000..eb6efdcaf --- /dev/null +++ b/libstdc++-v3/doc/html/manual/bugs.html @@ -0,0 +1,352 @@ + + +Bugs

+ Everybody's got issues. Even the C++ Standard Library. +

+ The Library Working Group, or LWG, is the ISO subcommittee responsible + for making changes to the library. They periodically publish an + Issues List containing problems and possible solutions. As they reach + a consensus on proposed solutions, we often incorporate the solution. +

+ Here are the issues which have resulted in code changes to the library. + The links are to the specific defect reports from a partial + copy of the Issues List. You can read the full version online + at the ISO C++ + Committee homepage, linked to on the + GCC "Readings" + page. If + you spend a lot of time reading the issues, we recommend downloading + the ZIP file and reading them locally. +

+ (NB: partial copy means that not all + links within the lwg-*.html pages will work. Specifically, + links to defect reports that have not been accorded full DR + status will probably break. Rather than trying to mirror the + entire issues list on our overworked web server, we recommend + you go to the LWG homepage instead.) +

+ If a DR is not listed here, we may simply not have gotten to + it yet; feel free to submit a patch. Search the include/bits + and src directories for appearances of + _GLIBCXX_RESOLVE_LIB_DEFECTS for examples + of style. Note that we usually do not make changes to the + code until an issue has reached DR status. +

5: + string::compare specification questionable +

This should be two overloaded functions rather than a single function. +

17: + Bad bool parsing +

Apparently extracting Boolean values was messed up... +

19: + "Noconv" definition too vague +

If codecvt::do_in returns noconv there are + no changes to the values in [to, to_limit). +

22: + Member open vs flags +

Re-opening a file stream does not clear the state flags. +

23: + Num_get overflow result +

Implement the proposed resolution. +

25: + String operator<< uses width() value wrong +

Padding issues. +

48: + Use of non-existent exception constructor +

An instance of ios_base::failure is constructed instead. +

49: + Underspecification of ios_base::sync_with_stdio +

The return type is the previous state of synchronization. +

50: + Copy constructor and assignment operator of ios_base +

These members functions are declared private and are + thus inaccessible. Specifying the correct semantics of + "copying stream state" was deemed too complicated. +

60: + What is a formatted input function? +

This DR made many widespread changes to basic_istream + and basic_ostream all of which have been implemented. +

63: + Exception-handling policy for unformatted output +

Make the policy consistent with that of formatted input, unformatted + input, and formatted output. +

68: + Extractors for char* should store null at end +

And they do now. An editing glitch in the last item in the list of + [27.6.1.2.3]/7. +

74: + Garbled text for codecvt::do_max_length +

The text of the standard was gibberish. Typos gone rampant. +

75: + Contradiction in codecvt::length's argument types +

Change the first parameter to stateT& and implement + the new effects paragraph. +

83: + string::npos vs. string::max_size() +

Safety checks on the size of the string should test against + max_size() rather than npos. +

90: + Incorrect description of operator>> for strings +

The effect contain isspace(c,getloc()) which must be + replaced by isspace(c,is.getloc()). +

91: + Description of operator>> and getline() for string<> + might cause endless loop +

They behave as a formatted input function and as an unformatted + input function, respectively (except that getline is + not required to set gcount). +

103: + set::iterator is required to be modifiable, but this allows + modification of keys. +

For associative containers where the value type is the same as + the key type, both iterator and const_iterator + are constant iterators. +

109: + Missing binders for non-const sequence elements +

The binder1st and binder2nd didn't have an + operator() taking a non-const parameter. +

110: + istreambuf_iterator::equal not const +

This was not a const member function. Note that the DR says to + replace the function with a const one; we have instead provided an + overloaded version with identical contents. +

117: + basic_ostream uses nonexistent num_put member functions +

num_put::put() was overloaded on the wrong types. +

118: + basic_istream uses nonexistent num_get member functions +

Same as 117, but for num_get::get(). +

129: + Need error indication from seekp() and seekg() +

These functions set failbit on error now. +

130: + Return type of container::erase(iterator) differs for associative containers +

Make member erase return iterator for set, multiset, map, multimap. +

136: + seekp, seekg setting wrong streams? +

seekp should only set the output stream, and + seekg should only set the input stream. +

167: + Improper use of traits_type::length() +

op<< with a const char* was + calculating an incorrect number of characters to write. +

169: + Bad efficiency of overflow() mandated +

Grow efficiently the internal array object. +

171: + Strange seekpos() semantics due to joint position +

Quite complex to summarize... +

181: + make_pair() unintended behavior +

This function used to take its arguments as reference-to-const, now + it copies them (pass by value). +

195: + Should basic_istream::sentry's constructor ever set eofbit? +

Yes, it can, specifically if EOF is reached while skipping whitespace. +

211: + operator>>(istream&, string&) doesn't set failbit +

If nothing is extracted into the string, op>> now + sets failbit (which can cause an exception, etc., etc.). +

214: + set::find() missing const overload +

Both set and multiset were missing + overloaded find, lower_bound, upper_bound, and equal_range functions + for const instances. +

231: + Precision in iostream? +

For conversion from a floating-point type, str.precision() + is specified in the conversion specification. +

233: + Insertion hints in associative containers +

Implement N1780, first check before then check after, insert as close + to hint as possible. +

235: + No specification of default ctor for reverse_iterator +

The declaration of reverse_iterator lists a default constructor. + However, no specification is given what this constructor should do. +

241: + Does unique_copy() require CopyConstructible and Assignable? +

Add a helper for forward_iterator/output_iterator, fix the existing + one for input_iterator/output_iterator to not rely on Assignability. +

243: + get and getline when sentry reports failure +

Store a null character only if the character array has a non-zero size. +

251: + basic_stringbuf missing allocator_type +

This nested typedef was originally not specified. +

253: + valarray helper functions are almost entirely useless +

Make the copy constructor and copy-assignment operator declarations + public in gslice_array, indirect_array, mask_array, slice_array; provide + definitions. +

265: + std::pair::pair() effects overly restrictive +

The default ctor would build its members from copies of temporaries; + now it simply uses their respective default ctors. +

266: + bad_exception::~bad_exception() missing Effects clause +

The bad_* classes no longer have destructors (they + are trivial), since no description of them was ever given. +

271: + basic_iostream missing typedefs +

The typedefs it inherits from its base classes can't be used, since + (for example) basic_iostream<T>::traits_type is ambiguous. +

275: + Wrong type in num_get::get() overloads +

Similar to 118. +

280: + Comparison of reverse_iterator to const reverse_iterator +

Add global functions with two template parameters. + (NB: not added for now a templated assignment operator) +

292: + Effects of a.copyfmt (a) +

If (this == &rhs) do nothing. +

300: + List::merge() specification incomplete +

If (this == &x) do nothing. +

303: + Bitset input operator underspecified +

Basically, compare the input character to + is.widen(0) and is.widen(1). +

305: + Default behavior of codecvt<wchar_t, char, + mbstate_t>::length() +

Do not specify what codecvt<wchar_t, char, + mbstate_t>::do_length must return. +

328: + Bad sprintf format modifier in + money_put<>::do_put() +

Change the format string to "%.0Lf". +

365: + Lack of const-qualification in clause 27 +

Add const overloads of is_open. +

387: + std::complex over-encapsulated +

Add the real(T) and imag(T) + members; in C++0x mode, also adjust the existing + real() and imag() members and + free functions. +

389: + Const overload of valarray::operator[] returns + by value +

Change it to return a const T&. +

396: + what are characters zero and one +

Implement the proposed resolution. +

402: + Wrong new expression in [some_]allocator::construct +

Replace "new" with "::new". +

408: + + Is vector<reverse_iterator<char*> > forbidden? + +

Tweak the debug-mode checks in _Safe_iterator. +

409: + Closing an fstream should clear the error state +

Have open clear the error flags. +

431: + Swapping containers with unequal allocators +

Implement Option 3, as per N1599. +

432: + stringbuf::overflow() makes only one write position + available +

Implement the resolution, beyond DR 169. +

434: + bitset::to_string() hard to use +

Add three overloads, taking fewer template arguments. +

438: + Ambiguity in the "do the right thing" clause +

Implement the resolution, basically cast less. +

453: + basic_stringbuf::seekoff need not always fail for an empty stream +

Don't fail if the next pointer is null and newoff is zero. +

455: + cerr::tie() and wcerr::tie() are overspecified +

Initialize cerr tied to cout and wcerr tied to wcout. +

464: + Suggestion for new member functions in standard containers +

Add data() to std::vector and + at(const key_type&) to std::map. +

508: + Bad parameters for ranlux64_base_01 +

Fix the parameters. +

512: + Seeding subtract_with_carry_01 from a single unsigned long +

Construct a linear_congruential engine and seed with it. +

526: + Is it undefined if a function in the standard changes in + parameters? +

Use &value. +

538: + 241 again: Does unique_copy() require CopyConstructible + and Assignable? +

In case of input_iterator/output_iterator rely on Assignability of + input_iterator' value_type. +

539: + partial_sum and adjacent_difference should mention + requirements +

We were almost doing the right thing, just use std::move + in adjacent_difference. +

541: + shared_ptr template assignment and void +

Add an auto_ptr<void> specialization. +

543: + valarray slice default constructor +

Follow the straightforward proposed resolution. +

550: + What should the return type of pow(float,int) be? +

In C++0x mode, remove the pow(float,int), etc., signatures. +

586: + string inserter not a formatted function +

Change it to be a formatted output function (i.e. catch exceptions). +

596: + 27.8.1.3 Table 112 omits "a+" and "a+b" modes +

Add the missing modes to fopen_mode. +

630: + arrays of valarray +

Implement the simple resolution. +

660: + Missing bitwise operations +

Add the missing operations. +

691: + const_local_iterator cbegin, cend missing from TR1 +

In C++0x mode add cbegin(size_type) and cend(size_type) + to the unordered containers. +

693: + std::bitset::all() missing +

Add it, consistently with the discussion. +

695: + ctype<char>::classic_table() not accessible +

Make the member functions table and classic_table public. +

696: + istream::operator>>(int&) broken +

Implement the straightforward resolution. +

761: + unordered_map needs an at() member function +

In C++0x mode, add at() and at() const. +

775: + Tuple indexing should be unsigned? +

Implement the int -> size_t replacements. +

776: + Undescribed assign function of std::array +

In C++0x mode, remove assign, add fill. +

781: + std::complex should add missing C99 functions +

In C++0x mode, add std::proj. +

809: + std::swap should be overloaded for array types +

Add the overload. +

844: + complex pow return type is ambiguous +

In C++0x mode, remove the pow(complex<T>, int) signature. +

853: + to_string needs updating with zero and one +

Update / add the signatures. +

865: + More algorithms that throw away information +

The traditional HP / SGI return type and value is blessed + by the resolution of the DR. +

diff --git a/libstdc++-v3/doc/html/manual/concurrency.html b/libstdc++-v3/doc/html/manual/concurrency.html new file mode 100644 index 000000000..bc1b78792 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/concurrency.html @@ -0,0 +1,42 @@ + + +Chapter 15.  Concurrency

+ Facilities for concurrent operation, and control thereof. +

diff --git a/libstdc++-v3/doc/html/manual/configure.html b/libstdc++-v3/doc/html/manual/configure.html new file mode 100644 index 000000000..70409d0c4 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/configure.html @@ -0,0 +1,211 @@ + + +Configure

+ When configuring libstdc++, you'll have to configure the entire + gccsrcdir directory. Consider using the + toplevel gcc configuration option + --enable-languages=c++, which saves time by only + building the C++ toolchain. +

+ Here are all of the configure options specific to libstdc++. Keep + in mind that + + they + all have opposite forms as well (enable/disable and + with/without). The defaults are for the current + development sources, which may be different than those + for released versions. +

The canonical way to find out the configure options that are + available for a given set of libstdc++ sources is to go to the + source directory and then type:./configure --help. +

--enable-multilib[default]

This is part of the generic multilib support for building cross + compilers. As such, targets like "powerpc-elf" will have + libstdc++ built many different ways: "-msoft-float" + and not, etc. A different libstdc++ will be built for each of + the different multilib versions. This option is on by default. +

--enable-sjlj-exceptions

Forces old, set-jump/long-jump exception handling model. If + at all possible, the new, frame unwinding exception handling routines + should be used instead, as they significantly reduce both + runtime memory usage and executable size. This option can + change the library ABI. +

--enable-version-specific-runtime-libs

Specify that run-time libraries should be installed in the + compiler-specific subdirectory (i.e., + ${libdir}/gcc-lib/${target_alias}/${gcc_version}) + instead of ${libdir}. This option is useful if you + intend to use several versions of gcc in parallel. In addition, + libstdc++'s include files will be installed in + ${libdir}/gcc-lib/${target_alias}/${gcc_version}/include/g++, + unless you also specify + --with-gxx-include-dir=dirname during configuration. +

--with-gxx-include-dir=<include-files dir>

Adds support for named libstdc++ include directory. For instance, + the following puts all the libstdc++ headers into a directory + called "4.4-20090404" instead of the usual + "c++/(version)". +

+   --with-gxx-include-dir=/foo/H-x86-gcc-3-c-gxx-inc/include/4.4-20090404
--enable-cstdio

This is an abbreviated form of '--enable-cstdio=stdio' + (described next). +

--enable-cstdio=OPTION

Select a target-specific I/O package. At the moment, the only + choice is to use 'stdio', a generic "C" abstraction. + The default is 'stdio'. This option can change the library ABI. +

--enable-clocale

This is an abbreviated form of '--enable-clocale=generic' + (described next). +

--enable-clocale=OPTION

Select a target-specific underlying locale package. The + choices are 'ieee_1003.1-2001' to specify an X/Open, Standard Unix + (IEEE Std. 1003.1-2001) model based on langinfo/iconv/catgets, + 'gnu' to specify a model based on functionality from the GNU C + library (langinfo/iconv/gettext) (from glibc, the GNU C + library), or 'generic' to use a generic "C" + abstraction which consists of "C" locale info. +

If not explicitly specified, the configure proccess tries + to guess the most suitable package from the choices above. The + default is 'generic'. On glibc-based systems of sufficient + vintage (2.3 and newer), 'gnu' is automatically selected. This option + can change the library ABI. +

--enable-libstdcxx-allocator

This is an abbreviated form of + '--enable-libstdcxx-allocator=auto' (described + next). +

--enable-libstdcxx-allocator=OPTION

Select a target-specific underlying std::allocator. The + choices are 'new' to specify a wrapper for new, 'malloc' to + specify a wrapper for malloc, 'mt' for a fixed power of two allocator, + 'pool' for the SGI pooled allocator or 'bitmap' for a bitmap allocator. + See this page for more information on allocator + extensions. This option + can change the library ABI. +

--enable-cheaders=OPTION

This allows the user to define the approach taken for C header + compatibility with C++. Options are c, c_std, and c_global. + These correspond to the source directory's include/c, + include/c_std, and include/c_global, and may also include + include/c_compatibility. The default is 'c_global'. +

--enable-threads

This is an abbreviated form of '--enable-threads=yes' + (described next). +

--enable-threads=OPTION

Select a threading library. A full description is + given in the + general compiler + configuration instructions. This option can change the + library ABI. +

--enable-libstdcxx-time

This is an abbreviated form of + '--enable-libstdcxx-time=yes'(described next). +

--enable-libstdcxx-time=OPTION

Enables link-type checks for the availability of the + clock_gettime clocks, used in the implementation of [time.clock], + and of the nanosleep and sched_yield functions, used in the + implementation of [thread.thread.this] of the current C++0x draft. + The choice OPTION=yes checks for the availability of the facilities + in libc and libposix4. In case of need the latter is also linked + to libstdc++ as part of the build process. OPTION=rt also searches + (and, in case, links) librt. Note that the latter is not always + desirable because, in glibc, for example, in turn it triggers the + linking of libpthread too, which activates locking, a large overhead + for single-thread programs. OPTION=no skips the tests completely. + The default is OPTION=no. +

--enable-libstdcxx-debug

Build separate debug libraries in addition to what is normally built. + By default, the debug libraries are compiled with + CXXFLAGS='-g3 -O0 -fno-inline' + , are installed in ${libdir}/debug, and have the + same names and versioning information as the non-debug + libraries. This option is off by default. +

Note this make command, executed in + the build directory, will do much the same thing, without the + configuration difference and without building everything twice: + make CXXFLAGS='-g3 -O0 -fno-inline' all +

--enable-libstdcxx-debug-flags=FLAGS

This option is only valid when --enable-debug + is also specified, and applies to the debug builds only. With + this option, you can pass a specific string of flags to the + compiler to use when building the debug versions of libstdc++. + FLAGS is a quoted string of options, like +

+  --enable-libstdcxx-debug-flags='-g3 -O1 -fno-inline'
--enable-cxx-flags=FLAGS

With this option, you can pass a string of -f (functionality) + flags to the compiler to use when building libstdc++. This + option can change the library ABI. FLAGS is a quoted string of + options, like +

+  --enable-cxx-flags='-fvtable-gc -fomit-frame-pointer -ansi'

+ Note that the flags don't necessarily have to all be -f flags, + as shown, but usually those are the ones that will make sense + for experimentation and configure-time overriding. +

The advantage of --enable-cxx-flags over setting CXXFLAGS in + the 'make' environment is that, if files are automatically + rebuilt, the same flags will be used when compiling those files + as well, so that everything matches. +

Fun flags to try might include combinations of +

+  -fstrict-aliasing
+  -fno-exceptions
+  -ffunction-sections
+  -fvtable-gc

and opposite forms (-fno-) of the same. Tell us (the libstdc++ + mailing list) if you discover more! +

--enable-c99

The "long long" type was introduced in C99, along + with many other functions for wide characters, and math + classification macros, etc. If enabled, all C99 functions not + specified by the C++ standard will be put into namespace + __gnu_cxx, and then all these names will + be injected into namespace std, so that C99 functions can be + used "as if" they were in the C++ standard (as they + will eventually be in some future revision of the standard, + without a doubt). By default, C99 support is on, assuming the + configure probes find all the necessary functions and bits + necessary. This option can change the library ABI. +

--enable-wchar_t[default]

Template specializations for the "wchar_t" type are + required for wide character conversion support. Disabling + wide character specializations may be expedient for initial + porting efforts, but builds only a subset of what is required by + ISO, and is not recommended. By default, this option is on. + This option can change the library ABI. +

--enable-long-long

The "long long" type was introduced in C99. It is + provided as a GNU extension to C++98 in g++. This flag builds + support for "long long" into the library (specialized + templates and the like for iostreams). This option is on by default: + if enabled, users will have to either use the new-style "C" + headers by default (i.e., <cmath> not <math.h>) + or add appropriate compile-time flags to all compile lines to + allow "C" visibility of this feature (on GNU/Linux, + the flag is -D_ISOC99_SOURCE, which is added automatically via + CPLUSPLUS_CPP_SPEC's addition of _GNU_SOURCE). + This option can change the library ABI. +

--enable-fully-dynamic-string

This option enables a special version of basic_string avoiding + the optimization that allocates empty objects in static memory. + Mostly useful together with shared memory allocators, see PR + libstdc++/16612 for details. +

--enable-concept-checks

This turns on additional compile-time checks for instantiated + library templates, in the form of specialized templates, + described here. They + can help users discover when they break the rules of the STL, before + their programs run. +

--enable-symvers[=style]

In 3.1 and later, tries to turn on symbol versioning in the + shared library (if a shared library has been + requested). Values for 'style' that are currently supported + are 'gnu', 'gnu-versioned-namespace', 'darwin', + 'darwin-export', and 'sun'. Both gnu- options require that a recent + version of the GNU linker be in use. Both darwin options are + equivalent. With no style given, the configure script will try + to guess correct defaults for the host system, probe to see if + additional requirements are necessary and present for + activation, and if so, will turn symbol versioning on. This + option can change the library ABI. +

--enable-visibility

In 4.2 and later, enables or disables visibility attributes. + If enabled (as by default), and the compiler seems capable of + passing the simple sanity checks thrown at it, adjusts items + in namespace std, namespace std::tr1, and namespace __gnu_cxx + so that -fvisibility options work. +

--enable-libstdcxx-pch

In 3.4 and later, tries to turn on the generation of + stdc++.h.gch, a pre-compiled file including all the standard + C++ includes. If enabled (as by default), and the compiler + seems capable of passing the simple sanity checks thrown at + it, try to build stdc++.h.gch as part of the make process. + In addition, this generated file is used later on (by appending + --include bits/stdc++.h to CXXFLAGS) when running the + testsuite. +

--enable-extern-template[default]

Use extern template to pre-instantiate all required + specializations for certain types defined in the standard libraries. + These types include string and dependents like + char_traits, the templateized io classes, + allocator, and others. + Disabling means that implicit + template generation will be used when compiling these types. By + default, this option is on. This option can change the library ABI. +

--disable-hosted-libstdcxx

+ By default, a complete hosted C++ library is + built. The C++ Standard also describes a + freestanding environment, in which only a + minimal set of headers are provided. This option builds such an + environment. +

diff --git a/libstdc++-v3/doc/html/manual/containers.html b/libstdc++-v3/doc/html/manual/containers.html new file mode 100644 index 000000000..1185af6a1 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/containers.html @@ -0,0 +1,55 @@ + + +Chapter 9.  Containers

+ Yes it is, and that's okay. This is a decision that we preserved + when we imported SGI's STL implementation. The following is + quoted from their FAQ: +

+ The size() member function, for list and slist, takes time + proportional to the number of elements in the list. This was a + deliberate tradeoff. The only way to get a constant-time + size() for linked lists would be to maintain an extra member + variable containing the list's size. This would require taking + extra time to update that variable (it would make splice() a + linear time operation, for example), and it would also make the + list larger. Many list algorithms don't require that extra + word (algorithms that do require it might do better with + vectors than with lists), and, when it is necessary to maintain + an explicit size count, it's something that users can do + themselves. +

+ This choice is permitted by the C++ standard. The standard says + that size() should be constant time, and + should does not mean the same thing as + shall. This is the officially recommended ISO + wording for saying that an implementation is supposed to do + something unless there is a good reason not to. +

+ One implication of linear time size(): you should never write +

+	 if (L.size() == 0)
+	     ...
+	 

+ Instead, you should write +

+	 if (L.empty())
+	     ...
+	 

+

+ In this + message to the list, Daniel Kostecky announced work on an + alternate form of std::vector that would support + hints on the number of elements to be over-allocated. The design + was also described, along with possible implementation choices. +

+ The first two alpha releases were announced here + and here. +

diff --git a/libstdc++-v3/doc/html/manual/containers_and_c.html b/libstdc++-v3/doc/html/manual/containers_and_c.html new file mode 100644 index 000000000..3e612aa5a --- /dev/null +++ b/libstdc++-v3/doc/html/manual/containers_and_c.html @@ -0,0 +1,90 @@ + + +Interacting with C

+ You're writing some code and can't decide whether to use builtin + arrays or some kind of container. There are compelling reasons + to use one of the container classes, but you're afraid that + you'll eventually run into difficulties, change everything back + to arrays, and then have to change all the code that uses those + data types to keep up with the change. +

+ If your code makes use of the standard algorithms, this isn't as + scary as it sounds. The algorithms don't know, nor care, about + the kind of container on which they work, since + the algorithms are only given endpoints to work with. For the + container classes, these are iterators (usually + begin() and end(), but not always). + For builtin arrays, these are the address of the first element + and the past-the-end element. +

+ Some very simple wrapper functions can hide all of that from the + rest of the code. For example, a pair of functions called + beginof can be written, one that takes an array, + another that takes a vector. The first returns a pointer to the + first element, and the second returns the vector's + begin() iterator. +

+ The functions should be made template functions, and should also + be declared inline. As pointed out in the comments in the code + below, this can lead to beginof being optimized out + of existence, so you pay absolutely nothing in terms of increased + code size or execution time. +

+ The result is that if all your algorithm calls look like +

+   std::transform(beginof(foo), endof(foo), beginof(foo), SomeFunction);
+   

+ then the type of foo can change from an array of ints to a vector + of ints to a deque of ints and back again, without ever changing + any client code. +

+// beginof
+template<typename T>
+  inline typename vector<T>::iterator
+  beginof(vector<T> &v)
+  { return v.begin(); }
+
+template<typename T, unsigned int sz>
+  inline T*
+  beginof(T (&array)[sz]) { return array; }
+
+// endof
+template<typename T>
+  inline typename vector<T>::iterator
+  endof(vector<T> &v)
+  { return v.end(); }
+
+template<typename T, unsigned int sz>
+  inline T*
+  endof(T (&array)[sz]) { return array + sz; }
+
+// lengthof
+template<typename T>
+  inline typename vector<T>::size_type
+  lengthof(vector<T> &v)
+  { return v.size(); }
+
+template<typename T, unsigned int sz>
+  inline unsigned int
+  lengthof(T (&)[sz]) { return sz; }
+

+ Astute readers will notice two things at once: first, that the + container class is still a vector<T> instead + of a more general Container<T>. This would + mean that three functions for deque would have to be + added, another three for list, and so on. This is + due to problems with getting template resolution correct; I find + it easier just to give the extra three lines and avoid confusion. +

+ Second, the line +

+    inline unsigned int lengthof (T (&)[sz]) { return sz; }
+   

+ looks just weird! Hint: unused parameters can be left nameless. +

diff --git a/libstdc++-v3/doc/html/manual/debug.html b/libstdc++-v3/doc/html/manual/debug.html new file mode 100644 index 000000000..55b5abf76 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/debug.html @@ -0,0 +1,231 @@ + + +Debugging Support

+ There are numerous things that can be done to improve the ease with + which C++ binaries are debugged when using the GNU tool chain. Here + are some of them. +

+ There are various third party memory tracing and debug utilities + that can be used to provide detailed memory allocation information + about C++ code. An exhaustive list of tools is not going to be + attempted, but includes mtrace, valgrind, + mudflap, and the non-free commercial product + purify. In addition, libcwd has a + replacement for the global new and delete operators that can track + memory allocation and deallocation and provide useful memory + statistics. +

+ Regardless of the memory debugging tool being used, there is one + thing of great importance to keep in mind when debugging C++ code + that uses new and delete: there are + different kinds of allocation schemes that can be used by + std::allocator . For implementation details, see the mt allocator documentation and + look specifically for GLIBCXX_FORCE_NEW. +

+ In a nutshell, the default allocator used by + std::allocator is a high-performance pool allocator, and can + give the mistaken impression that in a suspect executable, memory is + being leaked, when in reality the memory "leak" is a pool being used + by the library's allocator and is reclaimed after program + termination. +

+ For valgrind, there are some specific items to keep in mind. First + of all, use a version of valgrind that will work with current GNU + C++ tools: the first that can do this is valgrind 1.0.4, but later + versions should work at least as well. Second of all, use a + completely unoptimized build to avoid confusing valgrind. Third, use + GLIBCXX_FORCE_NEW to keep extraneous pool allocation noise from + cluttering debug information. +

+ Fourth, it may be necessary to force deallocation in other libraries + as well, namely the "C" library. On linux, this can be accomplished + with the appropriate use of the __cxa_atexit or + atexit functions. +

+   #include <cstdlib>
+
+   extern "C" void __libc_freeres(void);
+
+   void do_something() { }
+
+   int main()
+   {
+     atexit(__libc_freeres);
+     do_something();
+     return 0;
+   }
+

or, using __cxa_atexit:

+   extern "C" void __libc_freeres(void);
+   extern "C" int __cxa_atexit(void (*func) (void *), void *arg, void *d);
+
+   void do_something() { }
+
+   int main()
+   {
+      extern void* __dso_handle __attribute__ ((__weak__));
+      __cxa_atexit((void (*) (void *)) __libc_freeres, NULL,
+		   &__dso_handle ? __dso_handle : NULL);
+      do_test();
+      return 0;
+   }
+

+ Suggested valgrind flags, given the suggestions above about setting + up the runtime environment, library, and test file, might be: +

+   valgrind -v --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes a.out
+

+ All synchronization primitives used in the library internals need to be + understood by race detectors so that they do not produce false reports. +

+ Two annotation macros are used to explain low-level synchronization + to race detectors: + _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE() and + _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(). + By default, these macros are defined empty -- anyone who wants + to use a race detector needs to redefine them to call an + appropriate API. + Since these macros are empty by default when the library is built, + redefining them will only affect inline functions and template + instantiations which are compiled in user code. This allows annotation + of templates such as shared_ptr, but not code which is + only instantiated in the library. + In order to annotate basic_string reference counting it + is necessary to disable extern templates (by defining + _GLIBCXX_EXTERN_TEMPLATE=-1) or to rebuild the + .so file. + Annotating the remaining atomic operations (at the time of writing these + are in ios_base::Init::~Init, locale::_Impl and + locale::facet) requires rebuilding the .so file. +

+ The approach described above is known to work with the following race + detection tools: + + DRD, + + Helgrind, and + + ThreadSanitizer. +

+ With DRD, Helgrind and ThreadSanitizer you will need to define + the macros like this: +

+  #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(A) ANNOTATE_HAPPENS_BEFORE(A)
+  #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(A)  ANNOTATE_HAPPENS_AFTER(A)
+

+ Refer to the documentation of each particular tool for details. +

+

+ Many options are available for GDB itself: please see + "GDB features for C++" in the GDB documentation. Also + recommended: the other parts of this manual. +

+ These settings can either be switched on in at the GDB command line, + or put into a .gdbint file to establish default debugging + characteristics, like so: +

+   set print pretty on
+   set print object on
+   set print static-members on
+   set print vtbl on
+   set print demangle on
+   set demangle-style gnu-v3
+

+ Starting with version 7.0, GDB includes support for writing + pretty-printers in Python. Pretty printers for STL classes are + distributed with GCC from version 4.5.0. The most recent version of + these printers are always found in libstdc++ svn repository. + To enable these printers, check-out the latest printers to a local + directory: +

+  svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python
+

+ Next, add the following section to your ~/.gdbinit The path must + match the location where the Python module above was checked-out. + So if checked out to: /home/maude/gdb_printers/, the path would be as + written in the example below. +

+  python
+  import sys
+  sys.path.insert(0, '/home/maude/gdb_printers/python')
+  from libstdcxx.v6.printers import register_libstdcxx_printers
+  register_libstdcxx_printers (None)
+  end
+

+ The path should be the only element that needs to be adjusted in the + example. Once loaded, STL classes that the printers support + should print in a more human-readable format. To print the classes + in the old style, use the /r (raw) switch in the print command + (i.e., print /r foo). This will print the classes as if the Python + pretty-printers were not loaded. +

+ For additional information on STL support and GDB please visit: + "GDB Support + for STL" in the GDB wiki. Additionally, in-depth + documentation and discussion of the pretty printing feature can be + found in "Pretty Printing" node in the GDB manual. You can find + on-line versions of the GDB user manual in GDB's homepage, at + "GDB: The GNU Project + Debugger" . +

+ The verbose + termination handler gives information about uncaught + exceptions which are killing the program. It is described in the + linked-to page. +

The Debug Mode + has compile and run-time checks for many containers. +

The Compile-Time + Checks Extension has compile-time checks for many algorithms. +

The Profile-based + Performance Analysis Extension has performance checks for many + algorithms. +

diff --git a/libstdc++-v3/doc/html/manual/debug_mode.html b/libstdc++-v3/doc/html/manual/debug_mode.html new file mode 100644 index 000000000..f35960b53 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/debug_mode.html @@ -0,0 +1,37 @@ + + +Chapter 17. Debug Mode

+ By default, libstdc++ is built with efficiency in mind, and + therefore performs little or no error checking that is not + required by the C++ standard. This means that programs that + incorrectly use the C++ standard library will exhibit behavior + that is not portable and may not even be predictable, because they + tread into implementation-specific or undefined behavior. To + detect some of these errors before they can become problematic, + libstdc++ offers a debug mode that provides additional checking of + library facilities, and will report errors in the use of libstdc++ + as soon as they can be detected by emitting a description of the + problem to standard error and aborting the program. This debug + mode is available with GCC 3.4.0 and later versions. +

+ The libstdc++ debug mode performs checking for many areas of the + C++ standard, but the focus is on checking interactions among + standard iterators, containers, and algorithms, including: +

diff --git a/libstdc++-v3/doc/html/manual/diagnostics.html b/libstdc++-v3/doc/html/manual/diagnostics.html new file mode 100644 index 000000000..9c9abdfc2 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/diagnostics.html @@ -0,0 +1,43 @@ + + +Chapter 5.  Diagnostics
diff --git a/libstdc++-v3/doc/html/manual/documentation_hacking.html b/libstdc++-v3/doc/html/manual/documentation_hacking.html new file mode 100644 index 000000000..fbb85b150 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/documentation_hacking.html @@ -0,0 +1,442 @@ + + +Writing and Generating Documentation

+ Certain Makefile rules are required by the GNU Coding + Standards. These standard rules generate HTML, PDF, XML, or man + files. For each of the generative rules, there is an additional + install rule that is used to install any generated documentation + files into the prescribed installation directory. Files are + installed into share/doc + or share/man directories. +

+ The standard Makefile rules are conditionally supported, based + on the results of examining the host environment for + prerequisites at configuration time. If requirements are not + found, the rule is aliased to a dummy rule that does nothing, + and produces no documentation. If the requirements are found, + the rule forwards to a private rule that produces the requested + documentation. +

+ For more details on what prerequisites were found and where, + please consult the file config.log in the + libstdc++ build directory. Compare this log to what is expected + for the relevant Makefile conditionals: + BUILD_INFO, BUILD_XML, + BUILD_HTML, BUILD_MAN, + BUILD_PDF, and BUILD_EPUB. +

+ Supported Makefile rules: +

+ Makefile rules for several other formats are explicitly not + supported, and are always aliased to dummy rules. These + unsupported formats are: info, + ps, and dvi. +


+ Prerequisite tools are Bash 2.0 or later, + Doxygen, and + the GNU + coreutils. (GNU versions of find, xargs, and possibly + sed and grep are used, just because the GNU versions make + things very easy.) +

+ To generate the pretty pictures and hierarchy + graphs, the + Graphviz package + will need to be installed. For PDF + output, + pdflatex is required. +

+ In general, libstdc++ files should be formatted according to + the rules found in the + Coding Standard. Before + any doxygen-specific formatting tweaks are made, please try to + make sure that the initial formatting is sound. +

+ Adding Doxygen markup to a file (informally called + doxygenating) is very simple. The Doxygen manual can be + found + here. + We try to use a very-recent version of Doxygen. +

+ For classes, use + deque/vector/list + and std::pair as examples. For + functions, see their member functions, and the free functions + in stl_algobase.h. Member functions of + other container-like types should read similarly to these + member functions. +

+ Some commentary to accompany + the first list in the Special + Documentation Blocks section of + the Doxygen manual: +

  1. For longer comments, use the Javadoc style...

  2. + ...not the Qt style. The intermediate *'s are preferred. +

  3. + Use the triple-slash style only for one-line comments (the + brief mode). +

  4. + This is disgusting. Don't do this. +

+ Some specific guidelines: +

+ Use the @-style of commands, not the !-style. Please be + careful about whitespace in your markup comments. Most of the + time it doesn't matter; doxygen absorbs most whitespace, and + both HTML and *roff are agnostic about whitespace. However, + in <pre> blocks and @code/@endcode sections, spacing can + have interesting effects. +

+ Use either kind of grouping, as + appropriate. doxygroups.cc exists for this + purpose. See stl_iterator.h for a good example + of the other kind of grouping. +

+ Please use markup tags like @p and @a when referring to things + such as the names of function parameters. Use @e for emphasis + when necessary. Use @c to refer to other standard names. + (Examples of all these abound in the present code.) +

+ Complicated math functions should use the multi-line + format. An example from random.h: +

+


+/**
+ * @brief A model of a linear congruential random number generator.
+ *
+ * @f[
+ *     x_{i+1}\leftarrow(ax_{i} + c) \bmod m
+ * @f]
+ */
+

+

+ One area of note is the markup required for + @file markup in header files. Two details + are important: for filenames that have the same name in + multiple directories, include part of the installed path to + disambiguate. For example: +

+


+/** @file debug/vector
+ *  This file is a GNU debug extension to the Standard C++ Library.
+ */
+

+

+ The other relevant detail for header files is the use of a + libstdc++-specific doxygen alias that helps distinguish + between public header files (like random) + from implementation or private header files (like + bits/c++config.h.) This alias is spelled + @headername and can take one or two + arguments that detail the public header file or files that + should be included to use the contents of the file. All header + files that are not intended for direct inclusion must use + headername in the file + block. An example: +

+


+/** @file bits/basic_string.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{string}
+ */
+

+

+ Be careful about using certain, special characters when + writing Doxygen comments. Single and double quotes, and + separators in filenames are two common trouble spots. When in + doubt, consult the following table. +



+ Editing the DocBook sources requires an XML editor. Many + exist: some notable options + include emacs, Kate, + or Conglomerate. +

+ Some editors support special XML Validation + modes that can validate the file as it is + produced. Recommended is the nXML Mode + for emacs. +

+ Besides an editor, additional DocBook files and XML tools are + also required. +

+ Access to the DocBook 5.0 stylesheets and schema is required. The + stylesheets are usually packaged by vendor, in something + like docbook5-style-xsl. To exactly match + generated output, please use a version of the stylesheets + equivalent + to docbook5-style-xsl-1.75.2-3. The + installation directory for this package corresponds to + the XSL_STYLE_DIR + in doc/Makefile.am and defaults + to /usr/share/sgml/docbook/xsl-ns-stylesheets. +

+ For processing XML, an XML processor and some style + sheets are necessary. Defaults are xsltproc + provided by libxslt. +

+ For validating the XML document, you'll need + something like xmllint and access to the + relevant DocBook schema. These are provided + by a vendor package like libxml2 and docbook5-schemas-5.0-4 +

+ For PDF output, something that transforms valid Docbook XML to PDF is + required. Possible solutions include dblatex, + xmlto, or prince. Of + these, dblatex is the default. Other + options are listed on the DocBook web pages. Please + consult the list when + preparing printed manuals for current best practice and + suggestions. +

+ For Texinfo output, something that transforms valid Docbook + XML to Texinfo is required. The default choice is docbook2X. +


+      Which files are important
+
+      All Docbook files are in the directory
+      libstdc++-v3/doc/xml
+
+      Inside this directory, the files of importance:
+      spine.xml   - index to documentation set
+      manual/spine.xml  - index to manual
+      manual/*.xml   - individual chapters and sections of the manual
+      faq.xml   - index to FAQ
+      api.xml   - index to source level / API
+
+      All *.txml files are template xml files, i.e., otherwise empty files with
+      the correct structure, suitable for filling in with new information.
+
+      Canonical Writing Style
+
+      class template
+      function template
+      member function template
+      (via C++ Templates, Vandevoorde)
+
+      class in namespace std: allocator, not std::allocator
+
+      header file: iostream, not <iostream>
+
+
+      General structure
+
+      <set>
+      <book>
+      </book>
+
+      <book>
+      <chapter>
+      </chapter>
+      </book>
+
+      <book>
+      <part>
+      <chapter>
+      <section>
+      </section>
+
+      <sect1>
+      </sect1>
+
+      <sect1>
+      <sect2>
+      </sect2>
+      </sect1>
+      </chapter>
+
+      <chapter>
+      </chapter>
+      </part>
+      </book>
+
+      </set>
+    

diff --git a/libstdc++-v3/doc/html/manual/dynamic_memory.html b/libstdc++-v3/doc/html/manual/dynamic_memory.html new file mode 100644 index 000000000..481347bef --- /dev/null +++ b/libstdc++-v3/doc/html/manual/dynamic_memory.html @@ -0,0 +1,72 @@ + + +Dynamic Memory

+ There are six flavors each of new and + delete, so make certain that you're using the right + ones. Here are quickie descriptions of new: +

+ They are distinguished by the parameters that you pass to them, like + any other overloaded function. The six flavors of delete + are distinguished the same way, but none of them are allowed to throw + an exception under any circumstances anyhow. (They match up for + completeness' sake.) +

+ Remember that it is perfectly okay to call delete on a + NULL pointer! Nothing happens, by definition. That is not the + same thing as deleting a pointer twice. +

+ By default, if one of the throwing news can't + allocate the memory requested, it tosses an instance of a + bad_alloc exception (or, technically, some class derived + from it). You can change this by writing your own function (called a + new-handler) and then registering it with set_new_handler(): +

+   typedef void (*PFV)(void);
+
+   static char*  safety;
+   static PFV    old_handler;
+
+   void my_new_handler ()
+   {
+       delete[] safety;
+       popup_window ("Dude, you are running low on heap memory.  You
+		      should, like, close some windows, or something.
+		      The next time you run out, we're gonna burn!");
+       set_new_handler (old_handler);
+       return;
+   }
+
+   int main ()
+   {
+       safety = new char[500000];
+       old_handler = set_new_handler (&my_new_handler);
+       ...
+   }
+   

+ bad_alloc is derived from the base exception + class defined in Sect1 19. +

diff --git a/libstdc++-v3/doc/html/manual/ext_algorithms.html b/libstdc++-v3/doc/html/manual/ext_algorithms.html new file mode 100644 index 000000000..354dd9bbc --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_algorithms.html @@ -0,0 +1,23 @@ + + +Chapter 23. Algorithms

25.1.6 (count, count_if) is extended with two more versions of count + and count_if. The standard versions return their results. The + additional signatures return void, but take a final parameter by + reference to which they assign their results, e.g., +

+   void count (first, last, value, n);

25.2 (mutating algorithms) is extended with two families of signatures, + random_sample and random_sample_n. +

25.2.1 (copy) is extended with +

+   copy_n (_InputIter first, _Size count, _OutputIter result);

which copies the first 'count' elements at 'first' into 'result'. +

25.3 (sorting 'n' heaps 'n' stuff) is extended with some helper + predicates. Look in the doxygen-generated pages for notes on these. +

25.3.8 (lexicographical_compare) is extended with +

+   lexicographical_compare_3way(_InputIter1 first1, _InputIter1 last1,
+				 _InputIter2 first2, _InputIter2 last2)

which does... what? +

diff --git a/libstdc++-v3/doc/html/manual/ext_allocators.html b/libstdc++-v3/doc/html/manual/ext_allocators.html new file mode 100644 index 000000000..bd283b75c --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_allocators.html @@ -0,0 +1,397 @@ + + +Chapter 20. Allocators

+

There are three general components to the allocator: a datum +describing the characteristics of the memory pool, a policy class +containing this pool that links instantiation types to common or +individual pools, and a class inheriting from the policy class that is +the actual allocator. +

The datum describing pools characteristics is +

+  template<bool _Thread>
+    class __pool
+

This class is parametrized on thread support, and is explicitly +specialized for both multiple threads (with bool==true) +and single threads (via bool==false.) It is possible to +use a custom pool datum instead of the default class that is provided. +

There are two distinct policy classes, each of which can be used +with either type of underlying pool datum. +

+  template<bool _Thread>
+    struct __common_pool_policy
+
+  template<typename _Tp, bool _Thread>
+    struct __per_type_pool_policy
+

The first policy, __common_pool_policy, implements a +common pool. This means that allocators that are instantiated with +different types, say char and long will both +use the same pool. This is the default policy. +

The second policy, __per_type_pool_policy, implements +a separate pool for each instantiating type. Thus, char +and long will use separate pools. This allows per-type +tuning, for instance. +

Putting this all together, the actual allocator class is +

+  template<typename _Tp, typename _Poolp = __default_policy>
+    class __mt_alloc : public __mt_alloc_base<_Tp>,  _Poolp
+

This class has the interface required for standard library allocator +classes, namely member functions allocate and +deallocate, plus others. +

+The static variables (pointers to freelists, tuning parameters etc) +are initialized as above, or are set to the global defaults. +

+The very first allocate() call will always call the +_S_initialize_once() function. In order to make sure that this +function is called exactly once we make use of a __gthread_once call +in MT applications and check a static bool (_S_init) in ST +applications. +

+The _S_initialize() function: +- If the GLIBCXX_FORCE_NEW environment variable is set, it sets the bool + _S_force_new to true and then returns. This will cause subsequent calls to + allocate() to return memory directly from a new() call, and deallocate will + only do a delete() call. +

+- If the GLIBCXX_FORCE_NEW environment variable is not set, both ST and MT + applications will: + - Calculate the number of bins needed. A bin is a specific power of two size + of bytes. I.e., by default the allocator will deal with requests of up to + 128 bytes (or whatever the value of _S_max_bytes is when _S_init() is + called). This means that there will be bins of the following sizes + (in bytes): 1, 2, 4, 8, 16, 32, 64, 128. + + - Create the _S_binmap array. All requests are rounded up to the next + "large enough" bin. I.e., a request for 29 bytes will cause a block from + the "32 byte bin" to be returned to the application. The purpose of + _S_binmap is to speed up the process of finding out which bin to use. + I.e., the value of _S_binmap[ 29 ] is initialized to 5 (bin 5 = 32 bytes). +

+ - Create the _S_bin array. This array consists of bin_records. There will be + as many bin_records in this array as the number of bins that we calculated + earlier. I.e., if _S_max_bytes = 128 there will be 8 entries. + Each bin_record is then initialized: + - bin_record->first = An array of pointers to block_records. There will be + as many block_records pointers as there are maximum number of threads + (in a ST application there is only 1 thread, in a MT application there + are _S_max_threads). + This holds the pointer to the first free block for each thread in this + bin. I.e., if we would like to know where the first free block of size 32 + for thread number 3 is we would look this up by: _S_bin[ 5 ].first[ 3 ] + + The above created block_record pointers members are now initialized to + their initial values. I.e. _S_bin[ n ].first[ n ] = NULL; +

+- Additionally a MT application will: + - Create a list of free thread id's. The pointer to the first entry + is stored in _S_thread_freelist_first. The reason for this approach is + that the __gthread_self() call will not return a value that corresponds to + the maximum number of threads allowed but rather a process id number or + something else. So what we do is that we create a list of thread_records. + This list is _S_max_threads long and each entry holds a size_t thread_id + which is initialized to 1, 2, 3, 4, 5 and so on up to _S_max_threads. + Each time a thread calls allocate() or deallocate() we call + _S_get_thread_id() which looks at the value of _S_thread_key which is a + thread local storage pointer. If this is NULL we know that this is a newly + created thread and we pop the first entry from this list and saves the + pointer to this record in the _S_thread_key variable. The next time + we will get the pointer to the thread_record back and we use the + thread_record->thread_id as identification. I.e., the first thread that + calls allocate will get the first record in this list and thus be thread + number 1 and will then find the pointer to its first free 32 byte block + in _S_bin[ 5 ].first[ 1 ] + When we create the _S_thread_key we also define a destructor + (_S_thread_key_destr) which means that when the thread dies, this + thread_record is returned to the front of this list and the thread id + can then be reused if a new thread is created. + This list is protected by a mutex (_S_thread_freelist_mutex) which is only + locked when records are removed or added to the list. +

+ - Initialize the free and used counters of each bin_record: + - bin_record->free = An array of size_t. This keeps track of the number + of blocks on a specific thread's freelist in each bin. I.e., if a thread + has 12 32-byte blocks on it's freelists and allocates one of these, this + counter would be decreased to 11. + + - bin_record->used = An array of size_t. This keeps track of the number + of blocks currently in use of this size by this thread. I.e., if a thread + has made 678 requests (and no deallocations...) of 32-byte blocks this + counter will read 678. + + The above created arrays are now initialized with their initial values. + I.e. _S_bin[ n ].free[ n ] = 0; +

+ - Initialize the mutex of each bin_record: The bin_record->mutex + is used to protect the global freelist. This concept of a global + freelist is explained in more detail in the section "A multi + threaded example", but basically this mutex is locked whenever a + block of memory is retrieved or returned to the global freelist + for this specific bin. This only occurs when a number of blocks + are grabbed from the global list to a thread specific list or when + a thread decides to return some blocks to the global freelist. +

+Let's start by describing how the data on a freelist is laid out in memory. +This is the first two blocks in freelist for thread id 3 in bin 3 (8 bytes): +

++----------------+
+| next* ---------|--+  (_S_bin[ 3 ].first[ 3 ] points here)
+|                |  |
+|                |  |
+|                |  |
++----------------+  |
+| thread_id = 3  |  |
+|                |  |
+|                |  |
+|                |  |
++----------------+  |
+| DATA           |  |  (A pointer to here is what is returned to the
+|                |  |   the application when needed)
+|                |  |
+|                |  |
+|                |  |
+|                |  |
+|                |  |
+|                |  |
++----------------+  |
++----------------+  |
+| next*          |<-+  (If next == NULL it's the last one on the list)
+|                |
+|                |
+|                |
++----------------+
+| thread_id = 3  |
+|                |
+|                |
+|                |
++----------------+
+| DATA           |
+|                |
+|                |
+|                |
+|                |
+|                |
+|                |
+|                |
++----------------+
+

+With this in mind we simplify things a bit for a while and say that there is +only one thread (a ST application). In this case all operations are made to +what is referred to as the global pool - thread id 0 (No thread may be +assigned this id since they span from 1 to _S_max_threads in a MT application). +

+When the application requests memory (calling allocate()) we first look at the +requested size and if this is > _S_max_bytes we call new() directly and return. +

+If the requested size is within limits we start by finding out from which +bin we should serve this request by looking in _S_binmap. +

+A quick look at _S_bin[ bin ].first[ 0 ] tells us if there are any blocks of +this size on the freelist (0). If this is not NULL - fine, just remove the +block that _S_bin[ bin ].first[ 0 ] points to from the list, +update _S_bin[ bin ].first[ 0 ] and return a pointer to that blocks data. +

+If the freelist is empty (the pointer is NULL) we must get memory from the +system and build us a freelist within this memory. All requests for new memory +is made in chunks of _S_chunk_size. Knowing the size of a block_record and +the bytes that this bin stores we then calculate how many blocks we can create +within this chunk, build the list, remove the first block, update the pointer +(_S_bin[ bin ].first[ 0 ]) and return a pointer to that blocks data. +

+Deallocation is equally simple; the pointer is casted back to a block_record +pointer, lookup which bin to use based on the size, add the block to the front +of the global freelist and update the pointer as needed +(_S_bin[ bin ].first[ 0 ]). +

+The decision to add deallocated blocks to the front of the freelist was made +after a set of performance measurements that showed that this is roughly 10% +faster than maintaining a set of "last pointers" as well. +

+In the ST example we never used the thread_id variable present in each block. +Let's start by explaining the purpose of this in a MT application. +

+The concept of "ownership" was introduced since many MT applications +allocate and deallocate memory to shared containers from different +threads (such as a cache shared amongst all threads). This introduces +a problem if the allocator only returns memory to the current threads +freelist (I.e., there might be one thread doing all the allocation and +thus obtaining ever more memory from the system and another thread +that is getting a longer and longer freelist - this will in the end +consume all available memory). +

+Each time a block is moved from the global list (where ownership is +irrelevant), to a threads freelist (or when a new freelist is built +from a chunk directly onto a threads freelist or when a deallocation +occurs on a block which was not allocated by the same thread id as the +one doing the deallocation) the thread id is set to the current one. +

+What's the use? Well, when a deallocation occurs we can now look at +the thread id and find out if it was allocated by another thread id +and decrease the used counter of that thread instead, thus keeping the +free and used counters correct. And keeping the free and used counters +corrects is very important since the relationship between these two +variables decides if memory should be returned to the global pool or +not when a deallocation occurs. +

+When the application requests memory (calling allocate()) we first +look at the requested size and if this is >_S_max_bytes we call new() +directly and return. +

+If the requested size is within limits we start by finding out from which +bin we should serve this request by looking in _S_binmap. +

+A call to _S_get_thread_id() returns the thread id for the calling thread +(and if no value has been set in _S_thread_key, a new id is assigned and +returned). +

+A quick look at _S_bin[ bin ].first[ thread_id ] tells us if there are +any blocks of this size on the current threads freelist. If this is +not NULL - fine, just remove the block that _S_bin[ bin ].first[ +thread_id ] points to from the list, update _S_bin[ bin ].first[ +thread_id ], update the free and used counters and return a pointer to +that blocks data. +

+If the freelist is empty (the pointer is NULL) we start by looking at +the global freelist (0). If there are blocks available on the global +freelist we lock this bins mutex and move up to block_count (the +number of blocks of this bins size that will fit into a _S_chunk_size) +or until end of list - whatever comes first - to the current threads +freelist and at the same time change the thread_id ownership and +update the counters and pointers. When the bins mutex has been +unlocked, we remove the block that _S_bin[ bin ].first[ thread_id ] +points to from the list, update _S_bin[ bin ].first[ thread_id ], +update the free and used counters, and return a pointer to that blocks +data. +

+The reason that the number of blocks moved to the current threads +freelist is limited to block_count is to minimize the chance that a +subsequent deallocate() call will return the excess blocks to the +global freelist (based on the _S_freelist_headroom calculation, see +below). +

+However if there isn't any memory on the global pool we need to get +memory from the system - this is done in exactly the same way as in a +single threaded application with one major difference; the list built +in the newly allocated memory (of _S_chunk_size size) is added to the +current threads freelist instead of to the global. +

+The basic process of a deallocation call is simple: always add the +block to the front of the current threads freelist and update the +counters and pointers (as described earlier with the specific check of +ownership that causes the used counter of the thread that originally +allocated the block to be decreased instead of the current threads +counter). +

+And here comes the free and used counters to service. Each time a +deallocation() call is made, the length of the current threads +freelist is compared to the amount memory in use by this thread. +

+Let's go back to the example of an application that has one thread +that does all the allocations and one that deallocates. Both these +threads use say 516 32-byte blocks that was allocated during thread +creation for example. Their used counters will both say 516 at this +point. The allocation thread now grabs 1000 32-byte blocks and puts +them in a shared container. The used counter for this thread is now +1516. +

+The deallocation thread now deallocates 500 of these blocks. For each +deallocation made the used counter of the allocating thread is +decreased and the freelist of the deallocation thread gets longer and +longer. But the calculation made in deallocate() will limit the length +of the freelist in the deallocation thread to _S_freelist_headroom % +of it's used counter. In this case, when the freelist (given that the +_S_freelist_headroom is at it's default value of 10%) exceeds 52 +(516/10) blocks will be returned to the global pool where the +allocating thread may pick them up and reuse them. +

+In order to reduce lock contention (since this requires this bins +mutex to be locked) this operation is also made in chunks of blocks +(just like when chunks of blocks are moved from the global freelist to +a threads freelist mentioned above). The "formula" used can probably +be improved to further reduce the risk of blocks being "bounced back +and forth" between freelists. +

diff --git a/libstdc++-v3/doc/html/manual/ext_compile_checks.html b/libstdc++-v3/doc/html/manual/ext_compile_checks.html new file mode 100644 index 000000000..c648797c1 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_compile_checks.html @@ -0,0 +1,40 @@ + + +Chapter 16. Compile Time Checks

+ Also known as concept checking. +

In 1999, SGI added concept checkers to their implementation + of the STL: code which checked the template parameters of + instantiated pieces of the STL, in order to insure that the parameters + being used met the requirements of the standard. For example, + the Standard requires that types passed as template parameters to + vector be Assignable (which means what you think + it means). The checking was done during compilation, and none of + the code was executed at runtime. +

Unfortunately, the size of the compiler files grew significantly + as a result. The checking code itself was cumbersome. And bugs + were found in it on more than one occasion. +

The primary author of the checking code, Jeremy Siek, had already + started work on a replacement implementation. The new code has been + formally reviewed and accepted into + the + Boost libraries, and we are pleased to incorporate it into the + GNU C++ library. +

The new version imposes a much smaller space overhead on the generated + object file. The checks are also cleaner and easier to read and + understand. +

They are off by default for all versions of GCC from 3.0 to 3.4 (the + latest release at the time of writing). + They can be enabled at configure time with + --enable-concept-checks. + You can enable them on a per-translation-unit basis with + #define _GLIBCXX_CONCEPT_CHECKS for GCC 3.4 and higher + (or with #define _GLIBCPP_CONCEPT_CHECKS for versions + 3.1, 3.2 and 3.3). +

Please note that the upcoming C++ standard has first-class + support for template parameter constraints based on concepts in the core + language. This will obviate the need for the library-simulated concept + checking described above. +

diff --git a/libstdc++-v3/doc/html/manual/ext_concurrency.html b/libstdc++-v3/doc/html/manual/ext_concurrency.html new file mode 100644 index 000000000..99718e04f --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_concurrency.html @@ -0,0 +1,91 @@ + + +Chapter 28. Concurrency

+Two functions and one type form the base of atomic support. +

The type _Atomic_word is a signed integral type +supporting atomic operations. +

+The two functions functions are: +

+_Atomic_word
+__exchange_and_add_dispatch(volatile _Atomic_word*, int);
+
+void
+__atomic_add_dispatch(volatile _Atomic_word*, int);
+

Both of these functions are declared in the header file +<ext/atomicity.h>, and are in namespace __gnu_cxx. +

+These functions forward to one of several specialized helper +functions, depending on the circumstances. For instance, +

+ +__exchange_and_add_dispatch + +

+Calls through to either of: +

However, only __exchange_and_add_dispatch +and __atomic_add_dispatch should be used. These functions +can be used in a portable manner, regardless of the specific +environment. They are carefully designed to provide optimum efficiency +and speed, abstracting out atomic accesses when they are not required +(even on hosts that support compiler intrinsics for atomic +operations.) +

+In addition, there are two macros +

+ +_GLIBCXX_READ_MEM_BARRIER + +

+ +_GLIBCXX_WRITE_MEM_BARRIER + +

+Which expand to the appropriate write and read barrier required by the +host hardware and operating system. +

diff --git a/libstdc++-v3/doc/html/manual/ext_containers.html b/libstdc++-v3/doc/html/manual/ext_containers.html new file mode 100644 index 000000000..d07860bbd --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_containers.html @@ -0,0 +1,9 @@ + + +Chapter 21. Containers

+

diff --git a/libstdc++-v3/doc/html/manual/ext_demangling.html b/libstdc++-v3/doc/html/manual/ext_demangling.html new file mode 100644 index 000000000..0120bc2b0 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_demangling.html @@ -0,0 +1,74 @@ + + +Chapter 27. Demangling

+ Transforming C++ ABI identifiers (like RTTI symbols) into the + original C++ source identifiers is called + demangling. +

+ If you have read the source + documentation for namespace abi then you are + aware of the cross-vendor C++ ABI in use by GCC. One of the + exposed functions is used for demangling, + abi::__cxa_demangle. +

+ In programs like c++filt, the linker, and other tools + have the ability to decode C++ ABI names, and now so can you. +

+ (The function itself might use different demanglers, but that's the + whole point of abstract interfaces. If we change the implementation, + you won't notice.) +

+ Probably the only times you'll be interested in demangling at runtime + are when you're seeing typeid strings in RTTI, or when + you're handling the runtime-support exception classes. For example: +

+#include <exception>
+#include <iostream>
+#include <cxxabi.h>
+
+struct empty { };
+
+template <typename T, int N>
+  struct bar { };
+
+
+int main()
+{
+  int     status;
+  char   *realname;
+
+  // exception classes not in <stdexcept>, thrown by the implementation
+  // instead of the user
+  std::bad_exception  e;
+  realname = abi::__cxa_demangle(e.what(), 0, 0, &status);
+  std::cout << e.what() << "\t=> " << realname << "\t: " << status << '\n';
+  free(realname);
+
+
+  // typeid
+  bar<empty,17>          u;
+  const std::type_info  &ti = typeid(u);
+
+  realname = abi::__cxa_demangle(ti.name(), 0, 0, &status);
+  std::cout << ti.name() << "\t=> " << realname << "\t: " << status << '\n';
+  free(realname);
+
+  return 0;
+}
+   

+ This prints +

+   
+      St13bad_exception       => std::bad_exception   : 0
+      3barI5emptyLi17EE       => bar<empty, 17>       : 0
+   
+   

+ The demangler interface is described in the source documentation + linked to above. It is actually written in C, so you don't need to + be writing C++ in order to demangle C++. (That also means we have to + use crummy memory management facilities, so don't forget to free() + the returned char array.) +

diff --git a/libstdc++-v3/doc/html/manual/ext_io.html b/libstdc++-v3/doc/html/manual/ext_io.html new file mode 100644 index 000000000..aba0fe1d6 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_io.html @@ -0,0 +1,50 @@ + + +Chapter 26. Input and Output

+ Extensions allowing filebufs to be constructed from + "C" types like FILE*s and file descriptors. +

The v2 library included non-standard extensions to construct + std::filebufs from C stdio types such as + FILE*s and POSIX file descriptors. + Today the recommended way to use stdio types with libstdc++ + IOStreams is via the stdio_filebuf class (see below), + but earlier releases provided slightly different mechanisms. +

If you want to access a filebuf's file descriptor to + implement file locking (e.g. using the fcntl() system + call) then you might be interested in Henry Suter's RWLock class. + +

+

diff --git a/libstdc++-v3/doc/html/manual/ext_iterators.html b/libstdc++-v3/doc/html/manual/ext_iterators.html new file mode 100644 index 000000000..8c00985c4 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_iterators.html @@ -0,0 +1,14 @@ + + +Chapter 25. Iterators

24.3.2 describes struct iterator, which didn't exist in the + original HP STL implementation (the language wasn't rich enough at the + time). For backwards compatibility, base classes are provided which + declare the same nested typedefs: +

24.3.4 describes iterator operation distance, which takes + two iterators and returns a result. It is extended by another signature + which takes two iterators and a reference to a result. The result is + modified, and the function returns nothing. +

diff --git a/libstdc++-v3/doc/html/manual/ext_numerics.html b/libstdc++-v3/doc/html/manual/ext_numerics.html new file mode 100644 index 000000000..71d417c3a --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_numerics.html @@ -0,0 +1,20 @@ + + +Chapter 24. Numerics

26.4, the generalized numeric operations such as accumulate, are extended + with the following functions: +

+   power (x, n);
+   power (x, n, moniod_operation);

Returns, in FORTRAN syntax, "x ** n" where n>=0. In the + case of n == 0, returns the identity element for the + monoid operation. The two-argument signature uses multiplication (for + a true "power" implementation), but addition is supported as well. + The operation functor must be associative. +

The iota function wins the award for Extension With the + Coolest Name. It "assigns sequentially increasing values to a range. + That is, it assigns value to *first, value + 1 to *(first + 1) and so + on." Quoted from SGI documentation. +

+   void iota(_ForwardIter first, _ForwardIter last, _Tp value);
diff --git a/libstdc++-v3/doc/html/manual/ext_utilities.html b/libstdc++-v3/doc/html/manual/ext_utilities.html new file mode 100644 index 000000000..d15057c27 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/ext_utilities.html @@ -0,0 +1,41 @@ + + +Chapter 22. Utilities

+ The <functional> header contains many additional functors + and helper functions, extending section 20.3. They are + implemented in the file stl_function.h: +

+ 20.4.1 can use several different allocators; they are described on the + main extensions page. +

+ 20.4.3 is extended with a special version of + get_temporary_buffer taking a second argument. The + argument is a pointer, which is ignored, but can be used to specify + the template type (instead of using explicit function template + arguments like the standard version does). That is, in addition to +

+get_temporary_buffer<int>(5);
+

+you can also use +

+get_temporary_buffer(5, (int*)0);
+

+ A class temporary_buffer is given in stl_tempbuf.h. * +

+ The specialized algorithms of section 20.4.4 are extended with + uninitialized_copy_n. * +

diff --git a/libstdc++-v3/doc/html/manual/extensions.html b/libstdc++-v3/doc/html/manual/extensions.html new file mode 100644 index 000000000..7fae9078a --- /dev/null +++ b/libstdc++-v3/doc/html/manual/extensions.html @@ -0,0 +1,9 @@ + + +Part III.  Extensions
diff --git a/libstdc++-v3/doc/html/manual/facets.html b/libstdc++-v3/doc/html/manual/facets.html new file mode 100644 index 000000000..cfe89bc0d --- /dev/null +++ b/libstdc++-v3/doc/html/manual/facets.html @@ -0,0 +1,728 @@ + + +Facets

+The standard class codecvt attempts to address conversions between +different character encoding schemes. In particular, the standard +attempts to detail conversions between the implementation-defined wide +characters (hereafter referred to as wchar_t) and the standard type +char that is so beloved in classic C (which can now be +referred to as narrow characters.) This document attempts to describe +how the GNU libstdc++ implementation deals with the conversion between +wide and narrow characters, and also presents a framework for dealing +with the huge number of other encodings that iconv can convert, +including Unicode and UTF8. Design issues and requirements are +addressed, and examples of correct usage for both the required +specializations for wide and narrow characters and the +implementation-provided extended functionality are given. +

+Around page 425 of the C++ Standard, this charming heading comes into view: +

+The text around the codecvt definition gives some clues: +

+Hmm. So, in some unspecified way, Unicode encodings and +translations between other character sets should be handled by this +class. +

+Ah ha! Another clue... +

+At this point, a couple points become clear: +

+One: The standard clearly implies that attempts to add non-required +(yet useful and widely used) conversions need to do so through the +third template parameter, stateT.

+Two: The required conversions, by specifying mbstate_t as the third +template parameter, imply an implementation strategy that is mostly +(or wholly) based on the underlying C library, and the functions +mcsrtombs and wcsrtombs in particular.

+ Probably the most frequently asked question about code conversion + is: "So dudes, what's the deal with Unicode strings?" + The dude part is optional, but apparently the usefulness of + Unicode strings is pretty widely appreciated. Sadly, this specific + encoding (And other useful encodings like UTF8, UCS4, ISO 8859-10, + etc etc etc) are not mentioned in the C++ standard. +

+ A couple of comments: +

+ The thought that all one needs to convert between two arbitrary + codesets is two types and some kind of state argument is + unfortunate. In particular, encodings may be stateless. The naming + of the third parameter as stateT is unfortunate, as what is really + needed is some kind of generalized type that accounts for the + issues that abstract encodings will need. The minimum information + that is required includes: +

+In addition, multi-threaded and multi-locale environments also impact +the design and requirements for code conversions. In particular, they +affect the required specialization codecvt<wchar_t, char, mbstate_t> +when implemented using standard "C" functions. +

+Three problems arise, one big, one of medium importance, and one small. +

+First, the small: mcsrtombs and wcsrtombs may not be multithread-safe +on all systems required by the GNU tools. For GNU/Linux and glibc, +this is not an issue. +

+Of medium concern, in the grand scope of things, is that the functions +used to implement this specialization work on null-terminated +strings. Buffers, especially file buffers, may not be null-terminated, +thus giving conversions that end prematurely or are otherwise +incorrect. Yikes! +

+The last, and fundamental problem, is the assumption of a global +locale for all the "C" functions referenced above. For something like +C++ iostreams (where codecvt is explicitly used) the notion of +multiple locales is fundamental. In practice, most users may not run +into this limitation. However, as a quality of implementation issue, +the GNU C++ library would like to offer a solution that allows +multiple locales and or simultaneous usage with computationally +correct results. In short, libstdc++ is trying to offer, as an +option, a high-quality implementation, damn the additional complexity! +

+For the required specialization codecvt<wchar_t, char, mbstate_t> , +conversions are made between the internal character set (always UCS4 +on GNU/Linux) and whatever the currently selected locale for the +LC_CTYPE category implements. +

+The two required specializations are implemented as follows: +

+ +codecvt<char, char, mbstate_t> + +

+This is a degenerate (i.e., does nothing) specialization. Implementing +this was a piece of cake. +

+ +codecvt<char, wchar_t, mbstate_t> + +

+This specialization, by specifying all the template parameters, pretty +much ties the hands of implementors. As such, the implementation is +straightforward, involving mcsrtombs for the conversions between char +to wchar_t and wcsrtombs for conversions between wchar_t and char. +

+Neither of these two required specializations deals with Unicode +characters. As such, libstdc++ implements a partial specialization +of the codecvt class with and iconv wrapper class, encoding_state as the +third template parameter. +

+This implementation should be standards conformant. First of all, the +standard explicitly points out that instantiations on the third +template parameter, stateT, are the proper way to implement +non-required conversions. Second of all, the standard says (in Chapter +17) that partial specializations of required classes are a-ok. Third +of all, the requirements for the stateT type elsewhere in the standard +(see 21.1.2 traits typedefs) only indicate that this type be copy +constructible. +

+As such, the type encoding_state is defined as a non-templatized, POD +type to be used as the third type of a codecvt instantiation. This +type is just a wrapper class for iconv, and provides an easy interface +to iconv functionality. +

+There are two constructors for encoding_state: +

+ +encoding_state() : __in_desc(0), __out_desc(0) + +

+This default constructor sets the internal encoding to some default +(currently UCS4) and the external encoding to whatever is returned by +nl_langinfo(CODESET). +

+ +encoding_state(const char* __int, const char* __ext) + +

+This constructor takes as parameters string literals that indicate the +desired internal and external encoding. There are no defaults for +either argument. +

+One of the issues with iconv is that the string literals identifying +conversions are not standardized. Because of this, the thought of +mandating and or enforcing some set of pre-determined valid +identifiers seems iffy: thus, a more practical (and non-migraine +inducing) strategy was implemented: end-users can specify any string +(subject to a pre-determined length qualifier, currently 32 bytes) for +encodings. It is up to the user to make sure that these strings are +valid on the target system. +

+ +void +_M_init() + +

+Strangely enough, this member function attempts to open conversion +descriptors for a given encoding_state object. If the conversion +descriptors are not valid, the conversion descriptors returned will +not be valid and the resulting calls to the codecvt conversion +functions will return error. +

+ +bool +_M_good() + +

+Provides a way to see if the given encoding_state object has been +properly initialized. If the string literals describing the desired +internal and external encoding are not valid, initialization will +fail, and this will return false. If the internal and external +encodings are valid, but iconv_open could not allocate conversion +descriptors, this will also return false. Otherwise, the object is +ready to convert and will return true. +

+ +encoding_state(const encoding_state&) + +

+As iconv allocates memory and sets up conversion descriptors, the copy +constructor can only copy the member data pertaining to the internal +and external code conversions, and not the conversion descriptors +themselves. +

+Definitions for all the required codecvt member functions are provided +for this specialization, and usage of codecvt<internal character type, +external character type, encoding_state> is consistent with other +codecvt usage. +

+The std::messages facet implements message retrieval functionality +equivalent to Java's java.text.MessageFormat .using either GNU gettext +or IEEE 1003.1-200 functions. +

+The std::messages facet is probably the most vaguely defined facet in +the standard library. It's assumed that this facility was built into +the standard library in order to convert string literals from one +locale to the other. For instance, converting the "C" locale's +const char* c = "please" to a German-localized "bitte" +during program execution. +

+This class has three public member functions, which directly +correspond to three protected virtual member functions. +

+The public member functions are: +

+catalog open(const string&, const locale&) const +

+string_type get(catalog, int, int, const string_type&) const +

+void close(catalog) const +

+While the virtual functions are: +

+catalog do_open(const string&, const locale&) const +

+string_type do_get(catalog, int, int, const string_type&) const +

+void do_close(catalog) const +

+A couple of notes on the standard. +

+First, why is messages_base::catalog specified as a typedef +to int? This makes sense for implementations that use +catopen, but not for others. Fortunately, it's not heavily +used and so only a minor irritant. +

+Second, by making the member functions const, it is +impossible to save state in them. Thus, storing away information used +in the 'open' member function for use in 'get' is impossible. This is +unfortunate. +

+The 'open' member function in particular seems to be oddly +designed. The signature seems quite peculiar. Why specify a const +string& argument, for instance, instead of just const +char*? Or, why specify a const locale& argument that is +to be used in the 'get' member function? How, exactly, is this locale +argument useful? What was the intent? It might make sense if a locale +argument was associated with a given default message string in the +'open' member function, for instance. Quite murky and unclear, on +reflection. +

+Lastly, it seems odd that messages, which explicitly require code +conversion, don't use the codecvt facet. Because the messages facet +has only one template parameter, it is assumed that ctype, and not +codecvt, is to be used to convert between character sets. +

+It is implicitly assumed that the locale for the default message +string in 'get' is in the "C" locale. Thus, all source code is assumed +to be written in English, so translations are always from "en_US" to +other, explicitly named locales. +

+ This is a relatively simple class, on the face of it. The standard + specifies very little in concrete terms, so generic + implementations that are conforming yet do very little are the + norm. Adding functionality that would be useful to programmers and + comparable to Java's java.text.MessageFormat takes a bit of work, + and is highly dependent on the capabilities of the underlying + operating system. +

+ Three different mechanisms have been provided, selectable via + configure flags: +

+A new, standards-conformant non-virtual member function signature was +added for 'open' so that a directory could be specified with a given +message catalog. This simplifies calling conventions for the gnu +model. +

diff --git a/libstdc++-v3/doc/html/manual/fstreams.html b/libstdc++-v3/doc/html/manual/fstreams.html new file mode 100644 index 000000000..6c03a2bb6 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/fstreams.html @@ -0,0 +1,150 @@ + + +File Based Streams

+

So you want to copy a file quickly and easily, and most important, + completely portably. And since this is C++, you have an open + ifstream (call it IN) and an open ofstream (call it OUT): +

+   #include <fstream>
+
+   std::ifstream  IN ("input_file");
+   std::ofstream  OUT ("output_file"); 

Here's the easiest way to get it completely wrong: +

+   OUT << IN;

For those of you who don't already know why this doesn't work + (probably from having done it before), I invite you to quickly + create a simple text file called "input_file" containing + the sentence +

+      The quick brown fox jumped over the lazy dog.

surrounded by blank lines. Code it up and try it. The contents + of "output_file" may surprise you. +

Seriously, go do it. Get surprised, then come back. It's worth it. +

The thing to remember is that the basic_[io]stream classes + handle formatting, nothing else. In chaptericular, they break up on + whitespace. The actual reading, writing, and storing of data is + handled by the basic_streambuf family. Fortunately, the + operator<< is overloaded to take an ostream and + a pointer-to-streambuf, in order to help with just this kind of + "dump the data verbatim" situation. +

Why a pointer to streambuf and not just a streambuf? Well, + the [io]streams hold pointers (or references, depending on the + implementation) to their buffers, not the actual + buffers. This allows polymorphic behavior on the chapter of the buffers + as well as the streams themselves. The pointer is easily retrieved + using the rdbuf() member function. Therefore, the easiest + way to copy the file is: +

+   OUT << IN.rdbuf();

So what was happening with OUT<<IN? Undefined + behavior, since that chaptericular << isn't defined by the Standard. + I have seen instances where it is implemented, but the character + extraction process removes all the whitespace, leaving you with no + blank lines and only "Thequickbrownfox...". With + libraries that do not define that operator, IN (or one of IN's + member pointers) sometimes gets converted to a void*, and the output + file then contains a perfect text representation of a hexadecimal + address (quite a big surprise). Others don't compile at all. +

Also note that none of this is specific to o*f*streams. + The operators shown above are all defined in the parent + basic_ostream class and are therefore available with all possible + descendants. +

+

The first and most important thing to remember about binary I/O is + that opening a file with ios::binary is not, repeat + not, the only thing you have to do. It is not a silver + bullet, and will not allow you to use the <</>> + operators of the normal fstreams to do binary I/O. +

Sorry. Them's the breaks. +

This isn't going to try and be a complete tutorial on reading and + writing binary files (because "binary" + covers a lot of ground), but we will try and clear + up a couple of misconceptions and common errors. +

First, ios::binary has exactly one defined effect, no more + and no less. Normal text mode has to be concerned with the newline + characters, and the runtime system will translate between (for + example) '\n' and the appropriate end-of-line sequence (LF on Unix, + CRLF on DOS, CR on Macintosh, etc). (There are other things that + normal mode does, but that's the most obvious.) Opening a file in + binary mode disables this conversion, so reading a CRLF sequence + under Windows won't accidentally get mapped to a '\n' character, etc. + Binary mode is not supposed to suddenly give you a bitstream, and + if it is doing so in your program then you've discovered a bug in + your vendor's compiler (or some other chapter of the C++ implementation, + possibly the runtime system). +

Second, using << to write and >> to + read isn't going to work with the standard file stream classes, even + if you use skipws during reading. Why not? Because + ifstream and ofstream exist for the purpose of formatting, + not reading and writing. Their job is to interpret the data into + text characters, and that's exactly what you don't want to happen + during binary I/O. +

Third, using the get() and put()/write() member + functions still aren't guaranteed to help you. These are + "unformatted" I/O functions, but still character-based. + (This may or may not be what you want, see below.) +

Notice how all the problems here are due to the inappropriate use + of formatting functions and classes to perform something + which requires that formatting not be done? There are a + seemingly infinite number of solutions, and a few are listed here: +

How to go about using streambufs is a bit beyond the scope of this + document (at least for now), but while streambufs go a long way, + they still leave a couple of things up to you, the programmer. + As an example, byte ordering is completely between you and the + operating system, and you have to handle it yourself. +

Deriving a streambuf or filebuf + class from the standard ones, one that is specific to your data + types (or an abstraction thereof) is probably a good idea, and + lots of examples exist in journals and on Usenet. Using the + standard filebufs directly (either by declaring your own or by + using the pointer returned from an fstream's rdbuf()) + is certainly feasible as well. +

One area that causes problems is trying to do bit-by-bit operations + with filebufs. C++ is no different from C in this respect: I/O + must be done at the byte level. If you're trying to read or write + a few bits at a time, you're going about it the wrong way. You + must read/write an integral number of bytes and then process the + bytes. (For example, the streambuf functions take and return + variables of type int_type.) +

Another area of problems is opening text files in binary mode. + Generally, binary mode is intended for binary files, and opening + text files in binary mode means that you now have to deal with all of + those end-of-line and end-of-file problems that we mentioned before. +

+ An instructive thread from comp.lang.c++.moderated delved off into + this topic starting more or less at + this + post and continuing to the end of the thread. (The subject heading is "binary iostreams" on both comp.std.c++ + and comp.lang.c++.moderated.) Take special note of the replies by James Kanze and Dietmar Kühl. +

Briefly, the problems of byte ordering and type sizes mean that + the unformatted functions like ostream::put() and + istream::get() cannot safely be used to communicate + between arbitrary programs, or across a network, or from one + invocation of a program to another invocation of the same program + on a different platform, etc. +

diff --git a/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html b/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html new file mode 100644 index 000000000..043cbeb36 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/generalized_numeric_operations.html @@ -0,0 +1,32 @@ + + +Generalized Operations

+

There are four generalized functions in the <numeric> header + that follow the same conventions as those in <algorithm>. Each + of them is overloaded: one signature for common default operations, + and a second for fully general operations. Their names are + self-explanatory to anyone who works with numerics on a regular basis: +

Here is a simple example of the two forms of accumulate. +

+   int   ar[50];
+   int   someval = somefunction();
+
+   // ...initialize members of ar to something...
+
+   int  sum       = std::accumulate(ar,ar+50,0);
+   int  sum_stuff = std::accumulate(ar,ar+50,someval);
+   int  product   = std::accumulate(ar,ar+50,1,std::multiplies<int>());
+   

The first call adds all the members of the array, using zero as an + initial value for sum. The second does the same, but uses + someval as the starting value (thus, sum_stuff == sum + + someval). The final call uses the second of the two signatures, + and multiplies all the members of the array; here we must obviously + use 1 as a starting value instead of 0. +

The other three functions have similar dual-signature forms. +

diff --git a/libstdc++-v3/doc/html/manual/internals.html b/libstdc++-v3/doc/html/manual/internals.html new file mode 100644 index 000000000..c6531fb55 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/internals.html @@ -0,0 +1,371 @@ + + +Porting to New Hardware or Operating Systems

+

This document explains how to port libstdc++ (the GNU C++ library) to +a new target. +

In order to make the GNU C++ library (libstdc++) work with a new +target, you must edit some configuration files and provide some new +header files. Unless this is done, libstdc++ will use generic +settings which may not be correct for your target; even if they are +correct, they will likely be inefficient. +

Before you get started, make sure that you have a working C library on +your target. The C library need not precisely comply with any +particular standard, but should generally conform to the requirements +imposed by the ANSI/ISO standard. +

In addition, you should try to verify that the C++ compiler generally +works. It is difficult to test the C++ compiler without a working +library, but you should at least try some minimal test cases. +

(Note that what we think of as a "target," the library refers to as +a "host." The comment at the top of configure.ac explains why.) +

If you are porting to a new operating system (as opposed to a new chip +using an existing operating system), you will need to create a new +directory in the config/os hierarchy. For example, the IRIX +configuration files are all in config/os/irix. There is no set +way to organize the OS configuration directory. For example, +config/os/solaris/solaris-2.6 and +config/os/solaris/solaris-2.7 are used as configuration +directories for these two versions of Solaris. On the other hand, both +Solaris 2.7 and Solaris 2.8 use the config/os/solaris/solaris-2.7 +directory. The important information is that there needs to be a +directory under config/os to store the files for your operating +system. +

You might have to change the configure.host file to ensure that +your new directory is activated. Look for the switch statement that sets +os_include_dir, and add a pattern to handle your operating system +if the default will not suffice. The switch statement switches on only +the OS portion of the standard target triplet; e.g., the solaris2.8 +in sparc-sun-solaris2.8. If the new directory is named after the +OS portion of the triplet (the default), then nothing needs to be changed. +

The first file to create in this directory, should be called +os_defines.h. This file contains basic macro definitions +that are required to allow the C++ library to work with your C library. +

Several libstdc++ source files unconditionally define the macro +_POSIX_SOURCE. On many systems, defining this macro causes +large portions of the C library header files to be eliminated +at preprocessing time. Therefore, you may have to #undef this +macro, or define other macros (like _LARGEFILE_SOURCE or +__EXTENSIONS__). You won't know what macros to define or +undefine at this point; you'll have to try compiling the library and +seeing what goes wrong. If you see errors about calling functions +that have not been declared, look in your C library headers to see if +the functions are declared there, and then figure out what macros you +need to define. You will need to add them to the +CPLUSPLUS_CPP_SPEC macro in the GCC configuration file for your +target. It will not work to simply define these macros in +os_defines.h. +

At this time, there are a few libstdc++-specific macros which may be +defined: +

_GLIBCXX_USE_C99_CHECK may be defined to 1 to check C99 +function declarations (which are not covered by specialization below) +found in system headers against versions found in the library headers +derived from the standard. +

_GLIBCXX_USE_C99_DYNAMIC may be defined to an expression that +yields 0 if and only if the system headers are exposing proper support +for C99 functions (which are not covered by specialization below). If +defined, it must be 0 while bootstrapping the compiler/rebuilding the +library. +

_GLIBCXX_USE_C99_LONG_LONG_CHECK may be defined to 1 to check +the set of C99 long long function declarations found in system headers +against versions found in the library headers derived from the +standard. + +

_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC may be defined to an +expression that yields 0 if and only if the system headers are +exposing proper support for the set of C99 long long functions. If +defined, it must be 0 while bootstrapping the compiler/rebuilding the +library. +

_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC may be defined to an +expression that yields 0 if and only if the system headers +are exposing proper support for the related set of macros. If defined, +it must be 0 while bootstrapping the compiler/rebuilding the library. +

_GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK may be defined +to 1 to check the related set of function declarations found in system +headers against versions found in the library headers derived from +the standard. +

_GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC may be defined +to an expression that yields 0 if and only if the system headers +are exposing proper support for the related set of functions. If defined, +it must be 0 while bootstrapping the compiler/rebuilding the library. +

Finally, you should bracket the entire file in an include-guard, like +this: +

+
+#ifndef _GLIBCXX_OS_DEFINES
+#define _GLIBCXX_OS_DEFINES
+...
+#endif
+

We recommend copying an existing os_defines.h to use as a +starting point. +

If you are porting to a new chip (as opposed to a new operating system +running on an existing chip), you will need to create a new directory in the +config/cpu hierarchy. Much like the Operating system setup, +there are no strict rules on how to organize the CPU configuration +directory, but careful naming choices will allow the configury to find your +setup files without explicit help. +

We recommend that for a target triplet <CPU>-<vendor>-<OS>, you +name your configuration directory config/cpu/<CPU>. If you do this, +the configury will find the directory by itself. Otherwise you will need to +edit the configure.host file and, in the switch statement that sets +cpu_include_dir, add a pattern to handle your chip. +

Note that some chip families share a single configuration directory, for +example, alpha, alphaev5, and alphaev6 all use the +config/cpu/alpha directory, and there is an entry in the +configure.host switch statement to handle this. +

The cpu_include_dir sets default locations for the files controlling +Thread safety and Numeric limits, if the defaults are not +appropriate for your chip. +

The library requires that you provide three header files to implement +character classification, analogous to that provided by the C libraries +<ctype.h> header. You can model these on the files provided in +config/os/generic. However, these files will almost +certainly need some modification. +

The first file to write is ctype_base.h. This file provides +some very basic information about character classification. The libstdc++ +library assumes that your C library implements <ctype.h> by using +a table (indexed by character code) containing integers, where each of +these integers is a bit-mask indicating whether the character is +upper-case, lower-case, alphabetic, etc. The ctype_base.h +file gives the type of the integer, and the values of the various bit +masks. You will have to peer at your own <ctype.h> to figure out +how to define the values required by this file. +

The ctype_base.h header file does not need include guards. +It should contain a single struct definition called +ctype_base. This struct should contain two type +declarations, and one enumeration declaration, like this example, taken +from the IRIX configuration: +

+  struct ctype_base
+     {
+       typedef unsigned int 	mask;
+       typedef int* 		__to_type;
+
+       enum
+       {
+	 space = _ISspace,
+	 print = _ISprint,
+	 cntrl = _IScntrl,
+	 upper = _ISupper,
+	 lower = _ISlower,
+	 alpha = _ISalpha,
+	 digit = _ISdigit,
+	 punct = _ISpunct,
+	 xdigit = _ISxdigit,
+	 alnum = _ISalnum,
+	 graph = _ISgraph
+       };
+     };
+

The mask type is the type of the elements in the table. If your +C library uses a table to map lower-case numbers to upper-case numbers, +and vice versa, you should define __to_type to be the type of the +elements in that table. If you don't mind taking a minor performance +penalty, or if your library doesn't implement toupper and +tolower in this way, you can pick any pointer-to-integer type, +but you must still define the type. +

The enumeration should give definitions for all the values in the above +example, using the values from your native <ctype.h>. They can +be given symbolically (as above), or numerically, if you prefer. You do +not have to include <ctype.h> in this header; it will always be +included before ctype_base.h is included. +

The next file to write is ctype_noninline.h, which also does +not require include guards. This file defines a few member functions +that will be included in include/bits/locale_facets.h. The first +function that must be written is the ctype<char>::ctype +constructor. Here is the IRIX example: +

+ctype<char>::ctype(const mask* __table = 0, bool __del = false,
+	   size_t __refs = 0)
+       : _Ctype_nois<char>(__refs), _M_del(__table != 0 && __del),
+	 _M_toupper(NULL),
+	 _M_tolower(NULL),
+	 _M_ctable(NULL),
+	 _M_table(!__table
+		  ? (const mask*) (__libc_attr._ctype_tbl->_class + 1)
+		  : __table)
+       { }
+

There are two parts of this that you might choose to alter. The first, +and most important, is the line involving __libc_attr. That is +IRIX system-dependent code that gets the base of the table mapping +character codes to attributes. You need to substitute code that obtains +the address of this table on your system. If you want to use your +operating system's tables to map upper-case letters to lower-case, and +vice versa, you should initialize _M_toupper and +_M_tolower with those tables, in similar fashion. +

Now, you have to write two functions to convert from upper-case to +lower-case, and vice versa. Here are the IRIX versions: +

+     char
+     ctype<char>::do_toupper(char __c) const
+     { return _toupper(__c); }
+
+     char
+     ctype<char>::do_tolower(char __c) const
+     { return _tolower(__c); }
+

Your C library provides equivalents to IRIX's _toupper and +_tolower. If you initialized _M_toupper and +_M_tolower above, then you could use those tables instead. +

Finally, you have to provide two utility functions that convert strings +of characters. The versions provided here will always work - but you +could use specialized routines for greater performance if you have +machinery to do that on your system: +

+     const char*
+     ctype<char>::do_toupper(char* __low, const char* __high) const
+     {
+       while (__low < __high)
+	 {
+	   *__low = do_toupper(*__low);
+	   ++__low;
+	 }
+       return __high;
+     }
+
+     const char*
+     ctype<char>::do_tolower(char* __low, const char* __high) const
+     {
+       while (__low < __high)
+	 {
+	   *__low = do_tolower(*__low);
+	   ++__low;
+	 }
+       return __high;
+     }
+

You must also provide the ctype_inline.h file, which +contains a few more functions. On most systems, you can just copy +config/os/generic/ctype_inline.h and use it on your system. +

In detail, the functions provided test characters for particular +properties; they are analogous to the functions like isalpha and +islower provided by the C library. +

The first function is implemented like this on IRIX: +

+     bool
+     ctype<char>::
+     is(mask __m, char __c) const throw()
+     { return (_M_table)[(unsigned char)(__c)] & __m; }
+

The _M_table is the table passed in above, in the constructor. +This is the table that contains the bitmasks for each character. The +implementation here should work on all systems. +

The next function is: +

+     const char*
+     ctype<char>::
+     is(const char* __low, const char* __high, mask* __vec) const throw()
+     {
+       while (__low < __high)
+	 *__vec++ = (_M_table)[(unsigned char)(*__low++)];
+       return __high;
+     }
+

This function is similar; it copies the masks for all the characters +from __low up until __high into the vector given by +__vec. +

The last two functions again are entirely generic: +

+     const char*
+     ctype<char>::
+     scan_is(mask __m, const char* __low, const char* __high) const throw()
+     {
+       while (__low < __high && !this->is(__m, *__low))
+	 ++__low;
+       return __low;
+     }
+
+     const char*
+     ctype<char>::
+     scan_not(mask __m, const char* __low, const char* __high) const throw()
+     {
+       while (__low < __high && this->is(__m, *__low))
+	 ++__low;
+       return __low;
+     }
+

The C++ library string functionality requires a couple of atomic +operations to provide thread-safety. If you don't take any special +action, the library will use stub versions of these functions that are +not thread-safe. They will work fine, unless your applications are +multi-threaded. +

If you want to provide custom, safe, versions of these functions, there +are two distinct approaches. One is to provide a version for your CPU, +using assembly language constructs. The other is to use the +thread-safety primitives in your operating system. In either case, you +make a file called atomicity.h, and the variable +ATOMICITYH must point to this file. +

If you are using the assembly-language approach, put this code in +config/cpu/<chip>/atomicity.h, where chip is the name of +your processor (see CPU). No additional changes are necessary to +locate the file in this case; ATOMICITYH will be set by default. +

If you are using the operating system thread-safety primitives approach, +you can also put this code in the same CPU directory, in which case no more +work is needed to locate the file. For examples of this approach, +see the atomicity.h file for IRIX or IA64. +

Alternatively, if the primitives are more closely related to the OS +than they are to the CPU, you can put the atomicity.h file in +the Operating system directory instead. In this case, you must +edit configure.host, and in the switch statement that handles +operating systems, override the ATOMICITYH variable to point to +the appropriate os_include_dir. For examples of this approach, +see the atomicity.h file for AIX. +

With those bits out of the way, you have to actually write +atomicity.h itself. This file should be wrapped in an +include guard named _GLIBCXX_ATOMICITY_H. It should define one +type, and two functions. +

The type is _Atomic_word. Here is the version used on IRIX: +

+typedef long _Atomic_word;
+

This type must be a signed integral type supporting atomic operations. +If you're using the OS approach, use the same type used by your system's +primitives. Otherwise, use the type for which your CPU provides atomic +primitives. +

Then, you must provide two functions. The bodies of these functions +must be equivalent to those provided here, but using atomic operations: +

+     static inline _Atomic_word
+     __attribute__ ((__unused__))
+     __exchange_and_add (_Atomic_word* __mem, int __val)
+     {
+       _Atomic_word __result = *__mem;
+       *__mem += __val;
+       return __result;
+     }
+
+     static inline void
+     __attribute__ ((__unused__))
+     __atomic_add (_Atomic_word* __mem, int __val)
+     {
+       *__mem += __val;
+     }
+
diff --git a/libstdc++-v3/doc/html/manual/intro.html b/libstdc++-v3/doc/html/manual/intro.html new file mode 100644 index 000000000..d283df00a --- /dev/null +++ b/libstdc++-v3/doc/html/manual/intro.html @@ -0,0 +1,9 @@ + + +Part I.  Introduction
diff --git a/libstdc++-v3/doc/html/manual/io.html b/libstdc++-v3/doc/html/manual/io.html new file mode 100644 index 000000000..01ef0ff23 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/io.html @@ -0,0 +1,121 @@ + + +Chapter 13.  Input and Output

To minimize the time you have to wait on the compiler, it's good to + only include the headers you really need. Many people simply include + <iostream> when they don't need to -- and that can penalize + your runtime as well. Here are some tips on which header to use + for which situations, starting with the simplest. +

<iosfwd> should be included whenever you simply + need the name of an I/O-related class, such as + "ofstream" or "basic_streambuf". Like the name + implies, these are forward declarations. (A word to all you fellow + old school programmers: trying to forward declare classes like + "class istream;" won't work. Look in the iosfwd header if + you'd like to know why.) For example, +

+    #include <iosfwd>
+
+    class MyClass
+    {
+	....
+	std::ifstream&   input_file;
+    };
+
+    extern std::ostream& operator<< (std::ostream&, MyClass&);
+   

<ios> declares the base classes for the entire + I/O stream hierarchy, std::ios_base and std::basic_ios<charT>, the + counting types std::streamoff and std::streamsize, the file + positioning type std::fpos, and the various manipulators like + std::hex, std::fixed, std::noshowbase, and so forth. +

The ios_base class is what holds the format flags, the state flags, + and the functions which change them (setf(), width(), precision(), + etc). You can also store extra data and register callback functions + through ios_base, but that has been historically underused. Anything + which doesn't depend on the type of characters stored is consolidated + here. +

The template class basic_ios is the highest template class in the + hierarchy; it is the first one depending on the character type, and + holds all general state associated with that type: the pointer to the + polymorphic stream buffer, the facet information, etc. +

<streambuf> declares the template class + basic_streambuf, and two standard instantiations, streambuf and + wstreambuf. If you need to work with the vastly useful and capable + stream buffer classes, e.g., to create a new form of storage + transport, this header is the one to include. +

<istream>/<ostream> are + the headers to include when you are using the >>/<< + interface, or any of the other abstract stream formatting functions. + For example, +

+    #include <istream>
+
+    std::ostream& operator<< (std::ostream& os, MyClass& c)
+    {
+       return os << c.data1() << c.data2();
+    }
+   

The std::istream and std::ostream classes are the abstract parents of + the various concrete implementations. If you are only using the + interfaces, then you only need to use the appropriate interface header. +

<iomanip> provides "extractors and inserters + that alter information maintained by class ios_base and its derived + classes," such as std::setprecision and std::setw. If you need + to write expressions like os << setw(3); or + is >> setbase(8);, you must include <iomanip>. +

<sstream>/<fstream> + declare the six stringstream and fstream classes. As they are the + standard concrete descendants of istream and ostream, you will already + know about them. +

Finally, <iostream> provides the eight standard + global objects (cin, cout, etc). To do this correctly, this header + also provides the contents of the <istream> and <ostream> + headers, but nothing else. The contents of this header look like +

+    #include <ostream>
+    #include <istream>
+
+    namespace std
+    {
+	extern istream cin;
+	extern ostream cout;
+	....
+
+	// this is explained below
+	static ios_base::Init __foo;    // not its real name
+    }
+   

Now, the runtime penalty mentioned previously: the global objects + must be initialized before any of your own code uses them; this is + guaranteed by the standard. Like any other global object, they must + be initialized once and only once. This is typically done with a + construct like the one above, and the nested class ios_base::Init is + specified in the standard for just this reason. +

How does it work? Because the header is included before any of your + code, the __foo object is constructed before any of + your objects. (Global objects are built in the order in which they + are declared, and destroyed in reverse order.) The first time the + constructor runs, the eight stream objects are set up. +

The static keyword means that each object file compiled + from a source file containing <iostream> will have its own + private copy of __foo. There is no specified order + of construction across object files (it's one of those pesky NP + problems that make life so interesting), so one copy in each object + file means that the stream objects are guaranteed to be set up before + any of your code which uses them could run, thereby meeting the + requirements of the standard. +

The penalty, of course, is that after the first copy of + __foo is constructed, all the others are just wasted + processor time. The time spent is merely for an increment-and-test + inside a function call, but over several dozen or hundreds of object + files, that time can add up. (It's not in a tight loop, either.) +

The lesson? Only include <iostream> when you need to use one of + the standard objects in that source file; you'll pay less startup + time. Only include the header files you need to in general; your + compile times will go down when there's less parsing work to do. +

diff --git a/libstdc++-v3/doc/html/manual/io_and_c.html b/libstdc++-v3/doc/html/manual/io_and_c.html new file mode 100644 index 000000000..6b4066154 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/io_and_c.html @@ -0,0 +1,57 @@ + + +Interacting with C

+ See the extensions for using + FILE and file descriptors with + ofstream and + ifstream. +

+ Pathetic Performance? Ditch C. +

It sounds like a flame on C, but it isn't. Really. Calm down. + I'm just saying it to get your attention. +

Because the C++ library includes the C library, both C-style and + C++-style I/O have to work at the same time. For example: +

+     #include <iostream>
+     #include <cstdio>
+
+     std::cout << "Hel";
+     std::printf ("lo, worl");
+     std::cout << "d!\n";
+   

This must do what you think it does. +

Alert members of the audience will immediately notice that buffering + is going to make a hash of the output unless special steps are taken. +

The special steps taken by libstdc++, at least for version 3.0, + involve doing very little buffering for the standard streams, leaving + most of the buffering to the underlying C library. (This kind of + thing is tricky to get right.) + The upside is that correctness is ensured. The downside is that + writing through cout can quite easily lead to awful + performance when the C++ I/O library is layered on top of the C I/O + library (as it is for 3.0 by default). Some patches have been applied + which improve the situation for 3.1. +

However, the C and C++ standard streams only need to be kept in sync + when both libraries' facilities are in use. If your program only uses + C++ I/O, then there's no need to sync with the C streams. The right + thing to do in this case is to call +

+     #include any of the I/O headers such as ios, iostream, etc
+
+     std::ios::sync_with_stdio(false);
+   

You must do this before performing any I/O via the C++ stream objects. + Once you call this, the C++ streams will operate independently of the + (unused) C streams. For GCC 3.x, this means that cout and + company will become fully buffered on their own. +

Note, by the way, that the synchronization requirement only applies to + the standard streams (cin, cout, + cerr, + clog, and their wide-character counterchapters). File stream + objects that you declare yourself have no such requirement and are fully + buffered. +

diff --git a/libstdc++-v3/doc/html/manual/iterators.html b/libstdc++-v3/doc/html/manual/iterators.html new file mode 100644 index 000000000..8a44178b7 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/iterators.html @@ -0,0 +1,130 @@ + + +Chapter 10.  Iterators

+ The following +FAQ entry points out that +iterators are not implemented as pointers. They are a generalization +of pointers, but they are implemented in libstdc++ as separate +classes. +

+ Keeping that simple fact in mind as you design your code will + prevent a whole lot of difficult-to-understand bugs. +

+ You can think of it the other way 'round, even. Since iterators + are a generalization, that means + that pointers are + iterators, and that pointers can be used + whenever an iterator would be. All those functions in the + Algorithms sect1 of the Standard will work just as well on plain + arrays and their pointers. +

+ That doesn't mean that when you pass in a pointer, it gets + wrapped into some special delegating iterator-to-pointer class + with a layer of overhead. (If you think that's the case + anywhere, you don't understand templates to begin with...) Oh, + no; if you pass in a pointer, then the compiler will instantiate + that template using T* as a type, and good old high-speed + pointer arithmetic as its operations, so the resulting code will + be doing exactly the same things as it would be doing if you had + hand-coded it yourself (for the 273rd time). +

+ How much overhead is there when using an + iterator class? Very little. Most of the layering classes + contain nothing but typedefs, and typedefs are + "meta-information" that simply tell the compiler some + nicknames; they don't create code. That information gets passed + down through inheritance, so while the compiler has to do work + looking up all the names, your runtime code does not. (This has + been a prime concern from the beginning.) +

This starts off sounding complicated, but is actually very easy, + especially towards the end. Trust me. +

Beginners usually have a little trouble understand the whole + 'past-the-end' thing, until they remember their early algebra classes + (see, they told you that stuff would come in handy!) and + the concept of half-open ranges. +

First, some history, and a reminder of some of the funkier rules in + C and C++ for builtin arrays. The following rules have always been + true for both languages: +

The reason this past-the-end addressing was allowed is to make it + easy to write a loop to go over an entire array, e.g., + while (*d++ = *s++);. +

So, when you think of two pointers delimiting an array, don't think + of them as indexing 0 through n-1. Think of them as boundary + markers: +

+
+   beginning            end
+     |                   |
+     |                   |               This is bad.  Always having to
+     |                   |               remember to add or subtract one.
+     |                   |               Off-by-one bugs very common here.
+     V                   V
+	array of N elements
+     |---|---|--...--|---|---|
+     | 0 | 1 |  ...  |N-2|N-1|
+     |---|---|--...--|---|---|
+
+     ^                       ^
+     |                       |
+     |                       |           This is good.  This is safe.  This
+     |                       |           is guaranteed to work.  Just don't
+     |                       |           dereference 'end'.
+   beginning                end
+
+   

See? Everything between the boundary markers is chapter of the array. + Simple. +

Now think back to your junior-high school algebra course, when you + were learning how to draw graphs. Remember that a graph terminating + with a solid dot meant, "Everything up through this point," + and a graph terminating with an open dot meant, "Everything up + to, but not including, this point," respectively called closed + and open ranges? Remember how closed ranges were written with + brackets, [a,b], and open ranges were written with parentheses, + (a,b)? +

The boundary markers for arrays describe a half-open range, + starting with (and including) the first element, and ending with (but + not including) the last element: [beginning,end). See, I + told you it would be simple in the end. +

Iterators, and everything working with iterators, follows this same + time-honored tradition. A container's begin() method returns + an iterator referring to the first element, and its end() + method returns a past-the-end iterator, which is guaranteed to be + unique and comparable against any other iterator pointing into the + middle of the container. +

Container constructors, container methods, and algorithms, all take + pairs of iterators describing a range of values on which to operate. + All of these ranges are half-open ranges, so you pass the beginning + iterator as the starting parameter, and the one-past-the-end iterator + as the finishing parameter. +

This generalizes very well. You can operate on sub-ranges quite + easily this way; functions accepting a [first,last) range + don't know or care whether they are the boundaries of an entire {array, + sequence, container, whatever}, or whether they only enclose a few + elements from the center. This approach also makes zero-length + sequences very simple to recognize: if the two endpoints compare + equal, then the {array, sequence, container, whatever} is empty. +

Just don't dereference end(). +

diff --git a/libstdc++-v3/doc/html/manual/license.html b/libstdc++-v3/doc/html/manual/license.html new file mode 100644 index 000000000..da021a9fe --- /dev/null +++ b/libstdc++-v3/doc/html/manual/license.html @@ -0,0 +1,105 @@ + + +License

+ There are two licenses affecting GNU libstdc++: one for the code, + and one for the documentation. +

+ There is a license section in the FAQ regarding common questions. If you have more + questions, ask the FSF or the gcc mailing list. +

+ The source code is distributed under the GNU General Public License version 3, + with the addition under section 7 of an exception described in + the GCC Runtime Library Exception, version 3.1 + as follows (or see the file COPYING.RUNTIME): +


+GCC RUNTIME LIBRARY EXCEPTION
+
+Version 3.1, 31 March 2009
+
+Copyright (C) 2009 Free Software Foundation, Inc.
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+This GCC Runtime Library Exception ("Exception") is an additional
+permission under section 7 of the GNU General Public License, version
+3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
+bears a notice placed by the copyright holder of the file stating that
+the file is governed by GPLv3 along with this Exception.
+
+When you use GCC to compile a program, GCC may combine portions of
+certain GCC header files and runtime libraries with the compiled
+program. The purpose of this Exception is to allow compilation of
+non-GPL (including proprietary) programs to use, in this way, the
+header files and runtime libraries covered by this Exception.
+
+0. Definitions.
+
+A file is an "Independent Module" if it either requires the Runtime
+Library for execution after a Compilation Process, or makes use of an
+interface provided by the Runtime Library, but is not otherwise based
+on the Runtime Library.
+
+"GCC" means a version of the GNU Compiler Collection, with or without
+modifications, governed by version 3 (or a specified later version) of
+the GNU General Public License (GPL) with the option of using any
+subsequent versions published by the FSF.
+
+"GPL-compatible Software" is software whose conditions of propagation,
+modification and use would permit combination with GCC in accord with
+the license of GCC.
+
+"Target Code" refers to output from any compiler for a real or virtual
+target processor architecture, in executable form or suitable for
+input to an assembler, loader, linker and/or execution
+phase. Notwithstanding that, Target Code does not include data in any
+format that is used as a compiler intermediate representation, or used
+for producing a compiler intermediate representation.
+
+The "Compilation Process" transforms code entirely represented in
+non-intermediate languages designed for human-written code, and/or in
+Java Virtual Machine byte code, into Target Code. Thus, for example,
+use of source code generators and preprocessors need not be considered
+part of the Compilation Process, since the Compilation Process can be
+understood as starting with the output of the generators or
+preprocessors.
+
+A Compilation Process is "Eligible" if it is done using GCC, alone or
+with other GPL-compatible software, or if it is done without using any
+work based on GCC. For example, using non-GPL-compatible Software to
+optimize any GCC intermediate representations would not qualify as an
+Eligible Compilation Process.
+
+1. Grant of Additional Permission.
+
+You have permission to propagate a work of Target Code formed by
+combining the Runtime Library with Independent Modules, even if such
+propagation would otherwise violate the terms of GPLv3, provided that
+all Target Code was generated by Eligible Compilation Processes. You
+may then convey such a combination under terms of your choice,
+consistent with the licensing of the Independent Modules.
+
+2. No Weakening of GCC Copyleft.
+
+The availability of this Exception does not imply any general
+presumption that third-party software is unaffected by the copyleft
+requirements of the license of GCC.
+    

+ Hopefully that text is self-explanatory. If it isn't, you need to speak + to your lawyer, or the Free Software Foundation. +

+ The documentation shipped with the library and made available over + the web, excluding the pages generated from source comments, are + copyrighted by the Free Software Foundation, and placed under the + GNU Free Documentation + License version 1.3. There are no Front-Cover Texts, no + Back-Cover Texts, and no Invariant Sections. +

+ For documentation generated by doxygen or other automated tools + via processing source code comments and markup, the original source + code license applies to the generated files. Thus, the doxygen + documents are licensed GPL. +

+ If you plan on making copies of the documentation, please let us know. + We can probably offer suggestions. +

diff --git a/libstdc++-v3/doc/html/manual/localization.html b/libstdc++-v3/doc/html/manual/localization.html new file mode 100644 index 000000000..6947a018e --- /dev/null +++ b/libstdc++-v3/doc/html/manual/localization.html @@ -0,0 +1,436 @@ + + +Chapter 8.  Localization

+Describes the basic locale object, including nested +classes id, facet, and the reference-counted implementation object, +class _Impl. +

+From Josuttis, p. 697-698, which says, that "there is only *one* +relation (of the C++ locale mechanism) to the C locale mechanism: the +global C locale is modified if a named C++ locale object is set as the +global locale" (emphasis Paolo), that is: +

std::locale::global(std::locale(""));

affects the C functions as if the following call was made:

std::setlocale(LC_ALL, "");

+ On the other hand, there is *no* vice versa, that is, calling + setlocale has *no* whatsoever on the C++ locale mechanism, in + particular on the working of locale(""), which constructs the locale + object from the environment of the running program, that is, in + practice, the set of LC_ALL, LANG, etc. variable of the shell. +

diff --git a/libstdc++-v3/doc/html/manual/make.html b/libstdc++-v3/doc/html/manual/make.html new file mode 100644 index 000000000..62b149924 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/make.html @@ -0,0 +1,9 @@ + + +Make

If you have never done this before, you should read the basic + GCC Installation + Instructions first. Read all of them. + Twice. +

Then type: make, and congratulations, you've +started to build. +

diff --git a/libstdc++-v3/doc/html/manual/memory.html b/libstdc++-v3/doc/html/manual/memory.html new file mode 100644 index 000000000..5953539dc --- /dev/null +++ b/libstdc++-v3/doc/html/manual/memory.html @@ -0,0 +1,699 @@ + + +Memory

+ Memory contains three general areas. First, function and operator + calls via new and delete + operator or member function calls. Second, allocation via + allocator. And finally, smart pointer and + intelligent pointer abstractions. +

+ Memory management for Standard Library entities is encapsulated in a + class template called allocator. The + allocator abstraction is used throughout the + library in string, container classes, + algorithms, and parts of iostreams. This class, and base classes of + it, are the superset of available free store (heap) + management classes. +

+ The easiest way of fulfilling the requirements is to call + operator new each time a container needs + memory, and to call operator delete each time + the container releases memory. This method may be slower + than caching the allocations and re-using previously-allocated + memory, but has the advantage of working correctly across a wide + variety of hardware and operating systems, including large + clusters. The __gnu_cxx::new_allocator + implements the simple operator new and operator delete semantics, + while __gnu_cxx::malloc_allocator + implements much the same thing, only with the C language functions + std::malloc and free. +

+ Another approach is to use intelligence within the allocator + class to cache allocations. This extra machinery can take a variety + of forms: a bitmap index, an index into an exponentially increasing + power-of-two-sized buckets, or simpler fixed-size pooling cache. + The cache is shared among all the containers in the program: when + your program's std::vector<int> gets + cut in half and frees a bunch of its storage, that memory can be + reused by the private + std::list<WonkyWidget> brought in from + a KDE library that you linked against. And operators + new and delete are not + always called to pass the memory on, either, which is a speed + bonus. Examples of allocators that use these techniques are + __gnu_cxx::bitmap_allocator, + __gnu_cxx::pool_allocator, and + __gnu_cxx::__mt_alloc. +

+ Depending on the implementation techniques used, the underlying + operating system, and compilation environment, scaling caching + allocators can be tricky. In particular, order-of-destruction and + order-of-creation for memory pools may be difficult to pin down + with certainty, which may create problems when used with plugins + or loading and unloading shared objects in memory. As such, using + caching allocators on systems that do not support + abi::__cxa_atexit is not recommended. +

+ It's difficult to pick an allocation strategy that will provide + maximum utility, without excessively penalizing some behavior. In + fact, it's difficult just deciding which typical actions to measure + for speed. +

+ Three synthetic benchmarks have been created that provide data + that is used to compare different C++ allocators. These tests are: +

  1. + Insertion. +

    + Over multiple iterations, various STL container + objects have elements inserted to some maximum amount. A variety + of allocators are tested. + Test source for sequence + and associative + containers. +

  2. + Insertion and erasure in a multi-threaded environment. +

    + This test shows the ability of the allocator to reclaim memory + on a per-thread basis, as well as measuring thread contention + for memory resources. + Test source + here. +

  3. + A threaded producer/consumer model. +

    + Test source for + sequence + and + associative + containers. +

+ The current default choice for + allocator is + __gnu_cxx::new_allocator. +

+ In use, allocator may allocate and + deallocate using implementation-specified strategies and + heuristics. Because of this, every call to an allocator object's + allocate member function may not actually + call the global operator new. This situation is also duplicated + for calls to the deallocate member + function. +

+ This can be confusing. +

+ In particular, this can make debugging memory errors more + difficult, especially when using third party tools like valgrind or + debug versions of new. +

+ There are various ways to solve this problem. One would be to use + a custom allocator that just called operators + new and delete + directly, for every allocation. (See + include/ext/new_allocator.h, for instance.) + However, that option would involve changing source code to use + a non-default allocator. Another option is to force the + default allocator to remove caching and pools, and to directly + allocate with every call of allocate and + directly deallocate with every call of + deallocate, regardless of efficiency. As it + turns out, this last option is also available. +

+ To globally disable memory caching within the library for the + default allocator, merely set + GLIBCXX_FORCE_NEW (with any value) in the + system's environment before running the program. If your program + crashes with GLIBCXX_FORCE_NEW in the + environment, it likely means that you linked against objects + built against the older library (objects which might still using the + cached allocations...). +

+ Several other allocators are provided as part of this + implementation. The location of the extension allocators and their + names have changed, but in all cases, functionality is + equivalent. Starting with gcc-3.4, all extension allocators are + standard style. Before this point, SGI style was the norm. Because of + this, the number of template arguments also changed. Here's a simple + chart to track the changes. +

+ More details on each of these extension allocators follows. +

  1. + new_allocator +

    + Simply wraps ::operator new + and ::operator delete. +

  2. + malloc_allocator +

    + Simply wraps malloc and + free. There is also a hook for an + out-of-memory handler (for + new/delete this is + taken care of elsewhere). +

  3. + array_allocator +

    + Allows allocations of known and fixed sizes using existing + global or external storage allocated via construction of + std::tr1::array objects. By using this + allocator, fixed size containers (including + std::string) can be used without + instances calling ::operator new and + ::operator delete. This capability + allows the use of STL abstractions without runtime + complications or overhead, even in situations such as program + startup. For usage examples, please consult the testsuite. +

  4. + debug_allocator +

    + A wrapper around an arbitrary allocator A. It passes on + slightly increased size requests to A, and uses the extra + memory to store size information. When a pointer is passed + to deallocate(), the stored size is + checked, and assert() is used to + guarantee they match. +

  5. + throw_allocator +

    + Includes memory tracking and marking abilities as well as hooks for + throwing exceptions at configurable intervals (including random, + all, none). +

  6. + __pool_alloc +

    + A high-performance, single pool allocator. The reusable + memory is shared among identical instantiations of this type. + It calls through ::operator new to + obtain new memory when its lists run out. If a client + container requests a block larger than a certain threshold + size, then the pool is bypassed, and the allocate/deallocate + request is passed to ::operator new + directly. +

    + Older versions of this class take a boolean template + parameter, called thr, and an integer template + parameter, called inst. +

    + The inst number is used to track additional memory + pools. The point of the number is to allow multiple + instantiations of the classes without changing the semantics at + all. All three of +

    +    typedef  __pool_alloc<true,0>    normal;
    +    typedef  __pool_alloc<true,1>    private;
    +    typedef  __pool_alloc<true,42>   also_private;
    +   

    + behave exactly the same way. However, the memory pool for each type + (and remember that different instantiations result in different types) + remains separate. +

    + The library uses 0 in all its instantiations. If you + wish to keep separate free lists for a particular purpose, use a + different number. +

    The thr boolean determines whether the + pool should be manipulated atomically or not. When + thr = true, the allocator + is thread-safe, while thr = + false, is slightly faster but unsafe for + multiple threads. +

    + For thread-enabled configurations, the pool is locked with a + single big lock. In some situations, this implementation detail + may result in severe performance degradation. +

    + (Note that the GCC thread abstraction layer allows us to provide + safe zero-overhead stubs for the threading routines, if threads + were disabled at configuration time.) +

  7. + __mt_alloc +

    + A high-performance fixed-size allocator with + exponentially-increasing allocations. It has its own + documentation, found here. +

  8. + bitmap_allocator +

    + A high-performance allocator that uses a bit-map to keep track + of the used and unused memory locations. It has its own + documentation, found here. +

Explaining all of the fun and delicious things that can + happen with misuse of the auto_ptr class + template (called AP here) would take some + time. Suffice it to say that the use of AP + safely in the presence of copying has some subtleties. +

+ The AP class is a really + nifty idea for a smart pointer, but it is one of the dumbest of + all the smart pointers -- and that's fine. +

+ AP is not meant to be a supersmart solution to all resource + leaks everywhere. Neither is it meant to be an effective form + of garbage collection (although it can help, a little bit). + And it can notbe used for arrays! +

+ AP is meant to prevent nasty leaks in the + presence of exceptions. That's all. This + code is AP-friendly: +

+    // Not a recommend naming scheme, but good for web-based FAQs.
+    typedef std::auto_ptr<MyClass>  APMC;
+
+    extern function_taking_MyClass_pointer (MyClass*);
+    extern some_throwable_function ();
+
+    void func (int data)
+    {
+	APMC  ap (new MyClass(data));
+
+	some_throwable_function();   // this will throw an exception
+
+	function_taking_MyClass_pointer (ap.get());
+    }
+   

When an exception gets thrown, the instance of MyClass that's + been created on the heap will be delete'd as the stack is + unwound past func(). +

Changing that code as follows is not AP-friendly: +

+	APMC  ap (new MyClass[22]);
+   

You will get the same problems as you would without the use + of AP: +

+	char*  array = new char[10];       // array new...
+	...
+	delete array;                      // ...but single-object delete
+   

+ AP cannot tell whether the pointer you've passed at creation points + to one or many things. If it points to many things, you are about + to die. AP is trivial to write, however, so you could write your + own auto_array_ptr for that situation (in fact, this has + been done many times; check the mailing lists, Usenet, Boost, etc). +

+

All of the containers + described in the standard library require their contained types + to have, among other things, a copy constructor like this: +

+    struct My_Type
+    {
+	My_Type (My_Type const&);
+    };
+   

+ Note the const keyword; the object being copied shouldn't change. + The template class auto_ptr (called AP here) does not + meet this requirement. Creating a new AP by copying an existing + one transfers ownership of the pointed-to object, which means that + the AP being copied must change, which in turn means that the + copy ctors of AP do not take const objects. +

+ The resulting rule is simple: Never ever use a + container of auto_ptr objects. The standard says that + undefined behavior is the result, but it is + guaranteed to be messy. +

+ To prevent you from doing this to yourself, the + concept checks built + in to this implementation will issue an error if you try to + compile code like this: +

+    #include <vector>
+    #include <memory>
+
+    void f()
+    {
+	std::vector< std::auto_ptr<int> >   vec_ap_int;
+    }
+   

+Should you try this with the checks enabled, you will see an error. +

+The shared_ptr class template stores a pointer, usually obtained via new, +and implements shared ownership semantics. +

+A shared_ptr<T> contains a pointer of +type T* and an object of type +__shared_count. The shared_count contains a +pointer of type _Sp_counted_base* which points to the +object that maintains the reference-counts and destroys the managed +resource. +

_Sp_counted_base<Lp>

+The base of the hierarchy is parameterized on the lock policy (see below.) +_Sp_counted_base doesn't depend on the type of pointer being managed, +it only maintains the reference counts and calls virtual functions when +the counts drop to zero. The managed object is destroyed when the last +strong reference is dropped, but the _Sp_counted_base itself must exist +until the last weak reference is dropped. +

_Sp_counted_base_impl<Ptr, Deleter, Lp>

+Inherits from _Sp_counted_base and stores a pointer of type Ptr +and a deleter of type Deleter. _Sp_deleter is +used when the user doesn't supply a custom deleter. Unlike Boost's, this +default deleter is not "checked" because GCC already issues a warning if +delete is used with an incomplete type. +This is the only derived type used by shared_ptr<Ptr> +and it is never used by shared_ptr, which uses one of +the following types, depending on how the shared_ptr is constructed. +

_Sp_counted_ptr<Ptr, Lp>

+Inherits from _Sp_counted_base and stores a pointer of type Ptr, +which is passed to delete when the last reference is dropped. +This is the simplest form and is used when there is no custom deleter or +allocator. +

_Sp_counted_deleter<Ptr, Deleter, Alloc>

+Inherits from _Sp_counted_ptr and adds support for custom deleter and +allocator. Empty Base Optimization is used for the allocator. This class +is used even when the user only provides a custom deleter, in which case +allocator is used as the allocator. +

_Sp_counted_ptr_inplace<Tp, Alloc, Lp>

+Used by allocate_shared and make_shared. +Contains aligned storage to hold an object of type Tp, +which is constructed in-place with placement new. +Has a variadic template constructor allowing any number of arguments to +be forwarded to Tp's constructor. +Unlike the other _Sp_counted_* classes, this one is parameterized on the +type of object, not the type of pointer; this is purely a convenience +that simplifies the implementation slightly. +

+C++0x-only features are: rvalue-ref/move support, allocator support, +aliasing constructor, make_shared & allocate_shared. Additionally, +the constructors taking auto_ptr parameters are +deprecated in C++0x mode. +

+The +Thread +Safety section of the Boost shared_ptr documentation says "shared_ptr +objects offer the same level of thread safety as built-in types." +The implementation must ensure that concurrent updates to separate shared_ptr +instances are correct even when those instances share a reference count e.g. +

+shared_ptr<A> a(new A);
+shared_ptr<A> b(a);
+
+// Thread 1     // Thread 2
+   a.reset();      b.reset();
+

+The dynamically-allocated object must be destroyed by exactly one of the +threads. Weak references make things even more interesting. +The shared state used to implement shared_ptr must be transparent to the +user and invariants must be preserved at all times. +The key pieces of shared state are the strong and weak reference counts. +Updates to these need to be atomic and visible to all threads to ensure +correct cleanup of the managed resource (which is, after all, shared_ptr's +job!) +On multi-processor systems memory synchronisation may be needed so that +reference-count updates and the destruction of the managed resource are +race-free. +

+The function _Sp_counted_base::_M_add_ref_lock(), called when +obtaining a shared_ptr from a weak_ptr, has to test if the managed +resource still exists and either increment the reference count or throw +bad_weak_ptr. +In a multi-threaded program there is a potential race condition if the last +reference is dropped (and the managed resource destroyed) between testing +the reference count and incrementing it, which could result in a shared_ptr +pointing to invalid memory. +

+The Boost shared_ptr (as used in GCC) features a clever lock-free +algorithm to avoid the race condition, but this relies on the +processor supporting an atomic Compare-And-Swap +instruction. For other platforms there are fall-backs using mutex +locks. Boost (as of version 1.35) includes several different +implementations and the preprocessor selects one based on the +compiler, standard library, platform etc. For the version of +shared_ptr in libstdc++ the compiler and library are fixed, which +makes things much simpler: we have an atomic CAS or we don't, see Lock +Policy below for details. +

+

+There is a single _Sp_counted_base class, +which is a template parameterized on the enum +__gnu_cxx::_Lock_policy. The entire family of classes is +parameterized on the lock policy, right up to +__shared_ptr, __weak_ptr and +__enable_shared_from_this. The actual +std::shared_ptr class inherits from +__shared_ptr with the lock policy parameter +selected automatically based on the thread model and platform that +libstdc++ is configured for, so that the best available template +specialization will be used. This design is necessary because it would +not be conforming for shared_ptr to have an +extra template parameter, even if it had a default value. The +available policies are: +

  1. + _S_Atomic +

    +Selected when GCC supports a builtin atomic compare-and-swap operation +on the target processor (see Atomic +Builtins.) The reference counts are maintained using a lock-free +algorithm and GCC's atomic builtins, which provide the required memory +synchronisation. +

  2. + _S_Mutex +

    +The _Sp_counted_base specialization for this policy contains a mutex, +which is locked in add_ref_lock(). This policy is used when GCC's atomic +builtins aren't available so explicit memory barriers are needed in places. +

  3. + _S_Single +

    +This policy uses a non-reentrant add_ref_lock() with no locking. It is +used when libstdc++ is built without --enable-threads. +

+ For all three policies, reference count increments and + decrements are done via the functions in + ext/atomicity.h, which detect if the program + is multi-threaded. If only one thread of execution exists in + the program then less expensive non-atomic operations are used. +

dynamic_pointer_cast, static_pointer_cast, +const_pointer_cast

+As noted in N2351, these functions can be implemented non-intrusively using +the alias constructor. However the aliasing constructor is only available +in C++0x mode, so in TR1 mode these casts rely on three non-standard +constructors in shared_ptr and __shared_ptr. +In C++0x mode these constructors and the related tag types are not needed. +

enable_shared_from_this

+The clever overload to detect a base class of type +enable_shared_from_this comes straight from Boost. +There is an extra overload for __enable_shared_from_this to +work smoothly with __shared_ptr<Tp, Lp> using any lock +policy. +

make_shared, allocate_shared

+make_shared simply forwards to allocate_shared +with std::allocator as the allocator. +Although these functions can be implemented non-intrusively using the +alias constructor, if they have access to the implementation then it is +possible to save storage and reduce the number of heap allocations. The +newly constructed object and the _Sp_counted_* can be allocated in a single +block and the standard says implementations are "encouraged, but not required," +to do so. This implementation provides additional non-standard constructors +(selected with the type _Sp_make_shared_tag) which create an +object of type _Sp_counted_ptr_inplace to hold the new object. +The returned shared_ptr<A> needs to know the address of the +new A object embedded in the _Sp_counted_ptr_inplace, +but it has no way to access it. +This implementation uses a "covert channel" to return the address of the +embedded object when get_deleter<_Sp_make_shared_tag>() +is called. Users should not try to use this. +As well as the extra constructors, this implementation also needs some +members of _Sp_counted_deleter to be protected where they could otherwise +be private. +

+ The shared_ptr atomic access + clause in the C++0x working draft is not implemented in GCC. +

+ The _S_single policy uses atomics when used in MT + code, because it uses the same dispatcher functions that check + __gthread_active_p(). This could be + addressed by providing template specialisations for some members + of _Sp_counted_base<_S_single>. +

+ Unlike Boost, this implementation does not use separate classes + for the pointer+deleter and pointer+deleter+allocator cases in + C++0x mode, combining both into _Sp_counted_deleter and using + allocator when the user doesn't specify + an allocator. If it was found to be beneficial an additional + class could easily be added. With the current implementation, + the _Sp_counted_deleter and __shared_count constructors taking a + custom deleter but no allocator are technically redundant and + could be removed, changing callers to always specify an + allocator. If a separate pointer+deleter class was added the + __shared_count constructor would be needed, so it has been kept + for now. +

+ The hack used to get the address of the managed object from + _Sp_counted_ptr_inplace::_M_get_deleter() + is accessible to users. This could be prevented if + get_deleter<_Sp_make_shared_tag>() + always returned NULL, since the hack only needs to work at a + lower level, not in the public API. This wouldn't be difficult, + but hasn't been done since there is no danger of accidental + misuse: users already know they are relying on unsupported + features if they refer to implementation details such as + _Sp_make_shared_tag. +

+ tr1::_Sp_deleter could be a private member of tr1::__shared_count but it + would alter the ABI. +

diff --git a/libstdc++-v3/doc/html/manual/numerics.html b/libstdc++-v3/doc/html/manual/numerics.html new file mode 100644 index 000000000..ccf1f26e1 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/numerics.html @@ -0,0 +1,30 @@ + + +Chapter 12.  Numerics

+

+

Using complex<> becomes even more comple- er, sorry, + complicated, with the not-quite-gratuitously-incompatible + addition of complex types to the C language. David Tribble has + compiled a list of C++98 and C99 conflict points; his description of + C's new type versus those of C++ and how to get them playing together + nicely is +here. +

complex<> is intended to be instantiated with a + floating-point type. As long as you meet that and some other basic + requirements, then the resulting instantiation has all of the usual + math operators defined, as well as definitions of op<< + and op>> that work with iostreams: op<< + prints (u,v) and op>> can read u, + (u), and (u,v). +

diff --git a/libstdc++-v3/doc/html/manual/numerics_and_c.html b/libstdc++-v3/doc/html/manual/numerics_and_c.html new file mode 100644 index 000000000..3a2fb499e --- /dev/null +++ b/libstdc++-v3/doc/html/manual/numerics_and_c.html @@ -0,0 +1,37 @@ + + +Interacting with C
diff --git a/libstdc++-v3/doc/html/manual/pairs.html b/libstdc++-v3/doc/html/manual/pairs.html new file mode 100644 index 000000000..8c4dbb763 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/pairs.html @@ -0,0 +1,45 @@ + + +Pairs

The pair<T1,T2> is a simple and handy way to + carry around a pair of objects. One is of type T1, and another of + type T2; they may be the same type, but you don't get anything + extra if they are. The two members can be accessed directly, as + .first and .second. +

Construction is simple. The default ctor initializes each member + with its respective default ctor. The other simple ctor, +

+    pair (const T1& x, const T2& y);
+   

does what you think it does, first getting x + and second getting y. +

There is a copy constructor, but it requires that your compiler + handle member function templates: +

+    template <class U, class V> pair (const pair<U,V>& p);
+   

The compiler will convert as necessary from U to T1 and from + V to T2 in order to perform the respective initializations. +

The comparison operators are done for you. Equality + of two pair<T1,T2>s is defined as both first + members comparing equal and both second members comparing + equal; this simply delegates responsibility to the respective + operator== functions (for types like MyClass) or builtin + comparisons (for types like int, char, etc). +

+ The less-than operator is a bit odd the first time you see it. It + is defined as evaluating to: +

+    x.first  <  y.first  ||
+	( !(y.first  <  x.first)  &&  x.second  <  y.second )
+   

The other operators are not defined using the rel_ops + functions above, but their semantics are the same. +

Finally, there is a template function called make_pair + that takes two references-to-const objects and returns an + instance of a pair instantiated on their respective types: +

+    pair<int,MyClass> p = make_pair(4,myobject);
+   
diff --git a/libstdc++-v3/doc/html/manual/parallel_mode.html b/libstdc++-v3/doc/html/manual/parallel_mode.html new file mode 100644 index 000000000..9c94e266f --- /dev/null +++ b/libstdc++-v3/doc/html/manual/parallel_mode.html @@ -0,0 +1,24 @@ + + +Chapter 18. Parallel Mode

The libstdc++ parallel mode is an experimental parallel +implementation of many algorithms the C++ Standard Library. +

+Several of the standard algorithms, for instance +std::sort, are made parallel using OpenMP +annotations. These parallel mode constructs and can be invoked by +explicit source declaration or by compiling existing sources with a +specific compiler flag. +

diff --git a/libstdc++-v3/doc/html/manual/profile_mode.html b/libstdc++-v3/doc/html/manual/profile_mode.html new file mode 100644 index 000000000..3c1b2d3b5 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/profile_mode.html @@ -0,0 +1,146 @@ + + +Chapter 19. Profile Mode

+ Goal: Give performance improvement advice based on + recognition of suboptimal usage patterns of the standard library. +

+ Method: Wrap the standard library code. Insert + calls to an instrumentation library to record the internal state of + various components at interesting entry/exit points to/from the standard + library. Process trace, recognize suboptimal patterns, give advice. + For details, see + paper presented at + CGO 2009. +

+ Strengths: +

  • + Unintrusive solution. The application code does not require any + modification. +

  • The advice is call context sensitive, thus capable of + identifying precisely interesting dynamic performance behavior. +

  • + The overhead model is pay-per-view. When you turn off a diagnostic class + at compile time, its overhead disappears. +

+

+ Drawbacks: +

  • + You must recompile the application code with custom options. +

  • You must run the application on representative input. + The advice is input dependent. +

  • + The execution time will increase, in some cases by factors. +

+

+ This is the anticipated common workflow for program foo.cc: +

+$ cat foo.cc
+#include <vector>
+int main() {
+  vector<int> v;
+  for (int k = 0; k < 1024; ++k) v.insert(v.begin(), k);
+}
+
+$ g++ -D_GLIBCXX_PROFILE foo.cc
+$ ./a.out
+$ cat libstdcxx-profile.txt
+vector-to-list: improvement = 5: call stack = 0x804842c ...
+    : advice = change std::vector to std::list
+vector-size: improvement = 3: call stack = 0x804842c ...
+    : advice = change initial container size from 0 to 1024
+

+

+ Anatomy of a warning: +

+

Three files are generated. libstdcxx-profile.txt + contains human readable advice. libstdcxx-profile.raw + contains implementation specific data about each diagnostic. + Their format is not documented. They are sufficient to generate + all the advice given in libstdcxx-profile.txt. The advantage + of keeping this raw format is that traces from multiple executions can + be aggregated simply by concatenating the raw traces. We intend to + offer an external utility program that can issue advice from a trace. + libstdcxx-profile.conf.out lists the actual diagnostic + parameters used. To alter parameters, edit this file and rename it to + libstdcxx-profile.conf. +

Advice is given regardless whether the transformation is valid. + For instance, we advise changing a map to an unordered_map even if the + application semantics require that data be ordered. + We believe such warnings can help users understand the performance + behavior of their application better, which can lead to changes + at a higher abstraction level. +

Compile time switches and environment variables (see also file + profiler.h). Unless specified otherwise, they can be set at compile time + using -D_<name> or by setting variable <name> + in the environment where the program is run, before starting execution. +

+

diff --git a/libstdc++-v3/doc/html/manual/setup.html b/libstdc++-v3/doc/html/manual/setup.html new file mode 100644 index 000000000..e0b5caee6 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/setup.html @@ -0,0 +1,102 @@ + + +Chapter 2. Setup

To transform libstdc++ sources into installed include files + and properly built binaries useful for linking to other software is + a multi-step process. Steps include getting the sources, + configuring and building the sources, testing, and installation. +

The general outline of commands is something like: +

+   get gcc sources
+   extract into gccsrcdir
+   mkdir gccbuilddir
+   cd gccbuilddir
+   gccsrcdir/configure --prefix=destdir --other-opts...
+   make
+   make check
+   make install
+   

+ Each step is described in more detail in the following sections. +

+ Because libstdc++ is part of GCC, the primary source for + installation instructions is + the GCC install page. + In particular, list of prerequisite software needed to build the library + + starts with those requirements. The same pages also list + the tools you will need if you wish to modify the source. +

+ Additional data is given here only where it applies to libstdc++. +

As of GCC 4.0.1 the minimum version of binutils required to build + libstdc++ is 2.15.90.0.1.1. You can get snapshots + (as well as releases) of binutils from + + ftp://sources.redhat.com/pub/binutils. + Older releases of libstdc++ do not require such a recent version, + but to take full advantage of useful space-saving features and + bug-fixes you should use a recent binutils whenever possible. + The configure process will automatically detect and use these + features if the underlying support is present. +

+ To generate the API documentation from the sources you will need + Doxygen, see Documentation + Hacking in the appendix for full details. +

+ Finally, a few system-specific requirements: +

linux

+ If gcc 3.1.0 or later on is being used on linux, an attempt + will be made to use "C" library functionality necessary for + C++ named locale support. For gcc 4.6.0 and later, this + means that glibc 2.3 or later is required. +

+ If the 'gnu' locale model is being used, the following + locales are used and tested in the libstdc++ testsuites. + The first column is the name of the locale, the second is + the character set it is expected to use. +

+de_DE               ISO-8859-1
+de_DE@euro          ISO-8859-15
+en_GB               ISO-8859-1
+en_HK               ISO-8859-1
+en_PH               ISO-8859-1
+en_US               ISO-8859-1
+en_US.ISO-8859-1    ISO-8859-1
+en_US.ISO-8859-15   ISO-8859-15
+en_US.UTF-8         UTF-8
+es_ES               ISO-8859-1
+es_MX               ISO-8859-1
+fr_FR               ISO-8859-1
+fr_FR@euro          ISO-8859-15
+is_IS               UTF-8
+it_IT               ISO-8859-1
+ja_JP.eucjp         EUC-JP
+ru_RU.ISO-8859-5    ISO-8859-5
+ru_RU.UTF-8         UTF-8
+se_NO.UTF-8         UTF-8
+ta_IN               UTF-8
+zh_TW               BIG5
+

Failure to have installed the underlying "C" library + locale information for any of the above regions means that + the corresponding C++ named locale will not work: because of + this, the libstdc++ testsuite will skip named locale tests + which need missing information. If this isn't an issue, don't + worry about it. If a named locale is needed, the underlying + locale information must be installed. Note that rebuilding + libstdc++ after "C" locales are installed is not necessary. +

+ To install support for locales, do only one of the following: +

  • install all locales

    • with RedHat Linux: +

      export LC_ALL=C +

      rpm -e glibc-common --nodeps +

      + rpm -i --define "_install_langs all" + glibc-common-2.2.5-34.i386.rpm + +

    • + Instructions for other operating systems solicited. +

  • install just the necessary locales

    • with Debian Linux:

      Add the above list, as shown, to the file + /etc/locale.gen

      run /usr/sbin/locale-gen

    • on most Unix-like operating systems:

      localedef -i de_DE -f ISO-8859-1 de_DE

      (repeat for each entry in the above list)

    • + Instructions for other operating systems solicited. +

diff --git a/libstdc++-v3/doc/html/manual/source_code_style.html b/libstdc++-v3/doc/html/manual/source_code_style.html new file mode 100644 index 000000000..ff4b4db2f --- /dev/null +++ b/libstdc++-v3/doc/html/manual/source_code_style.html @@ -0,0 +1,620 @@ + + +Coding Style

+

+ Identifiers that conflict and should be avoided. +


+      This is the list of names reserved to the
+      implementation
 that have been claimed by certain
+      compilers and system headers of interest, and should not be used
+      in the library. It will grow, of course.  We generally are
+      interested in names that are not all-caps, except for those like
+      "_T"
+
+      For Solaris:
+      _B
+      _C
+      _L
+      _N
+      _P
+      _S
+      _U
+      _X
+      _E1
+      ..
+      _E24
+
+      Irix adds:
+      _A
+      _G
+
+      MS adds:
+      _T
+
+      BSD adds:
+      __used
+      __unused
+      __inline
+      _Complex
+      __istype
+      __maskrune
+      __tolower
+      __toupper
+      __wchar_t
+      __wint_t
+      _res
+      _res_ext
+      __tg_*
+
+      SPU adds:
+      __ea
+
+      For GCC:
+
+      [Note that this list is out of date. It applies to the old
+      name-mangling; in G++ 3.0 and higher a different name-mangling is
+      used. In addition, many of the bugs relating to G++ interpreting
+      these names as operators have been fixed.]
+
+      The full set of __* identifiers (combined from gcc/cp/lex.c and
+      gcc/cplus-dem.c) that are either old or new, but are definitely
+      recognized by the demangler, is:
+
+      __aa
+      __aad
+      __ad
+      __addr
+      __adv
+      __aer
+      __als
+      __alshift
+      __amd
+      __ami
+      __aml
+      __amu
+      __aor
+      __apl
+      __array
+      __ars
+      __arshift
+      __as
+      __bit_and
+      __bit_ior
+      __bit_not
+      __bit_xor
+      __call
+      __cl
+      __cm
+      __cn
+      __co
+      __component
+      __compound
+      __cond
+      __convert
+      __delete
+      __dl
+      __dv
+      __eq
+      __er
+      __ge
+      __gt
+      __indirect
+      __le
+      __ls
+      __lt
+      __max
+      __md
+      __method_call
+      __mi
+      __min
+      __minus
+      __ml
+      __mm
+      __mn
+      __mult
+      __mx
+      __ne
+      __negate
+      __new
+      __nop
+      __nt
+      __nw
+      __oo
+      __op
+      __or
+      __pl
+      __plus
+      __postdecrement
+      __postincrement
+      __pp
+      __pt
+      __rf
+      __rm
+      __rs
+      __sz
+      __trunc_div
+      __trunc_mod
+      __truth_andif
+      __truth_not
+      __truth_orif
+      __vc
+      __vd
+      __vn
+
+      SGI badnames:
+      __builtin_alloca
+      __builtin_fsqrt
+      __builtin_sqrt
+      __builtin_fabs
+      __builtin_dabs
+      __builtin_cast_f2i
+      __builtin_cast_i2f
+      __builtin_cast_d2ll
+      __builtin_cast_ll2d
+      __builtin_copy_dhi2i
+      __builtin_copy_i2dhi
+      __builtin_copy_dlo2i
+      __builtin_copy_i2dlo
+      __add_and_fetch
+      __sub_and_fetch
+      __or_and_fetch
+      __xor_and_fetch
+      __and_and_fetch
+      __nand_and_fetch
+      __mpy_and_fetch
+      __min_and_fetch
+      __max_and_fetch
+      __fetch_and_add
+      __fetch_and_sub
+      __fetch_and_or
+      __fetch_and_xor
+      __fetch_and_and
+      __fetch_and_nand
+      __fetch_and_mpy
+      __fetch_and_min
+      __fetch_and_max
+      __lock_test_and_set
+      __lock_release
+      __lock_acquire
+      __compare_and_swap
+      __synchronize
+      __high_multiply
+      __unix
+      __sgi
+      __linux__
+      __i386__
+      __i486__
+      __cplusplus
+      __embedded_cplusplus
+      // long double conversion members mangled as __opr
+      // http://gcc.gnu.org/ml/libstdc++/1999-q4/msg00060.html
+      __opr
+    


+      This library is written to appropriate C++ coding standards. As such,
+      it is intended to precede the recommendations of the GNU Coding
+      Standard, which can be referenced in full here:
+
+      
http://www.gnu.org/prep/standards/standards.html#Formatting
+
+      The rest of this is also interesting reading, but skip the "Design
+      Advice" part.
+
+      The GCC coding conventions are here, and are also useful:
+      http://gcc.gnu.org/codingconventions.html
+
+      In addition, because it doesn't seem to be stated explicitly anywhere
+      else, there is an 80 column source limit.
+
+      ChangeLog entries for member functions should use the
+      classname::member function name syntax as follows:
+
+
+1999-04-15  Dennis Ritchie  <dr@att.com>
+
+      * src/basic_file.cc (__basic_file::open): Fix thinko in
+      _G_HAVE_IO_FILE_OPEN bits.
+

+
+      Notable areas of divergence from what may be previous local practice
+      (particularly for GNU C) include:
+
+      01. Pointers and references
+      
+        char* p = "flop";
+        char& c = *p;
+          -NOT-
+        char *p = "flop";  // wrong
+        char &c = *p;      // wrong
+      

+
+      Reason: In C++, definitions are mixed with executable code. Here,
+      p is being initialized, not *p.  This is near-universal
+      practice among C++ programmers; it is normal for C hackers
+      to switch spontaneously as they gain experience.
+
+      02. Operator names and parentheses
+      
+        operator==(type)
+          -NOT-
+        operator == (type)  // wrong
+      

+
+      Reason: The == is part of the function name. Separating
+      it makes the declaration look like an expression.
+
+      03. Function names and parentheses
+      
+        void mangle()
+          -NOT-
+        void mangle ()  // wrong
+      

+
+      Reason: no space before parentheses (except after a control-flow
+      keyword) is near-universal practice for C++. It identifies the
+      parentheses as the function-call operator or declarator, as
+      opposed to an expression or other overloaded use of parentheses.
+
+      04. Template function indentation
+      
+        template<typename T>
+          void
+          template_function(args)
+          { }
+          -NOT-
+        template<class T>
+        void template_function(args) {};
+      

+
+      Reason: In class definitions, without indentation whitespace is
+      needed both above and below the declaration to distinguish
+      it visually from other members. (Also, re: "typename"
+      rather than "class".)  T often could be int, which is
+      not a class. ("class", here, is an anachronism.)
+
+      05. Template class indentation
+      
+        template<typename _CharT, typename _Traits>
+          class basic_ios : public ios_base
+          {
+          public:
+            // Types:
+          };
+          -NOT-
+        template<class _CharT, class _Traits>
+        class basic_ios : public ios_base
+          {
+          public:
+            // Types:
+          };
+          -NOT-
+        template<class _CharT, class _Traits>
+          class basic_ios : public ios_base
+        {
+          public:
+            // Types:
+        };
+      

+
+      06. Enumerators
+      
+        enum
+        {
+          space = _ISspace,
+          print = _ISprint,
+          cntrl = _IScntrl
+        };
+          -NOT-
+        enum { space = _ISspace, print = _ISprint, cntrl = _IScntrl };
+      

+
+      07. Member initialization lists
+      All one line, separate from class name.
+
+      
+        gribble::gribble()
+        : _M_private_data(0), _M_more_stuff(0), _M_helper(0)
+        { }
+          -NOT-
+        gribble::gribble() : _M_private_data(0), _M_more_stuff(0), _M_helper(0)
+        { }
+      

+
+      08. Try/Catch blocks
+      
+        try
+          {
+            //
+          }
+        catch (...)
+          {
+            //
+          }
+          -NOT-
+        try {
+          //
+        } catch(...) {
+          //
+        }
+      

+
+      09. Member functions declarations and definitions
+      Keywords such as extern, static, export, explicit, inline, etc
+      go on the line above the function name. Thus
+
+      
+      virtual int
+      foo()
+      -NOT-
+      virtual int foo()
+      

+
+      Reason: GNU coding conventions dictate return types for functions
+      are on a separate line than the function name and parameter list
+      for definitions. For C++, where we have member functions that can
+      be either inline definitions or declarations, keeping to this
+      standard allows all member function names for a given class to be
+      aligned to the same margin, increasing readability.
+
+
+      10. Invocation of member functions with "this->"
+      For non-uglified names, use this->name to call the function.
+
+      
+      this->sync()
+      -NOT-
+      sync()
+      

+
+      Reason: Koenig lookup.
+
+      11. Namespaces
+      
+      namespace std
+      {
+        blah blah blah;
+      } // namespace std
+
+      -NOT-
+
+      namespace std {
+        blah blah blah;
+      } // namespace std
+      

+
+      12. Spacing under protected and private in class declarations:
+      space above, none below
+      i.e.
+
+      
+      public:
+        int foo;
+
+      -NOT-
+      public:
+
+        int foo;
+      

+
+      13. Spacing WRT return statements.
+      no extra spacing before returns, no parenthesis
+      i.e.
+
+      
+      }
+      return __ret;
+
+      -NOT-
+      }
+
+      return __ret;
+
+      -NOT-
+
+      }
+      return (__ret);
+      

+
+
+      14. Location of global variables.
+      All global variables of class type, whether in the "user visible"
+      space (e.g., cin) or the implementation namespace, must be defined
+      as a character array with the appropriate alignment and then later
+      re-initialized to the correct value.
+
+      This is due to startup issues on certain platforms, such as AIX.
+      For more explanation and examples, see src/globals.cc. All such
+      variables should be contained in that file, for simplicity.
+
+      15. Exception abstractions
+      Use the exception abstractions found in functexcept.h, which allow
+      C++ programmers to use this library with -fno-exceptions.  (Even if
+      that is rarely advisable, it's a necessary evil for backwards
+      compatibility.)
+
+      16. Exception error messages
+      All start with the name of the function where the exception is
+      thrown, and then (optional) descriptive text is added. Example:
+
+      
+      __throw_logic_error(__N("basic_string::_S_construct NULL not valid"));
+      

+
+      Reason: The verbose terminate handler prints out exception::what(),
+      as well as the typeinfo for the thrown exception. As this is the
+      default terminate handler, by putting location info into the
+      exception string, a very useful error message is printed out for
+      uncaught exceptions. So useful, in fact, that non-programmers can
+      give useful error messages, and programmers can intelligently
+      speculate what went wrong without even using a debugger.
+
+      17. The doxygen style guide to comments is a separate document,
+      see index.
+
+      The library currently has a mixture of GNU-C and modern C++ coding
+      styles. The GNU C usages will be combed out gradually.
+
+      Name patterns:
+
+      For nonstandard names appearing in Standard headers, we are constrained
+      to use names that begin with underscores. This is called "uglification".
+      The convention is:
+
+      Local and argument names:  __[a-z].*
+
+      Examples:  __count  __ix  __s1
+
+      Type names and template formal-argument names: _[A-Z][^_].*
+
+      Examples:  _Helper  _CharT  _N
+
+      Member data and function names: _M_.*
+
+      Examples:  _M_num_elements  _M_initialize ()
+
+      Static data members, constants, and enumerations: _S_.*
+
+      Examples: _S_max_elements  _S_default_value
+
+      Don't use names in the same scope that differ only in the prefix,
+      e.g. _S_top and _M_top. See BADNAMES for a list of forbidden names.
+      (The most tempting of these seem to be and "_T" and "__sz".)
+
+      Names must never have "__" internally; it would confuse name
+      unmanglers on some targets. Also, never use "__[0-9]", same reason.
+
+      --------------------------
+
+      [BY EXAMPLE]
+      
+
+      #ifndef  _HEADER_
+      #define  _HEADER_ 1
+
+      namespace std
+      {
+        class gribble
+        {
+        public:
+          gribble() throw();
+
+          gribble(const gribble&);
+
+          explicit
+          gribble(int __howmany);
+
+          gribble&
+          operator=(const gribble&);
+
+          virtual
+          ~gribble() throw ();
+
+          // Start with a capital letter, end with a period.
+          inline void
+          public_member(const char* __arg) const;
+
+          // In-class function definitions should be restricted to one-liners.
+          int
+          one_line() { return 0 }
+
+          int
+          two_lines(const char* arg)
+          { return strchr(arg, 'a'); }
+
+          inline int
+          three_lines();  // inline, but defined below.
+
+          // Note indentation.
+          template<typename _Formal_argument>
+            void
+            public_template() const throw();
+
+          template<typename _Iterator>
+            void
+            other_template();
+
+        private:
+          class _Helper;
+
+          int _M_private_data;
+          int _M_more_stuff;
+          _Helper* _M_helper;
+          int _M_private_function();
+
+          enum _Enum
+            {
+              _S_one,
+              _S_two
+            };
+
+          static void
+          _S_initialize_library();
+        };
+
+        // More-or-less-standard language features described by lack, not presence.
+      # ifndef _G_NO_LONGLONG
+        extern long long _G_global_with_a_good_long_name;  // avoid globals!
+      # endif
+
+        // Avoid in-class inline definitions, define separately;
+        // likewise for member class definitions:
+        inline int
+        gribble::public_member() const
+        { int __local = 0; return __local; }
+
+        class gribble::_Helper
+        {
+          int _M_stuff;
+
+          friend class gribble;
+        };
+      }
+
+      // Names beginning with "__": only for arguments and
+      //   local variables; never use "__" in a type name, or
+      //   within any name; never use "__[0-9]".
+
+      #endif /* _HEADER_ */
+
+
+      namespace std
+      {
+        template<typename T>  // notice: "typename", not "class", no space
+          long_return_value_type<with_many, args>
+          function_name(char* pointer,               // "char *pointer" is wrong.
+                        char* argument,
+                        const Reference& ref)
+          {
+            // int a_local;  /* wrong; see below. */
+            if (test)
+            {
+              nested code
+            }
+
+            int a_local = 0;  // declare variable at first use.
+
+            //  char a, b, *p;   /* wrong */
+            char a = 'a';
+            char b = a + 1;
+            char* c = "abc";  // each variable goes on its own line, always.
+
+            // except maybe here...
+            for (unsigned i = 0, mask = 1; mask; ++i, mask <<= 1) {
+              // ...
+            }
+          }
+
+        gribble::gribble()
+        : _M_private_data(0), _M_more_stuff(0), _M_helper(0)
+        { }
+
+        int
+        gribble::three_lines()
+        {
+          // doesn't fit in one line.
+        }
+      } // namespace std
+      

+    

diff --git a/libstdc++-v3/doc/html/manual/source_design_notes.html b/libstdc++-v3/doc/html/manual/source_design_notes.html new file mode 100644 index 000000000..fab57a647 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/source_design_notes.html @@ -0,0 +1,863 @@ + + +Design Notes

+


+
+    The Library
+    -----------
+
+    This paper is covers two major areas:
+
+    - Features and policies not mentioned in the standard that
+    the quality of the library implementation depends on, including
+    extensions and "implementation-defined" features;
+
+    - Plans for required but unimplemented library features and
+    optimizations to them.
+
+    Overhead
+    --------
+
+    The standard defines a large library, much larger than the standard
+    C library. A naive implementation would suffer substantial overhead
+    in compile time, executable size, and speed, rendering it unusable
+    in many (particularly embedded) applications. The alternative demands
+    care in construction, and some compiler support, but there is no
+    need for library subsets.
+
+    What are the sources of this overhead?  There are four main causes:
+
+    - The library is specified almost entirely as templates, which
+    with current compilers must be included in-line, resulting in
+    very slow builds as tens or hundreds of thousands of lines
+    of function definitions are read for each user source file.
+    Indeed, the entire SGI STL, as well as the dos Reis valarray,
+    are provided purely as header files, largely for simplicity in
+    porting. Iostream/locale is (or will be) as large again.
+
+    - The library is very flexible, specifying a multitude of hooks
+    where users can insert their own code in place of defaults.
+    When these hooks are not used, any time and code expended to
+    support that flexibility is wasted.
+
+    - Templates are often described as causing to "code bloat". In
+    practice, this refers (when it refers to anything real) to several
+    independent processes. First, when a class template is manually
+    instantiated in its entirely, current compilers place the definitions
+    for all members in a single object file, so that a program linking
+    to one member gets definitions of all. Second, template functions
+    which do not actually depend on the template argument are, under
+    current compilers, generated anew for each instantiation, rather
+    than being shared with other instantiations. Third, some of the
+    flexibility mentioned above comes from virtual functions (both in
+    regular classes and template classes) which current linkers add
+    to the executable file even when they manifestly cannot be called.
+
+    - The library is specified to use a language feature, exceptions,
+    which in the current gcc compiler ABI imposes a run time and
+    code space cost to handle the possibility of exceptions even when
+    they are not used. Under the new ABI (accessed with -fnew-abi),
+    there is a space overhead and a small reduction in code efficiency
+    resulting from lost optimization opportunities associated with
+    non-local branches associated with exceptions.
+
+    What can be done to eliminate this overhead?  A variety of coding
+    techniques, and compiler, linker and library improvements and
+    extensions may be used, as covered below. Most are not difficult,
+    and some are already implemented in varying degrees.
+
+    Overhead: Compilation Time
+    --------------------------
+
+    Providing "ready-instantiated" template code in object code archives
+    allows us to avoid generating and optimizing template instantiations
+    in each compilation unit which uses them. However, the number of such
+    instantiations that are useful to provide is limited, and anyway this
+    is not enough, by itself, to minimize compilation time. In particular,
+    it does not reduce time spent parsing conforming headers.
+
+    Quicker header parsing will depend on library extensions and compiler
+    improvements.  One approach is some variation on the techniques
+    previously marketed as "pre-compiled headers", now standardized as
+    support for the "export" keyword. "Exported" template definitions
+    can be placed (once) in a "repository" -- really just a library, but
+    of template definitions rather than object code -- to be drawn upon
+    at link time when an instantiation is needed, rather than placed in
+    header files to be parsed along with every compilation unit.
+
+    Until "export" is implemented we can put some of the lengthy template
+    definitions in #if guards or alternative headers so that users can skip
+    over the full definitions when they need only the ready-instantiated
+    specializations.
+
+    To be precise, this means that certain headers which define
+    templates which users normally use only for certain arguments
+    can be instrumented to avoid exposing the template definitions
+    to the compiler unless a macro is defined. For example, in
+    <string>, we might have:
+
+    template <class _CharT, ... > class basic_string {
+    ... // member declarations
+    };
+    ... // operator declarations
+
+    #ifdef _STRICT_ISO_
+    # if _G_NO_TEMPLATE_EXPORT
+    #   include <bits/std_locale.h>  // headers needed by definitions
+    #   ...
+    #   include <bits/string.tcc>  // member and global template definitions.
+    # endif
+    #endif
+
+    Users who compile without specifying a strict-ISO-conforming flag
+    would not see many of the template definitions they now see, and rely
+    instead on ready-instantiated specializations in the library. This
+    technique would be useful for the following substantial components:
+    string, locale/iostreams, valarray. It would *not* be useful or
+    usable with the following: containers, algorithms, iterators,
+    allocator. Since these constitute a large (though decreasing)
+    fraction of the library, the benefit the technique offers is
+    limited.
+
+    The language specifies the semantics of the "export" keyword, but
+    the gcc compiler does not yet support it. When it does, problems
+    with large template inclusions can largely disappear, given some
+    minor library reorganization, along with the need for the apparatus
+    described above.
+
+    Overhead: Flexibility Cost
+    --------------------------
+
+    The library offers many places where users can specify operations
+    to be performed by the library in place of defaults. Sometimes
+    this seems to require that the library use a more-roundabout, and
+    possibly slower, way to accomplish the default requirements than
+    would be used otherwise.
+
+    The primary protection against this overhead is thorough compiler
+    optimization, to crush out layers of inline function interfaces.
+    Kuck & Associates has demonstrated the practicality of this kind
+    of optimization.
+
+    The second line of defense against this overhead is explicit
+    specialization. By defining helper function templates, and writing
+    specialized code for the default case, overhead can be eliminated
+    for that case without sacrificing flexibility. This takes full
+    advantage of any ability of the optimizer to crush out degenerate
+    code.
+
+    The library specifies many virtual functions which current linkers
+    load even when they cannot be called. Some minor improvements to the
+    compiler and to ld would eliminate any such overhead by simply
+    omitting virtual functions that the complete program does not call.
+    A prototype of this work has already been done. For targets where
+    GNU ld is not used, a "pre-linker" could do the same job.
+
+    The main areas in the standard interface where user flexibility
+    can result in overhead are:
+
+    - Allocators:  Containers are specified to use user-definable
+    allocator types and objects, making tuning for the container
+    characteristics tricky.
+
+    - Locales: the standard specifies locale objects used to implement
+    iostream operations, involving many virtual functions which use
+    streambuf iterators.
+
+    - Algorithms and containers: these may be instantiated on any type,
+    frequently duplicating code for identical operations.
+
+    - Iostreams and strings: users are permitted to use these on their
+    own types, and specify the operations the stream must use on these
+    types.
+
+    Note that these sources of overhead are _avoidable_. The techniques
+    to avoid them are covered below.
+
+    Code Bloat
+    ----------
+
+    In the SGI STL, and in some other headers, many of the templates
+    are defined "inline" -- either explicitly or by their placement
+    in class definitions -- which should not be inline. This is a
+    source of code bloat. Matt had remarked that he was relying on
+    the compiler to recognize what was too big to benefit from inlining,
+    and generate it out-of-line automatically. However, this also can
+    result in code bloat except where the linker can eliminate the extra
+    copies.
+
+    Fixing these cases will require an audit of all inline functions
+    defined in the library to determine which merit inlining, and moving
+    the rest out of line. This is an issue mainly in chapters 23, 25, and
+    27. Of course it can be done incrementally, and we should generally
+    accept patches that move large functions out of line and into ".tcc"
+    files, which can later be pulled into a repository. Compiler/linker
+    improvements to recognize very large inline functions and move them
+    out-of-line, but shared among compilation units, could make this
+    work unnecessary.
+
+    Pre-instantiating template specializations currently produces large
+    amounts of dead code which bloats statically linked programs. The
+    current state of the static library, libstdc++.a, is intolerable on
+    this account, and will fuel further confused speculation about a need
+    for a library "subset". A compiler improvement that treats each
+    instantiated function as a separate object file, for linking purposes,
+    would be one solution to this problem. An alternative would be to
+    split up the manual instantiation files into dozens upon dozens of
+    little files, each compiled separately, but an abortive attempt at
+    this was done for <string> and, though it is far from complete, it
+    is already a nuisance. A better interim solution (just until we have
+    "export") is badly needed.
+
+    When building a shared library, the current compiler/linker cannot
+    automatically generate the instantiations needed. This creates a
+    miserable situation; it means any time something is changed in the
+    library, before a shared library can be built someone must manually
+    copy the declarations of all templates that are needed by other parts
+    of the library to an "instantiation" file, and add it to the build
+    system to be compiled and linked to the library. This process is
+    readily automated, and should be automated as soon as possible.
+    Users building their own shared libraries experience identical
+    frustrations.
+
+    Sharing common aspects of template definitions among instantiations
+    can radically reduce code bloat. The compiler could help a great
+    deal here by recognizing when a function depends on nothing about
+    a template parameter, or only on its size, and giving the resulting
+    function a link-name "equate" that allows it to be shared with other
+    instantiations. Implementation code could take advantage of the
+    capability by factoring out code that does not depend on the template
+    argument into separate functions to be merged by the compiler.
+
+    Until such a compiler optimization is implemented, much can be done
+    manually (if tediously) in this direction. One such optimization is
+    to derive class templates from non-template classes, and move as much
+    implementation as possible into the base class. Another is to partial-
+    specialize certain common instantiations, such as vector<T*>, to share
+    code for instantiations on all types T. While these techniques work,
+    they are far from the complete solution that a compiler improvement
+    would afford.
+
+    Overhead: Expensive Language Features
+    -------------------------------------
+
+    The main "expensive" language feature used in the standard library
+    is exception support, which requires compiling in cleanup code with
+    static table data to locate it, and linking in library code to use
+    the table. For small embedded programs the amount of such library
+    code and table data is assumed by some to be excessive. Under the
+    "new" ABI this perception is generally exaggerated, although in some
+    cases it may actually be excessive.
+
+    To implement a library which does not use exceptions directly is
+    not difficult given minor compiler support (to "turn off" exceptions
+    and ignore exception constructs), and results in no great library
+    maintenance difficulties. To be precise, given "-fno-exceptions",
+    the compiler should treat "try" blocks as ordinary blocks, and
+    "catch" blocks as dead code to ignore or eliminate. Compiler
+    support is not strictly necessary, except in the case of "function
+    try blocks"; otherwise the following macros almost suffice:
+
+    #define throw(X)
+    #define try      if (true)
+    #define catch(X) else if (false)
+
+    However, there may be a need to use function try blocks in the
+    library implementation, and use of macros in this way can make
+    correct diagnostics impossible. Furthermore, use of this scheme
+    would require the library to call a function to re-throw exceptions
+    from a try block. Implementing the above semantics in the compiler
+    is preferable.
+
+    Given the support above (however implemented) it only remains to
+    replace code that "throws" with a call to a well-documented "handler"
+    function in a separate compilation unit which may be replaced by
+    the user. The main source of exceptions that would be difficult
+    for users to avoid is memory allocation failures, but users can
+    define their own memory allocation primitives that never throw.
+    Otherwise, the complete list of such handlers, and which library
+    functions may call them, would be needed for users to be able to
+    implement the necessary substitutes. (Fortunately, they have the
+    source code.)
+
+    Opportunities
+    -------------
+
+    The template capabilities of C++ offer enormous opportunities for
+    optimizing common library operations, well beyond what would be
+    considered "eliminating overhead". In particular, many operations
+    done in Glibc with macros that depend on proprietary language
+    extensions can be implemented in pristine Standard C++. For example,
+    the chapter 25 algorithms, and even C library functions such as strchr,
+    can be specialized for the case of static arrays of known (small) size.
+
+    Detailed optimization opportunities are identified below where
+    the component where they would appear is discussed. Of course new
+    opportunities will be identified during implementation.
+
+    Unimplemented Required Library Features
+    ---------------------------------------
+
+    The standard specifies hundreds of components, grouped broadly by
+    chapter. These are listed in excruciating detail in the CHECKLIST
+    file.
+
+    17 general
+    18 support
+    19 diagnostics
+    20 utilities
+    21 string
+    22 locale
+    23 containers
+    24 iterators
+    25 algorithms
+    26 numerics
+    27 iostreams
+    Annex D  backward compatibility
+
+    Anyone participating in implementation of the library should obtain
+    a copy of the standard, ISO 14882.  People in the U.S. can obtain an
+    electronic copy for US$18 from ANSI's web site. Those from other
+    countries should visit http://www.iso.org/ to find out the location
+    of their country's representation in ISO, in order to know who can
+    sell them a copy.
+
+    The emphasis in the following sections is on unimplemented features
+    and optimization opportunities.
+
+    Chapter 17  General
+    -------------------
+
+    Chapter 17 concerns overall library requirements.
+
+    The standard doesn't mention threads. A multi-thread (MT) extension
+    primarily affects operators new and delete (18), allocator (20),
+    string (21), locale (22), and iostreams (27). The common underlying
+    support needed for this is discussed under chapter 20.
+
+    The standard requirements on names from the C headers create a
+    lot of work, mostly done. Names in the C headers must be visible
+    in the std:: and sometimes the global namespace; the names in the
+    two scopes must refer to the same object. More stringent is that
+    Koenig lookup implies that any types specified as defined in std::
+    really are defined in std::. Names optionally implemented as
+    macros in C cannot be macros in C++. (An overview may be read at
+    <http://www.cantrip.org/cheaders.html>). The scripts "inclosure"
+    and "mkcshadow", and the directories shadow/ and cshadow/, are the
+    beginning of an effort to conform in this area.
+
+    A correct conforming definition of C header names based on underlying
+    C library headers, and practical linking of conforming namespaced
+    customer code with third-party C libraries depends ultimately on
+    an ABI change, allowing namespaced C type names to be mangled into
+    type names as if they were global, somewhat as C function names in a
+    namespace, or C++ global variable names, are left unmangled. Perhaps
+    another "extern" mode, such as 'extern "C-global"' would be an
+    appropriate place for such type definitions. Such a type would
+    affect mangling as follows:
+
+    namespace A {
+    struct X {};
+    extern "C-global" {  // or maybe just 'extern "C"'
+    struct Y {};
+    };
+    }
+    void f(A::X*);  // mangles to f__FPQ21A1X
+    void f(A::Y*);  // mangles to f__FP1Y
+
+    (It may be that this is really the appropriate semantics for regular
+    'extern "C"', and 'extern "C-global"', as an extension, would not be
+    necessary.) This would allow functions declared in non-standard C headers
+    (and thus fixable by neither us nor users) to link properly with functions
+    declared using C types defined in properly-namespaced headers. The
+    problem this solves is that C headers (which C++ programmers do persist
+    in using) frequently forward-declare C struct tags without including
+    the header where the type is defined, as in
+
+    struct tm;
+    void munge(tm*);
+
+    Without some compiler accommodation, munge cannot be called by correct
+    C++ code using a pointer to a correctly-scoped tm* value.
+
+    The current C headers use the preprocessor extension "#include_next",
+    which the compiler complains about when run "-pedantic".
+    (Incidentally, it appears that "-fpedantic" is currently ignored,
+    probably a bug.)  The solution in the C compiler is to use
+    "-isystem" rather than "-I", but unfortunately in g++ this seems
+    also to wrap the whole header in an 'extern "C"' block, so it's
+    unusable for C++ headers. The correct solution appears to be to
+    allow the various special include-directory options, if not given
+    an argument, to affect subsequent include-directory options additively,
+    so that if one said
+
+    -pedantic -iprefix $(prefix) \
+    -idirafter -ino-pedantic -ino-extern-c -iwithprefix -I g++-v3 \
+    -iwithprefix -I g++-v3/ext
+
+    the compiler would search $(prefix)/g++-v3 and not report
+    pedantic warnings for files found there, but treat files in
+    $(prefix)/g++-v3/ext pedantically. (The undocumented semantics
+    of "-isystem" in g++ stink. Can they be rescinded?  If not it
+    must be replaced with something more rationally behaved.)
+
+    All the C headers need the treatment above; in the standard these
+    headers are mentioned in various chapters. Below, I have only
+    mentioned those that present interesting implementation issues.
+
+    The components identified as "mostly complete", below, have not been
+    audited for conformance. In many cases where the library passes
+    conformance tests we have non-conforming extensions that must be
+    wrapped in #if guards for "pedantic" use, and in some cases renamed
+    in a conforming way for continued use in the implementation regardless
+    of conformance flags.
+
+    The STL portion of the library still depends on a header
+    stl/bits/stl_config.h full of #ifdef clauses. This apparatus
+    should be replaced with autoconf/automake machinery.
+
+    The SGI STL defines a type_traits<> template, specialized for
+    many types in their code including the built-in numeric and
+    pointer types and some library types, to direct optimizations of
+    standard functions. The SGI compiler has been extended to generate
+    specializations of this template automatically for user types,
+    so that use of STL templates on user types can take advantage of
+    these optimizations. Specializations for other, non-STL, types
+    would make more optimizations possible, but extending the gcc
+    compiler in the same way would be much better. Probably the next
+    round of standardization will ratify this, but probably with
+    changes, so it probably should be renamed to place it in the
+    implementation namespace.
+
+    The SGI STL also defines a large number of extensions visible in
+    standard headers. (Other extensions that appear in separate headers
+    have been sequestered in subdirectories ext/ and backward/.)  All
+    these extensions should be moved to other headers where possible,
+    and in any case wrapped in a namespace (not std!), and (where kept
+    in a standard header) girded about with macro guards. Some cannot be
+    moved out of standard headers because they are used to implement
+    standard features.  The canonical method for accommodating these
+    is to use a protected name, aliased in macro guards to a user-space
+    name. Unfortunately C++ offers no satisfactory template typedef
+    mechanism, so very ad-hoc and unsatisfactory aliasing must be used
+    instead.
+
+    Implementation of a template typedef mechanism should have the highest
+    priority among possible extensions, on the same level as implementation
+    of the template "export" feature.
+
+    Chapter 18  Language support
+    ----------------------------
+
+    Headers: <limits> <new> <typeinfo> <exception>
+    C headers: <cstddef> <climits> <cfloat>  <cstdarg> <csetjmp>
+    <ctime>   <csignal> <cstdlib> (also 21, 25, 26)
+
+    This defines the built-in exceptions, rtti, numeric_limits<>,
+    operator new and delete. Much of this is provided by the
+    compiler in its static runtime library.
+
+    Work to do includes defining numeric_limits<> specializations in
+    separate files for all target architectures. Values for integer types
+    except for bool and wchar_t are readily obtained from the C header
+    <limits.h>, but values for the remaining numeric types (bool, wchar_t,
+    float, double, long double) must be entered manually. This is
+    largely dog work except for those members whose values are not
+    easily deduced from available documentation. Also, this involves
+    some work in target configuration to identify the correct choice of
+    file to build against and to install.
+
+    The definitions of the various operators new and delete must be
+    made thread-safe, which depends on a portable exclusion mechanism,
+    discussed under chapter 20.  Of course there is always plenty of
+    room for improvements to the speed of operators new and delete.
+
+    <cstdarg>, in Glibc, defines some macros that gcc does not allow to
+    be wrapped into an inline function. Probably this header will demand
+    attention whenever a new target is chosen. The functions atexit(),
+    exit(), and abort() in cstdlib have different semantics in C++, so
+    must be re-implemented for C++.
+
+    Chapter 19  Diagnostics
+    -----------------------
+
+    Headers: <stdexcept>
+    C headers: <cassert> <cerrno>
+
+    This defines the standard exception objects, which are "mostly complete".
+    Cygnus has a version, and now SGI provides a slightly different one.
+    It makes little difference which we use.
+
+    The C global name "errno", which C allows to be a variable or a macro,
+    is required in C++ to be a macro. For MT it must typically result in
+    a function call.
+
+    Chapter 20  Utilities
+    ---------------------
+    Headers: <utility> <functional> <memory>
+    C header: <ctime> (also in 18)
+
+    SGI STL provides "mostly complete" versions of all the components
+    defined in this chapter. However, the auto_ptr<> implementation
+    is known to be wrong. Furthermore, the standard definition of it
+    is known to be unimplementable as written. A minor change to the
+    standard would fix it, and auto_ptr<> should be adjusted to match.
+
+    Multi-threading affects the allocator implementation, and there must
+    be configuration/installation choices for different users' MT
+    requirements. Anyway, users will want to tune allocator options
+    to support different target conditions, MT or no.
+
+    The primitives used for MT implementation should be exposed, as an
+    extension, for users' own work. We need cross-CPU "mutex" support,
+    multi-processor shared-memory atomic integer operations, and single-
+    processor uninterruptible integer operations, and all three configurable
+    to be stubbed out for non-MT use, or to use an appropriately-loaded
+    dynamic library for the actual runtime environment, or statically
+    compiled in for cases where the target architecture is known.
+
+    Chapter 21  String
+    ------------------
+    Headers: <string>
+    C headers: <cctype> <cwctype> <cstring> <cwchar> (also in 27)
+    <cstdlib> (also in 18, 25, 26)
+
+    We have "mostly-complete" char_traits<> implementations. Many of the
+    char_traits<char> operations might be optimized further using existing
+    proprietary language extensions.
+
+    We have a "mostly-complete" basic_string<> implementation. The work
+    to manually instantiate char and wchar_t specializations in object
+    files to improve link-time behavior is extremely unsatisfactory,
+    literally tripling library-build time with no commensurate improvement
+    in static program link sizes. It must be redone. (Similar work is
+    needed for some components in chapters 22 and 27.)
+
+    Other work needed for strings is MT-safety, as discussed under the
+    chapter 20 heading.
+
+    The standard C type mbstate_t from <cwchar> and used in char_traits<>
+    must be different in C++ than in C, because in C++ the default constructor
+    value mbstate_t() must be the "base" or "ground" sequence state.
+    (According to the likely resolution of a recently raised Core issue,
+    this may become unnecessary. However, there are other reasons to
+    use a state type not as limited as whatever the C library provides.)
+    If we might want to provide conversions from (e.g.) internally-
+    represented EUC-wide to externally-represented Unicode, or vice-
+    versa, the mbstate_t we choose will need to be more accommodating
+    than what might be provided by an underlying C library.
+
+    There remain some basic_string template-member functions which do
+    not overload properly with their non-template brethren. The infamous
+    hack akin to what was done in vector<> is needed, to conform to
+    23.1.1 para 10. The CHECKLIST items for basic_string marked 'X',
+    or incomplete, are so marked for this reason.
+
+    Replacing the string iterators, which currently are simple character
+    pointers, with class objects would greatly increase the safety of the
+    client interface, and also permit a "debug" mode in which range,
+    ownership, and validity are rigorously checked. The current use of
+    raw pointers as string iterators is evil. vector<> iterators need the
+    same treatment. Note that the current implementation freely mixes
+    pointers and iterators, and that must be fixed before safer iterators
+    can be introduced.
+
+    Some of the functions in <cstring> are different from the C version.
+    generally overloaded on const and non-const argument pointers. For
+    example, in <cstring> strchr is overloaded. The functions isupper
+    etc. in <cctype> typically implemented as macros in C are functions
+    in C++, because they are overloaded with others of the same name
+    defined in <locale>.
+
+    Many of the functions required in <cwctype> and <cwchar> cannot be
+    implemented using underlying C facilities on intended targets because
+    such facilities only partly exist.
+
+    Chapter 22  Locale
+    ------------------
+    Headers: <locale>
+    C headers: <clocale>
+
+    We have a "mostly complete" class locale, with the exception of
+    code for constructing, and handling the names of, named locales.
+    The ways that locales are named (particularly when categories
+    (e.g. LC_TIME, LC_COLLATE) are different) varies among all target
+    environments. This code must be written in various versions and
+    chosen by configuration parameters.
+
+    Members of many of the facets defined in <locale> are stubs. Generally,
+    there are two sets of facets: the base class facets (which are supposed
+    to implement the "C" locale) and the "byname" facets, which are supposed
+    to read files to determine their behavior. The base ctype<>, collate<>,
+    and numpunct<> facets are "mostly complete", except that the table of
+    bitmask values used for "is" operations, and corresponding mask values,
+    are still defined in libio and just included/linked. (We will need to
+    implement these tables independently, soon, but should take advantage
+    of libio where possible.)  The num_put<>::put members for integer types
+    are "mostly complete".
+
+    A complete list of what has and has not been implemented may be
+    found in CHECKLIST. However, note that the current definition of
+    codecvt<wchar_t,char,mbstate_t> is wrong. It should simply write
+    out the raw bytes representing the wide characters, rather than
+    trying to convert each to a corresponding single "char" value.
+
+    Some of the facets are more important than others. Specifically,
+    the members of ctype<>, numpunct<>, num_put<>, and num_get<> facets
+    are used by other library facilities defined in <string>, <istream>,
+    and <ostream>, and the codecvt<> facet is used by basic_filebuf<>
+    in <fstream>, so a conforming iostream implementation depends on
+    these.
+
+    The "long long" type eventually must be supported, but code mentioning
+    it should be wrapped in #if guards to allow pedantic-mode compiling.
+
+    Performance of num_put<> and num_get<> depend critically on
+    caching computed values in ios_base objects, and on extensions
+    to the interface with streambufs.
+
+    Specifically: retrieving a copy of the locale object, extracting
+    the needed facets, and gathering data from them, for each call to
+    (e.g.) operator<< would be prohibitively slow.  To cache format
+    data for use by num_put<> and num_get<> we have a _Format_cache<>
+    object stored in the ios_base::pword() array. This is constructed
+    and initialized lazily, and is organized purely for utility. It
+    is discarded when a new locale with different facets is imbued.
+
+    Using only the public interfaces of the iterator arguments to the
+    facet functions would limit performance by forbidding "vector-style"
+    character operations. The streambuf iterator optimizations are
+    described under chapter 24, but facets can also bypass the streambuf
+    iterators via explicit specializations and operate directly on the
+    streambufs, and use extended interfaces to get direct access to the
+    streambuf internal buffer arrays. These extensions are mentioned
+    under chapter 27. These optimizations are particularly important
+    for input parsing.
+
+    Unused virtual members of locale facets can be omitted, as mentioned
+    above, by a smart linker.
+
+    Chapter 23  Containers
+    ----------------------
+    Headers: <deque> <list> <queue> <stack> <vector> <map> <set> <bitset>
+
+    All the components in chapter 23 are implemented in the SGI STL.
+    They are "mostly complete"; they include a large number of
+    nonconforming extensions which must be wrapped. Some of these
+    are used internally and must be renamed or duplicated.
+
+    The SGI components are optimized for large-memory environments. For
+    embedded targets, different criteria might be more appropriate. Users
+    will want to be able to tune this behavior. We should provide
+    ways for users to compile the library with different memory usage
+    characteristics.
+
+    A lot more work is needed on factoring out common code from different
+    specializations to reduce code size here and in chapter 25. The
+    easiest fix for this would be a compiler/ABI improvement that allows
+    the compiler to recognize when a specialization depends only on the
+    size (or other gross quality) of a template argument, and allow the
+    linker to share the code with similar specializations. In its
+    absence, many of the algorithms and containers can be partial-
+    specialized, at least for the case of pointers, but this only solves
+    a small part of the problem. Use of a type_traits-style template
+    allows a few more optimization opportunities, more if the compiler
+    can generate the specializations automatically.
+
+    As an optimization, containers can specialize on the default allocator
+    and bypass it, or take advantage of details of its implementation
+    after it has been improved upon.
+
+    Replacing the vector iterators, which currently are simple element
+    pointers, with class objects would greatly increase the safety of the
+    client interface, and also permit a "debug" mode in which range,
+    ownership, and validity are rigorously checked. The current use of
+    pointers for iterators is evil.
+
+    As mentioned for chapter 24, the deque iterator is a good example of
+    an opportunity to implement a "staged" iterator that would benefit
+    from specializations of some algorithms.
+
+    Chapter 24  Iterators
+    ---------------------
+    Headers: <iterator>
+
+    Standard iterators are "mostly complete", with the exception of
+    the stream iterators, which are not yet templatized on the
+    stream type. Also, the base class template iterator<> appears
+    to be wrong, so everything derived from it must also be wrong,
+    currently.
+
+    The streambuf iterators (currently located in stl/bits/std_iterator.h,
+    but should be under bits/) can be rewritten to take advantage of
+    friendship with the streambuf implementation.
+
+    Matt Austern has identified opportunities where certain iterator
+    types, particularly including streambuf iterators and deque
+    iterators, have a "two-stage" quality, such that an intermediate
+    limit can be checked much more quickly than the true limit on
+    range operations. If identified with a member of iterator_traits,
+    algorithms may be specialized for this case. Of course the
+    iterators that have this quality can be identified by specializing
+    a traits class.
+
+    Many of the algorithms must be specialized for the streambuf
+    iterators, to take advantage of block-mode operations, in order
+    to allow iostream/locale operations' performance not to suffer.
+    It may be that they could be treated as staged iterators and
+    take advantage of those optimizations.
+
+    Chapter 25  Algorithms
+    ----------------------
+    Headers: <algorithm>
+    C headers: <cstdlib> (also in 18, 21, 26))
+
+    The algorithms are "mostly complete". As mentioned above, they
+    are optimized for speed at the expense of code and data size.
+
+    Specializations of many of the algorithms for non-STL types would
+    give performance improvements, but we must use great care not to
+    interfere with fragile template overloading semantics for the
+    standard interfaces. Conventionally the standard function template
+    interface is an inline which delegates to a non-standard function
+    which is then overloaded (this is already done in many places in
+    the library). Particularly appealing opportunities for the sake of
+    iostream performance are for copy and find applied to streambuf
+    iterators or (as noted elsewhere) for staged iterators, of which
+    the streambuf iterators are a good example.
+
+    The bsearch and qsort functions cannot be overloaded properly as
+    required by the standard because gcc does not yet allow overloading
+    on the extern-"C"-ness of a function pointer.
+
+    Chapter 26  Numerics
+    --------------------
+    Headers: <complex> <valarray> <numeric>
+    C headers: <cmath>, <cstdlib> (also 18, 21, 25)
+
+    Numeric components: Gabriel dos Reis's valarray, Drepper's complex,
+    and the few algorithms from the STL are "mostly done".  Of course
+    optimization opportunities abound for the numerically literate. It
+    is not clear whether the valarray implementation really conforms
+    fully, in the assumptions it makes about aliasing (and lack thereof)
+    in its arguments.
+
+    The C div() and ldiv() functions are interesting, because they are the
+    only case where a C library function returns a class object by value.
+    Since the C++ type div_t must be different from the underlying C type
+    (which is in the wrong namespace) the underlying functions div() and
+    ldiv() cannot be re-used efficiently. Fortunately they are trivial to
+    re-implement.
+
+    Chapter 27  Iostreams
+    ---------------------
+    Headers: <iosfwd> <streambuf> <ios> <ostream> <istream> <iostream>
+    <iomanip> <sstream> <fstream>
+    C headers: <cstdio> <cwchar> (also in 21)
+
+    Iostream is currently in a very incomplete state. <iosfwd>, <iomanip>,
+    ios_base, and basic_ios<> are "mostly complete". basic_streambuf<> and
+    basic_ostream<> are well along, but basic_istream<> has had little work
+    done. The standard stream objects, <sstream> and <fstream> have been
+    started; basic_filebuf<> "write" functions have been implemented just
+    enough to do "hello, world".
+
+    Most of the istream and ostream operators << and >> (with the exception
+    of the op<<(integer) ones) have not been changed to use locale primitives,
+    sentry objects, or char_traits members.
+
+    All these templates should be manually instantiated for char and
+    wchar_t in a way that links only used members into user programs.
+
+    Streambuf is fertile ground for optimization extensions. An extended
+    interface giving iterator access to its internal buffer would be very
+    useful for other library components.
+
+    Iostream operations (primarily operators << and >>) can take advantage
+    of the case where user code has not specified a locale, and bypass locale
+    operations entirely. The current implementation of op<</num_put<>::put,
+    for the integer types, demonstrates how they can cache encoding details
+    from the locale on each operation. There is lots more room for
+    optimization in this area.
+
+    The definition of the relationship between the standard streams
+    cout et al. and stdout et al. requires something like a "stdiobuf".
+    The SGI solution of using double-indirection to actually use a
+    stdio FILE object for buffering is unsatisfactory, because it
+    interferes with peephole loop optimizations.
+
+    The <sstream> header work has begun. stringbuf can benefit from
+    friendship with basic_string<> and basic_string<>::_Rep to use
+    those objects directly as buffers, and avoid allocating and making
+    copies.
+
+    The basic_filebuf<> template is a complex beast. It is specified to
+    use the locale facet codecvt<> to translate characters between native
+    files and the locale character encoding. In general this involves
+    two buffers, one of "char" representing the file and another of
+    "char_type", for the stream, with codecvt<> translating. The process
+    is complicated by the variable-length nature of the translation, and
+    the need to seek to corresponding places in the two representations.
+    For the case of basic_filebuf<char>, when no translation is needed,
+    a single buffer suffices. A specialized filebuf can be used to reduce
+    code space overhead when no locale has been imbued. Matt Austern's
+    work at SGI will be useful, perhaps directly as a source of code, or
+    at least as an example to draw on.
+
+    Filebuf, almost uniquely (cf. operator new), depends heavily on
+    underlying environmental facilities. In current releases iostream
+    depends fairly heavily on libio constant definitions, but it should
+    be made independent.  It also depends on operating system primitives
+    for file operations. There is immense room for optimizations using
+    (e.g.) mmap for reading. The shadow/ directory wraps, besides the
+    standard C headers, the libio.h and unistd.h headers, for use mainly
+    by filebuf. These wrappings have not been completed, though there
+    is scaffolding in place.
+
+    The encapsulation of certain C header <cstdio> names presents an
+    interesting problem. It is possible to define an inline std::fprintf()
+    implemented in terms of the 'extern "C"' vfprintf(), but there is no
+    standard vfscanf() to use to implement std::fscanf(). It appears that
+    vfscanf but be re-implemented in C++ for targets where no vfscanf
+    extension has been defined. This is interesting in that it seems
+    to be the only significant case in the C library where this kind of
+    rewriting is necessary. (Of course Glibc provides the vfscanf()
+    extension.)  (The functions related to exit() must be rewritten
+    for other reasons.)
+
+
+    Annex D
+    -------
+    Headers: <strstream>
+
+    Annex D defines many non-library features, and many minor
+    modifications to various headers, and a complete header.
+    It is "mostly done", except that the libstdc++-2 <strstream>
+    header has not been adopted into the library, or checked to
+    verify that it matches the draft in those details that were
+    clarified by the committee. Certainly it must at least be
+    moved into the std namespace.
+
+    We still need to wrap all the deprecated features in #if guards
+    so that pedantic compile modes can detect their use.
+
+    Nonstandard Extensions
+    ----------------------
+    Headers: <iostream.h> <strstream.h> <hash> <rbtree>
+    <pthread_alloc> <stdiobuf> (etc.)
+
+    User code has come to depend on a variety of nonstandard components
+    that we must not omit. Much of this code can be adopted from
+    libstdc++-v2 or from the SGI STL. This particularly includes
+    <iostream.h>, <strstream.h>, and various SGI extensions such
+    as <hash_map.h>. Many of these are already placed in the
+    subdirectories ext/ and backward/. (Note that it is better to
+    include them via "<backward/hash_map.h>" or "<ext/hash_map>" than
+    to search the subdirectory itself via a "-I" directive.
+  

diff --git a/libstdc++-v3/doc/html/manual/source_organization.html b/libstdc++-v3/doc/html/manual/source_organization.html new file mode 100644 index 000000000..3e17c8b48 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/source_organization.html @@ -0,0 +1,97 @@ + + +Directory Layout and Source Conventions

+ The unpacked source directory of libstdc++ contains the files + needed to create the GNU C++ Library. +


+It has subdirectories:
+
+  doc
+    Files in HTML and text format that document usage, quirks of the
+    implementation, and contributor checklists.
+
+  include
+    All header files for the C++ library are within this directory,
+    modulo specific runtime-related files that are in the libsupc++
+    directory.
+
+    include/std
+      Files meant to be found by #include <name> directives in
+      standard-conforming user programs.
+
+    include/c
+      Headers intended to directly include standard C headers.
+      [NB: this can be enabled via --enable-cheaders=c]
+
+    include/c_global
+      Headers intended to include standard C headers in
+      the global namespace, and put select names into the std::
+      namespace.  [NB: this is the default, and is the same as
+      --enable-cheaders=c_global]
+
+    include/c_std
+      Headers intended to include standard C headers
+      already in namespace std, and put select names into the std::
+      namespace.  [NB: this is the same as --enable-cheaders=c_std]
+
+    include/bits
+      Files included by standard headers and by other files in
+      the bits directory.
+
+    include/backward
+      Headers provided for backward compatibility, such as <iostream.h>.
+      They are not used in this library.
+
+    include/ext
+      Headers that define extensions to the standard library.  No
+      standard header refers to any of them.
+
+  scripts
+    Scripts that are used during the configure, build, make, or test
+    process.
+
+  src
+    Files that are used in constructing the library, but are not
+    installed.
+
+  testsuites/[backward, demangle, ext, performance, thread, 17_* to 27_*]
+    Test programs are here, and may be used to begin to exercise the
+    library.  Support for "make check" and "make check-install" is
+    complete, and runs through all the subdirectories here when this
+    command is issued from the build directory.  Please note that
+    "make check" requires DejaGNU 1.4 or later to be installed.  Please
+    note that "make check-script" calls the script mkcheck, which
+    requires bash, and which may need the paths to bash adjusted to
+    work properly, as /bin/bash is assumed.
+
+Other subdirectories contain variant versions of certain files
+that are meant to be copied or linked by the configure script.
+Currently these are:
+
+  config/abi
+  config/cpu
+  config/io
+  config/locale
+  config/os
+
+In addition, a subdirectory holds the convenience library libsupc++.
+
+  libsupc++
+    Contains the runtime library for C++, including exception
+    handling and memory allocation and deallocation, RTTI, terminate
+    handlers, etc.
+
+Note that glibc also has a bits/ subdirectory.  We will either
+need to be careful not to collide with names in its bits/
+directory; or rename bits to (e.g.) cppbits/.
+
+In files throughout the system, lines marked with an "XXX" indicate
+a bug or incompletely-implemented feature.  Lines marked "XXX MT"
+indicate a place that may require attention for multi-thread safety.
+  

diff --git a/libstdc++-v3/doc/html/manual/spine.html b/libstdc++-v3/doc/html/manual/spine.html new file mode 100644 index 000000000..36225c1c7 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/spine.html @@ -0,0 +1,67 @@ + + +The GNU C++ Library Manual

Table of Contents

I. + Introduction + +
1. Status
Implementation Status
C++ 1998/2003
C++ 200x
C++ TR1
C++ TR 24733
License
The Code: GPL
The Documentation: GPL, FDL
Bugs
Implementation Bugs
Standard Bugs
2. Setup
Prerequisites
Configure
Make
3. Using
Command Options
Headers
Header Files
Mixing Headers
The C Headers and namespace std
Precompiled Headers
Macros
Namespaces
Available Namespaces
namespace std
Using Namespace Composition
Linking
Almost Nothing
Finding Dynamic or Shared Libraries
Concurrency
Prerequisites
Thread Safety
Atomics
IO
Containers
Exceptions
Exception Safety
Exception Neutrality
Doing without
Compatibility
Debugging Support
Using g++
Debug Versions of Library Binary Files
Memory Leak Hunting
Data Race Hunting
Using gdb
Tracking uncaught exceptions
Debug Mode
Compile Time Checking
Profile-based Performance Analysis
II. + Standard Contents +
4. + Support + +
Types
Fundamental Types
Numeric Properties
NULL
Dynamic Memory
Termination
Termination Handlers
Verbose Terminate Handler
5. + Diagnostics + +
Exceptions
API Reference
Adding Data to exception
Concept Checking
6. + Utilities + +
Functors
Pairs
Memory
Allocators
auto_ptr
shared_ptr
Traits
7. + Strings + +
String Classes
Simple Transformations
Case Sensitivity
Arbitrary Character Types
Tokenizing
Shrink to Fit
CString (MFC)
8. + Localization + +
Locales
locale
Facets
ctype
codecvt
messages
9. + Containers + +
Sequences
list
vector
Associative
Insertion Hints
bitset
Interacting with C
Containers vs. Arrays
10. + Iterators + +
Predefined
Iterators vs. Pointers
One Past the End
11. + Algorithms + +
Mutating
swap
12. + Numerics + +
Complex
complex Processing
Generalized Operations
Interacting with C
Numerics vs. Arrays
C99
13. + Input and Output + +
Iostream Objects
Stream Buffers
Derived streambuf Classes
Buffering
Memory Based Streams
Compatibility With strstream
File Based Streams
Copying a File
Binary Input and Output
Interacting with C
Using FILE* and file descriptors
Performance
14. + Atomics + +
API Reference
15. + Concurrency + +
API Reference
III. + Extensions + +
16. Compile Time Checks
17. Debug Mode
Intro
Semantics
Using
Using the Debug Mode
Using a Specific Debug Container
Design
Goals
Methods
Other Implementations
18. Parallel Mode
Intro
Semantics
Using
Prerequisite Compiler Flags
Using Parallel Mode
Using Specific Parallel Components
Design
Interface Basics
Configuration and Tuning
Implementation Namespaces
Testing
Bibliography
19. Profile Mode
Intro
Using the Profile Mode
Tuning the Profile Mode
Design
Wrapper Model
Instrumentation
Run Time Behavior
Analysis and Diagnostics
Cost Model
Reports
Testing
Extensions for Custom Containers
Empirical Cost Model
Implementation Issues
Stack Traces
Symbolization of Instruction Addresses
Concurrency
Using the Standard Library in the Instrumentation Implementation
Malloc Hooks
Construction and Destruction of Global Objects
Developer Information
Big Picture
How To Add A Diagnostic
Diagnostics
Diagnostic Template
Containers
Algorithms
Data Locality
Multithreaded Data Access
Statistics
Bibliography
20. Allocators
mt_allocator
Intro
Design Issues
Implementation
Single Thread Example
Multiple Thread Example
bitmap_allocator
Design
Implementation
21. Containers
Policy Based Data Structures
HP/SGI
Deprecated HP/SGI
22. Utilities
23. Algorithms
24. Numerics
25. Iterators
26. Input and Output
Derived filebufs
27. Demangling
28. Concurrency
Design
Interface to Locks and Mutexes
Interface to Atomic Functions
Implementation
Using Builtin Atomic Functions
Thread Abstraction
Use
IV. + Appendices +
A. + Contributing + +
Contributor Checklist
Reading
Assignment
Getting Sources
Submitting Patches
Directory Layout and Source Conventions
Coding Style
Bad Identifiers
By Example
Design Notes
B. + Porting and Maintenance + +
Configure and Build Hacking
Prerequisites
Overview: What Comes from Where
Storing Information in non-AC files (like configure.host)
Coding and Commenting Conventions
The acinclude.m4 layout
GLIBCXX_ENABLE, the --enable maker
Writing and Generating Documentation
Introduction
Generating Documentation
Doxygen
Docbook
Porting to New Hardware or Operating Systems
Operating System
CPU
Character Types
Thread Safety
Numeric Limits
Libtool
Test
Organization
Running the Testsuite
Writing a new test case
Test Harness and Utilities
Special Topics
ABI Policy and Guidelines
The C++ Interface
Versioning
Allowed Changes
Prohibited Changes
Implementation
Testing
Outstanding Issues
API Evolution and Deprecation History
3.0
3.1
3.2
3.3
3.4
4.0
4.1
4.2
4.3
4.4
4.5
Backwards Compatibility
First
Second
Third
C. + Free Software Needs Free Documentation + +
D. + GNU General Public License version 3 +
E. GNU Free Documentation License
diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html new file mode 100644 index 000000000..438c1bf15 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/status.html @@ -0,0 +1,283 @@ + + +Chapter 1. Status

+This status table is based on the table of contents of ISO/IEC 14882:2003. +

+This page describes the C++ support in mainline GCC SVN, not in any +particular release. +

Table 1.1. C++ 1998/2003 Implementation Status

SectionDescriptionStatusComments
+ 18 + + Language support +
18.1TypesY 
18.2Implementation propertiesY 
18.2.1Numeric Limits  
18.2.1.1Class template numeric_limitsY 
18.2.1.2numeric_limits membersY 
18.2.1.3float_round_styleY 
18.2.1.4float_denorm_styleY 
18.2.1.5numeric_limits specializationsY 
18.2.2C LibraryY 
18.3Start and terminationY 
18.4Dynamic memory managementY 
18.5Type identification  
18.5.1Class type_infoY 
18.5.2Class bad_castY 
18.5.3Class bad_typeidY 
18.6Exception handling  
18.6.1Class exceptionY 
18.6.2Violation exception-specificationsY 
18.6.3Abnormal terminationY 
18.6.4uncaught_exceptionY 
18.7Other runtime supportY 
+ 19 + + Diagnostics +
19.1Exception classesY 
19.2AssertionsY 
19.3Error numbersY 
+ 20 + + General utilities +
20.1RequirementsY 
20.2Utility components  
20.2.1OperatorsY 
20.2.2pairY 
20.3Function objects  
20.3.1BaseY 
20.3.2Arithmetic operationY 
20.3.3ComparisonsY 
20.3.4Logical operationsY 
20.3.5NegatorsY 
20.3.6BindersY 
20.3.7Adaptors for pointers to functionsY 
20.3.8Adaptors for pointers to membersY 
20.4Memory  
20.4.1The default allocatorY 
20.4.2Raw storage iteratorY 
20.4.3Temporary buffersY 
20.4.4Specialized algorithmsY 
20.4.4.1uninitialized_copyY 
20.4.4.2uninitialized_fillY 
20.4.4.3uninitialized_fill_nY 
20.4.5Class template auto_ptrY 
20.4.6C libraryY 
+ 21 + + Strings +
21.1Character traits  
21.1.1Character traits requirementsY 
21.1.2traits typedefY 
21.1.3char_traits specializations  
21.1.3.1struct char_traits<char>Y 
21.1.3.2struct char_traits<wchar_t>Y 
21.2String classesY 
21.3Class template basic_stringY 
21.4Null-terminated sequence utilitiesYC library dependency
+ 22 + + Localization +
22.1Locales  
22.1.1Class localeY 
22.1.2locale globalsY 
22.1.3Convenience interfaces  
22.1.3.1Character classificationY 
22.1.3.2Character conversionsY 
22.2Standard locale categories  
22.2.1ctypeY 
22.2.2Numeric  
22.2.2.1num_getY 
22.2.2.2num_putY 
22.2.3num_punctY 
22.2.4collateY 
22.2.5Time  
22.2.5.1time_getY 
22.2.5.2time_get_bynameY 
22.2.5.3time_putY 
22.2.5.3time_put_bynameY 
22.2.6Monetary  
22.2.6.1money_getY 
22.2.6.2money_putY 
22.2.6.3money_punctY 
22.2.6.4money_punct_bynameY 
22.2.7messagesY 
22.2.8Program-defined facetsY 
22.3C Library LocalesY 
+ 23 + + Containers +
23.1Container requirementsY 
23.2Sequence containers  
23.2.1Class template dequeY 
23.2.2Class template listY 
23.2.3Adaptors  
23.2.3.1Class template queueY 
23.2.3.2Class template priority_queueY 
23.2.3.3Class template stackY 
23.2.4Class template vectorY 
23.2.5Class vector<bool>Y 
23.3Associative containers  
23.3.1Class template mapY 
23.3.2Class template multimapY 
23.3.3Class template setY 
23.3.4Class template multisetY 
+ 24 + + Iterators +
24.1RequirementsY 
24.2Header <iterator> synopsisY 
24.3Iterator primitivesY 
24.4Predefined iterators and Iterator adaptors  
24.4.1Reverse iteratorsY 
24.4.2Insert iteratorsY 
24.5Stream iterators  
24.5.1Class template istream_iteratorY 
24.5.2Class template ostream_iteratorY 
24.5.3Class template istreambuf_iteratorY 
24.5.4Class template ostreambuf_iteratorY 
+ 25 + + Algorithms +
25.1Non-modifying sequence operationsY 
25.2Mutating sequence operationsY 
25.3Sorting and related operationsY 
25.4C library algorithmsY 
+ 26 + + Numerics +
26.1Numeric type requirementsY 
26.2Complex numbersY 
26.3Numeric arrays  
26.3.1Header <valarray> synopsisY 
26.3.2Class template valarrayY 
26.3.3valarray non-member operationsY 
26.3.4Class sliceY 
26.3.5Class template slice_arrayY 
26.3.6Class gsliceY 
26.3.7Class template gslice_arrayY 
26.3.8Class template mask_arrayY 
26.3.9Class template indirect_arrayY 
26.4Generalized numeric operations  
26.4.1accumulateY 
26.4.2inner_productY 
26.4.3partial_sumY 
26.4.4adjacent_differenceY 
26.4.5iotaY 
26.5C LibraryY 
+ 27 + + Input/output +
27.1RequirementsY 
27.2Forward declarationsY 
27.3Standard iostream objectsY 
27.3.1Narrow stream objectsY 
27.3.2Wide stream objectsY 
27.4Iostreams base classesY 
27.5Stream buffersY 
27.6Formatting and manipulatorsY 
27.7String-based streamsY 
27.8File-based streamsY 
+ Appendix D + + Compatibility features +
D.1Increment operator with bool operand  
D.2static keyword  
D.3Access declarations  
D.4Implicit conversion from const strings  
D.5C standard library headers  
D.6Old iostreams members  
D.7char* streams  

+ The ISO standard defines the following phrase: +

+ We do so here, for the C++ library only. Behavior of the + compiler, linker, runtime loader, and other elements of "the + implementation" are documented elsewhere. Everything listed + in Annex B, Implementation Qualities, are also part of the + compiler, not the library. +

+ For each entry, we give the section number of the standard, when + applicable. This list is probably incomplet and inkorrekt. +

+ [1.9]/11 #3 If isatty(3) is true, then + interactive stream support is implied. +

+ [17.4.4.5] Non-reentrant functions are probably best + discussed in the various sections on multithreading (see above). +

[18.1]/4 The type of NULL is described + here. +

[18.3]/8 Even though it's listed in the library + sections, libstdc++ has zero control over what the cleanup code hands + back to the runtime loader. Talk to the compiler people. :-) +

[18.4.2.1]/5 (bad_alloc), + [18.5.2]/5 (bad_cast), + [18.5.3]/5 (bad_typeid), + [18.6.1]/8 (exception), + [18.6.2.1]/5 (bad_exception): The what() + member function of class std::exception, and these other + classes publicly derived from it, simply returns the name of the + class. But they are the mangled names; you will need to call + c++filt and pass the names as command-line parameters to + demangle them, or call a + runtime demangler function. + (The classes in <stdexcept> have constructors which + require an argument to use later for what() calls, so the + problem of what()'s value does not arise in most + user-defined exceptions.) +

[18.5.1]/7 The return value of + std::type_info::name() is the mangled type name (see the + previous entry for more). +

[20.1.5]/5 "Implementors are encouraged to + supply libraries that can accept allocators that encapsulate more + general memory models and that support non-equal instances. In such + implementations, any requirements imposed on allocators by containers + beyond those requirements that appear in Table 32, and the semantics + of containers and algorithms when allocator instances compare + non-equal, are implementation-defined." As yet we don't + have any allocators which compare non-equal, so we can't describe how + they behave. +

[21.1.3.1]/3,4, + [21.1.3.2]/2, + [23.*]'s foo::iterator, + [27.*]'s foo::*_type, + others... + Nope, these types are called implementation-defined because you + shouldn't be taking advantage of their underlying types. Listing them + here would defeat the purpose. :-) +

[21.1.3.1]/5 I don't really know about + the mbstate_t stuff... see + the chapter 22 + notes for what does exist. +

[22.*] Anything and everything we have on locale + implementation will be described + over here. +

[26.2.8]/9 I have no idea what + complex<T>'s pow(0,0) returns. +

[27.4.2.4]/2 Calling + std::ios_base::sync_with_stdio after I/O has already been + performed on the standard stream objects will + flush the buffers, and + destroy and recreate the underlying buffer instances. Whether or not + the previously-written I/O is destroyed in this process depends mostly + on the --enable-libio choice: for stdio, if the written data is + already in the stdio buffer, the data may be completely safe! +

[27.6.1.1.2], + [27.6.2.3] The I/O sentry ctor and dtor can perform + additional work than the minimum required. We are not currently taking + advantage of this yet. +

[27.7.1.3]/16, + [27.8.1.4]/10 + The effects of pubsetbuf/setbuf are described + in this chapter. +

[27.8.1.4]/16 Calling fstream::sync when + a get area exists will... whatever fflush() does, I think. +

+This table is based on the table of contents of ISO/IEC +JTC1 SC22 WG21 Doc No: N3290 Date: 2011-04-11 +Final Draft International Standard, Standard for Programming Language C++ +

+In this implementation -std=gnu++0x or +-std=c++0x flags must be used to enable language +and library +features. See dialect +options. The pre-defined symbol +__GXX_EXPERIMENTAL_CXX0X__ is used to check for the +presence of the required flag. +

+This page describes the C++0x support in the GCC 4.6 release series. +

Table 1.2. C++ 200x Implementation Status

SectionDescriptionStatusComments
+ 18 + + Language support +
18.1GeneralY 
18.2TypesPartialMissing offsetof, max_align_t
18.3Implementation properties  
18.3.2Numeric Limits  
18.3.2.3Class template numeric_limitsY 
18.3.2.4numeric_limits membersY 
18.3.2.5float_round_styleN 
18.3.2.6float_denorm_styleN 
18.3.2.7numeric_limits specializationsY 
18.3.3C LibraryY 
18.4Integer types  
18.4.1Header <cstdint> synopsisY 
18.5Start and terminationPartialC library dependency for quick_exit, at_quick_exit
18.6Dynamic memory managementY 
18.7Type identification  
18.7.1Class type_infoY 
18.7.2Class bad_castY 
18.7.3Class bad_typeidY 
18.8Exception handling  
18.8.1Class exceptionY 
18.8.2Class bad_exceptionY 
18.8.3Abnormal terminationY 
18.8.4uncaught_exceptionY 
18.8.5Exception PropagationY 
18.8.6nested_exceptionY 
18.9Initializer lists  
18.9.1Initializer list constructorsY 
18.9.2Initializer list accessY 
18.9.3Initializer list range accessN 
18.10Other runtime supportY 
+ 19 + + Diagnostics +
19.1GeneralY 
19.2Exception classesY 
19.3AssertionsY 
19.4Error numbersY 
19.5System error support  
19.5.1Class error_categoryY 
19.5.2Class error_codeY 
19.5.3Class error_conditionY 
19.5.4Comparison operatorsY 
19.5.5Class system_errorY 
+ 20 + + General utilities +
20.1General  
20.2Utility components  
20.2.1OperatorsY 
20.2.2SwapY 
20.2.3forward and move helpersY 
20.2.4Function template declvalY 
20.3Pairs  
20.3.1In general  
20.3.2Class template pairY 
20.3.3Specialized algorithmsY 
20.3.4Tuple-like access to pairY 
20.3.5Piecewise constructionY 
20.4Tuples  
20.4.1In general  
20.4.2Class template tuple  
20.4.2.1ConstructionY 
20.4.2.2AssignmentY 
20.4.2.3SwapY 
20.4.2.4Tuple creation functionsPartialtuple_cat should be a single variadic signature (DR 1385)
20.4.2.5Tuple helper classesY 
20.4.2.6Element accessY 
20.4.2.7Relational operatorsY 
20.4.2.8Tuple traitsN 
20.4.2.9Tuple specialized algorithmsY 
20.5Class template bitsetY 
20.5.1bitset constructorsY 
20.5.2bitset membersY 
20.5.3bitset hash supportY 
20.5.4bitset operatorsY 
20.6Memory  
20.6.1In general  
20.6.2Header <memory> synopsis  
20.6.3Pointer traitsN 
20.6.4Pointer safetyPartial 
20.6.5AlignN 
20.6.6Allocator argument tagY 
20.6.7uses_allocatorY 
20.6.8Allocator traitsN 
20.6.9The default allocatorY 
20.6.10Raw storage iteratorY 
20.6.11Temporary buffersY 
20.6.12Specialized algorithms  
20.6.12.1addressofY 
20.6.12.2uninitialized_copyY 
20.6.12.3uninitialized_fillY 
20.6.12.4uninitialized_fill_nY 
20.6.13C libraryY 
20.7Smart pointers  
20.7.1Class template unique_ptrY 
20.7.2Shared-ownership pointersY 
20.7.2.1Class bad_weak_ptrY 
20.7.2.2Class template shared_ptrY +

+ Uses code from + boost::shared_ptr. +

+
20.7.2.3Class template weak_ptrY 
20.7.2.4Class template emable_shared_from_thisY 
20.7.2.5shared_ptr atomic accessPartial 
20.7.2.6Smart pointer hash supportY 
20.8Function objects  
20.8.1Definitions  
20.8.2Requirements  
20.8.3Class template reference_wrapperY 
20.8.4Arithmetic operationY 
20.8.5ComparisonsY 
20.8.6Logical operationsY 
20.8.7Bitwise operationsY 
20.8.8NegatorsY 
20.8.9Function template bindY 
20.8.10Function template mem_fnPartialMissing overloads for reference-qualified member functions
20.8.11Polymorphic function wrappers  
20.8.11.1Class bad_function_callY 
20.8.11.2Class template functionPartialMissing allocator support
20.8.12Class template hashY 
20.9Metaprogramming and type traits  
20.9.1RequirementsY 
20.9.2Header <type_traits> synopsis  
20.9.3Helper classesY 
20.9.4Unary Type TraitsY 
20.9.4.1Primary type categoriesY 
20.9.4.2Composite type traitsY 
20.9.4.3Type propertiesPartialMissing is_trivially_copyable, + is_assignable, is_copy_assignable, is_move_assignable, + is_trivially_constructible, is_trivially_default_constructible, + is_trivially_copy_constructible, is_trivially_move_constructible, + is_trivially_assignable, is_trivially_default_assignable, + is_trivially_copy_assignable, is_trivially_move_assignable, + is_trivially_destructible, + is_nothrow_assignable, + is_nothrow_copy_assignable, is_nothrow_move_assignable, + is_nothrow_destructible +
20.9.5Type property queriesY 
20.9.6Relationships between typesY 
20.9.7Transformations between types  
20.9.7.1Const-volatile modificationsY 
20.9.7.2Reference modificationsY 
20.9.7.3Sign modificationsY 
20.9.7.4Array modificationsY 
20.9.7.5Pointer modificationsY 
20.9.7.6Other transformationsY 
20.10Compile-time rational arithmetic  
20.10.1In general  
20.10.2Header <ratio> synopsis  
20.10.3Class template ratioY 
20.10.4Arithmetic on ratiosY 
20.10.5Comparison of ratiosY 
20.10.6SI types for ratioY 
20.11Time utilities  
20.11.3Clock requirementsY 
20.11.4Time-related traits  
20.11.4.1treat_as_floating_pointY 
20.11.4.2duration_valuesY 
20.11.4.3Specializations of common_typeY 
20.11.5Class template durationPartialMissing constexpr for non-member arithmetic operations
20.11.6Class template time_pointY 
20.11.7Clocks  
20.11.7.1Class system_clockY 
20.11.7.2Class steady_clockNSupport old monotonic_clock spec instead
20.11.7.3Class high_resolution_clockY 
20.11.8Date and time functionsY 
20.12Scoped allocator adaptor  
20.12.1Header <scoped_allocator> synopsis  
20.12.2Scoped allocator adaptor member typesN 
20.12.3Scoped allocator adaptor constructorsN 
20.12.4Scoped allocator adaptor membersN 
20.12.5Scoped allocator operatorsN 
20.13Class type_indexN 
+ 21 + + Strings +
21.1GeneralY 
21.2Character traits  
21.2.1Character traits requirementsY 
21.2.2traits typedefsY 
21.2.3char_traits specializations  
21.2.3.1struct char_traits<char>PartialMissing constexpr
21.2.3.2struct char_traits<char16_t>PartialMissing constexpr
21.2.3.3struct char_traits<char32_t>Y 
21.2.3.4struct char_traits<wchar_t>Y 
21.3String classesY 
21.4Class template basic_stringY 
21.5Numeric ConversionsY 
21.6Hash supportY 
21.7Null-terminated sequence utilitiesYC library dependency
+ 22 + + Localization +
22.1GeneralY 
22.2Header <locale> synopsisY 
22.3Locales  
22.3.1Class localeY 
22.3.2locale globalsY 
22.3.3Convenience interfaces  
22.3.3.1Character classificationY 
22.3.3.2Conversions  
22.3.3.2.1Character conversionsY 
22.3.3.2.2string conversionsN 
22.3.3.2.3Buffer conversionsN 
22.4Standard locale categories  
22.4.1The ctype categoryY 
22.4.2The numeric category  
22.4.2.1num_getY 
22.4.2.2num_putY 
22.4.3The numeric punctuation facetY 
22.4.4The collate categoryY 
22.4.5The time category  
22.4.5.1Class template time_getY 
22.4.5.2Class template time_get_bynameY 
22.4.5.3Class template time_putY 
22.4.5.3Class template time_put_bynameY 
22.4.6The monetary category  
22.4.6.1Class template money_getY 
22.4.6.2Class template money_putY 
22.4.6.3Class template money_punctY 
22.4.6.4Class template money_punct_bynameY 
22.4.7The message retrieval categoryY 
22.4.8Program-defined facetsY 
22.5Standard code conversion facetsN 
22.6C Library LocalesY 
+ 23 + + Containers +
23.1General  
23.2Container requirements  
23.2.1General container requirementsY 
23.2.2Container data racesY 
23.2.3Sequence containersY 
23.2.4Associative containersY 
23.2.5Unordered associative containersY 
23.3Sequence containers  
23.3.2Class template arrayY 
23.3.3Class template dequeY 
23.3.4Class template forward_listY 
23.3.5Class template listY 
23.3.6Class template vectorY 
23.3.7Class vector<bool>Y 
23.4Associative containers  
23.4.4Class template mapY 
23.4.5Class template multimapY 
23.4.6Class template setY 
23.4.7Class template multisetY 
23.5Unordered associative containers  
23.5.4Class template unordered_mapY 
23.5.5Class template unordered_multimapY 
23.5.6Class template unordered_setY 
23.5.7Class template unordered_multisetY 
23.6Container adaptors  
23.6.1Class template queueY 
23.6.2Class template priority_queueY 
23.6.3Class template stackY 
+ 24 + + Iterators +
24.1GeneralY 
24.2Iterator requirementsY 
24.3Header <iterator> synopsisY 
24.4Iterator primitivesY 
24.5Iterator adaptors  
24.5.1Reverse iteratorsY 
24.5.2Insert iteratorsY 
24.5.3Move iteratorsY 
24.6Stream iterators  
24.6.1Class template istream_iteratorY 
24.6.2Class template ostream_iteratorY 
24.6.3Class template istreambuf_iteratorY 
24.6.4Class template ostreambuf_iteratorY 
24.6.5range accessN 
+ 25 + + Algorithms +
25.1General  
25.2Non-modifying sequence operationsY 
25.3Mutating sequence operationsY 
25.4Sorting and related operationsY 
25.5C library algorithmsY 
+ 26 + + Numerics +
26.1GeneralY 
26.2Numeric type requirementsY 
26.3The floating-point environmentY 
26.4Complex numbersPartialMissing constexpr
26.5Random number generation  
26.5.1Requirements  
26.5.2Header <random> synopsis  
26.5.3Random number engine class templates  
26.5.3.1Class template linear_congruential_engineYMissing constexpr
26.5.3.2Class template mersenne_twister_engineYMissing constexpr
26.5.3.3Class template subtract_with_carry_engineYMissing constexpr
26.5.4Random number engine adaptor class templates  
26.5.4.2Class template discard_block_engineYMissing constexpr
26.5.4.3Class template independent_bits_engineYMissing constexpr
26.5.4.4Class template shuffle_order_engineYMissing constexpr
26.5.5Engines and engine adaptors with predefined parametersY 
26.5.6Class random_deviceYMissing constexpr
26.5.7Utilities  
26.5.7.1Class seed_seqY 
26.5.7.2Function template generate_canonicalY 
26.5.8Random number distribution class templates  
26.5.8.2Uniform distributions  
26.5.8.2.1Class template uniform_int_distributionY 
26.5.8.2.2Class template uniform_real_distributionY 
26.5.8.3Bernoulli distributions  
26.5.8.3.1Class bernoulli_distributionY 
26.5.8.3.2Class template binomial_distributionY 
26.5.8.3.3Class template geometric_distributionY 
26.5.8.3.4Class template negative_binomial_distributionY 
26.5.8.4Poisson distributions  
26.5.8.4.1Class template poisson_distributionY 
26.5.8.4.2Class template exponential_distributionY 
26.5.8.4.3Class template gamma_distributionY 
26.5.8.4.4Class template weibull_distributionY 
26.5.8.4.5Class template extreme_value_distributionY 
26.5.8.5Normal distributions  
26.5.8.5.1Class template normal_distributionY 
26.5.8.5.2Class template lognormal_distributionY 
26.5.8.5.3Class template chi_squared_distributionY 
26.5.8.5.4Class template cauchy_distributionY 
26.5.8.5.5Class template fisher_f_distributionY 
26.5.8.5.6Class template student_t_distributionY 
26.5.8.6Sampling distributions  
26.5.8.6.1Class template discrete_distributionY 
26.5.8.6.2Class template piecewise_constant_distributionY 
26.5.8.6.3Class template piecewise_linear_distributionY 
26.6Numeric arrays  
26.6.1Header <valarray> synopsisY 
26.6.2Class template valarrayPartialMissing move and swap operations
26.6.3valarray non-member operationsY 
26.6.4Class sliceY 
26.6.5Class template slice_arrayY 
26.6.6The gslice classY 
26.6.7Class template gslice_arrayY 
26.6.8Class template mask_arrayY 
26.6.9Class template indirect_arrayY 
26.6.10valarray range accessY 
26.7Generalized numeric operations  
26.7.1Header <numeric> synopsisY 
26.7.2accumulateY 
26.7.3inner_productY 
26.7.4partial_sumY 
26.7.5adjacent_differenceY 
26.7.6iotaY 
26.8C LibraryY 
+ 27 + + Input/output library +
27.1GeneralY 
27.2Iostreams requirementsY 
27.2.1Imbue LimitationsY 
27.2.2Positioning Type LimitationsY 
27.2.3Thread safetyPartial 
27.3Forward declarationsY 
27.4Standard iostream objectsY 
27.4.1OverviewY 
27.4.2Narrow stream objectsY 
27.4.3Wide stream objectsY 
27.5Iostreams base classesPartial + Missing move and swap operations on basic_ios. Missing + make_error_code and make_error_condition. +
27.6Stream buffersY 
27.7Formatting and manipulatorsPartialMissing move and swap operations
27.8String-based streamsPartialMissing move and swap operations
27.9File-based streamsPartialMissing move and swap operations
+ 28 + + Regular expressions +
28.1GeneralN 
28.2DefinitionsN 
28.3RequirementsN 
28.4Header <regex> synopsisN 
28.5Namespace std::regex_constantsY 
28.6Class regex_errorY 
28.7Class template regex_traitsPartial 
28.8Class template basic_regexPartial 
28.9Class template sub_matchPartial 
28.10Class template match_resultsPartial 
28.11Regular expression algorithmsN 
28.12Regular expression IteratorsN 
28.13Modified ECMAScript regular expression grammarN 
+ 29 + + Atomic operations +
29.1GeneralY 
29.2Header <atomic> synopsisY 
29.3Order and consistencyN 
29.4Lock-free propertyPartialMissing ATOMIC_BOOL_LOCK_FREE and + ATOMIC_POINTER_LOCK_FREE. + Based on _GLIBCXX_ATOMIC_PROPERTY +
29.5Atomic typesPartialMissing constexpr
29.6Operations on atomic typesY 
29.7Flag Type and operationsY 
29.8FencesN 
+ 30 + + Thread support +
30.1GeneralY 
30.2RequirementsY 
30.3Threads  
30.3.1Class threadPartialthread::id comparisons not well-defined
30.3.2Namespace this_threadY 
30.4Mutual exclusion  
30.4.1Mutex requirements  
30.4.1.1In general  
30.4.1.2Mutex types  
30.4.1.2.1Class mutexY 
30.4.1.2.2Class recursive_mutexY 
30.4.1.3Timed mutex types  
30.4.1.3.1Class timed_mutexY 
30.4.1.3.2Class recursive_timed_mutexY 
30.4.2Locks  
30.4.2.1Class template lock_guardY 
30.4.2.2Class template unique_lockY 
30.4.3Generic locking algorithmsY 
30.4.4Call once  
30.4.4.1Struct once_flagY 
30.4.4.2Function call_onceY 
30.5Condition variablesPartialMissing notify_all_at_thread_exit
30.5.1Class condition_variableY 
30.5.2Class condition_variable_anyY 
30.6Futures  
30.6.1Overview  
30.6.2Error handlingY 
30.6.3Class future_errorY 
30.6.4Shared stateY 
30.6.5Class template promisePartialMissing set_*_at_thread_exit
30.6.6Class template futurePartialMissing future_status and future::share()
30.6.7Class template shared_futurePartialMissing future_status
30.6.8Function template asyncY 
30.6.9Class template packaged_taskPartialMissing make_ready_at_thread_exit
+ Appendix D + + Compatibility features +
D.1Increment operator with bool operand  
D.2register keyword  
D.3Implicit declaration of copy functions  
D.4Dynamic exception specifications  
D.5C standard library headers  
D.6Old iostreams members  
D.7char* streams  
D.8Function objects  
D.9Binders  
D.10auto_ptr  
D.11Violating exception-specifications  

+This table is based on the table of contents of ISO/IEC DTR 19768 +Doc No: N1836=05-0096 Date: 2005-06-24 +Draft Technical Report on C++ Library Extensions +

+In this implementation the header names are prefixed by +tr1/, for instance <tr1/functional>, +<tr1/memory>, and so on. +

+This page describes the TR1 support in mainline GCC SVN, not in any particular +release. +

Table 1.3. C++ TR1 Implementation Status

SectionDescriptionStatusComments
2General Utilities
2.1Reference wrappers  
2.1.1Additions to header <functional> synopsisY 
2.1.2Class template reference_wrapper  
2.1.2.1reference_wrapper construct/copy/destroyY 
2.1.2.2reference_wrapper assignmentY 
2.1.2.3reference_wrapper accessY 
2.1.2.4reference_wrapper invocationY 
2.1.2.5reference_wrapper helper functionsY 
2.2Smart pointers  
2.2.1Additions to header <memory> synopsisY 
2.2.2Class bad_weak_ptrY 
2.2.3Class template shared_ptr  +

+ Uses code from + boost::shared_ptr. +

+
2.2.3.1shared_ptr constructorsY 
2.2.3.2shared_ptr destructorY 
2.2.3.3shared_ptr assignmentY 
2.2.3.4shared_ptr modifiersY 
2.2.3.5shared_ptr observersY 
2.2.3.6shared_ptr comparisonY 
2.2.3.7shared_ptr I/OY 
2.2.3.8shared_ptr specialized algorithmsY 
2.2.3.9shared_ptr castsY 
2.2.3.10get_deleterY 
2.2.4Class template weak_ptr  
2.2.4.1weak_ptr constructorsY 
2.2.4.2weak_ptr destructorY 
2.2.4.3weak_ptr assignmentY 
2.2.4.4weak_ptr modifiersY 
2.2.4.5weak_ptr observersY 
2.2.4.6weak_ptr comparisonY 
2.2.4.7weak_ptr specialized algorithmsY 
2.2.5Class template enable_shared_from_thisY 
3Function Objects
3.1DefinitionsY 
3.2Additions to <functional> synopsisY 
3.3RequirementsY 
3.4Function return typesY 
3.5Function template mem_fnY 
3.6Function object binders  
3.6.1Class template is_bind_expressionY 
3.6.2Class template is_placeholderY 
3.6.3Function template bindY 
3.6.4PlaceholdersY 
3.7Polymorphic function wrappers  
3.7.1Class bad_function_callY 
3.7.1.1bad_function_call constructorY 
3.7.2Class template function  
3.7.2.1function construct/copy/destroyY 
3.7.2.2function modifiersY 
3.7.2.3function capacityY 
3.7.2.4function invocationY 
3.7.2.5function target accessY 
3.7.2.6undefined operatorsY 
3.7.2.7null pointer comparison operatorsY 
3.7.2.8specialized algorithmsY 
4Metaprogramming and type traits
4.1RequirementsY 
4.2Header <type_traits> synopsisY 
4.3Helper classesY 
4.4General RequirementsY 
4.5Unary Type Traits  
4.5.1Primary Type CategoriesY 
4.5.2Composite type traitsY 
4.5.3Type propertiesY 
4.6Relationships between typesY 
4.7Transformations between types  
4.7.1Const-volatile modificationsY 
4.7.2Reference modificationsY 
4.7.3Array modificationsY 
4.7.4Pointer modificationsY 
4.8Other transformationsY 
4.9Implementation requirementsY 
5Numerical Facilities
5.1Random number generation  
5.1.1RequirementsY 
5.1.2Header <random> synopsisY 
5.1.3Class template variate_generatorY 
5.1.4Random number engine class templatesY 
5.1.4.1Class template linear_congruentialY 
5.1.4.2Class template mersenne_twisterY 
5.1.4.3Class template subtract_with_carryY 
5.1.4.4Class template subtract_with_carry_01Y 
5.1.4.5Class template discard_blockY 
5.1.4.6Class template xor_combineYoperator()() per N2079
5.1.5Engines with predefined parametersY 
5.1.6Class random_deviceY 
5.1.7Random distribution class templatesY 
5.1.7.1Class template uniform_intY 
5.1.7.2Class bernoulli_distributionY 
5.1.7.3Class template geometric_distributionY 
5.1.7.4Class template poisson_distributionY 
5.1.7.5Class template binomial_distributionY 
5.1.7.6Class template uniform_realY 
5.1.7.7Class template exponential_distributionY 
5.1.7.8Class template normal_distributionY 
5.1.7.9Class template gamma_distributionY 
5.2Mathematical special functionsY 
5.2.1Additions to header <cmath> synopsisY 
5.2.1.1associated Laguerre polynomialsY 
5.2.1.2associated Legendre functionsY 
5.2.1.3beta functionY 
5.2.1.4(complete) elliptic integral of the first kindY 
5.2.1.5(complete) elliptic integral of the second kindY 
5.2.1.6(complete) elliptic integral of the third kindY 
5.2.1.7confluent hypergeometric functionsY 
5.2.1.8regular modified cylindrical Bessel functionsY 
5.2.1.9cylindrical Bessel functions (of the first kind)Y 
5.2.1.10irregular modified cylindrical Bessel functionsY 
5.2.1.11cylindrical Neumann functionsY 
5.2.1.12(incomplete) elliptic integral of the first kindY 
5.2.1.13(incomplete) elliptic integral of the second kindY 
5.2.1.14(incomplete) elliptic integral of the third kindY 
5.2.1.15exponential integralY 
5.2.1.16Hermite polynomialsY 
5.2.1.17hypergeometric functionsY 
5.2.1.18Laguerre polynomialsY 
5.2.1.19Legendre polynomialsY 
5.2.1.20Riemann zeta functionY 
5.2.1.21spherical Bessel functions (of the first kind)Y 
5.2.1.22spherical associated Legendre functionsY 
5.2.1.23spherical Neumann functionsY 
5.2.2Additions to header <math.h> synopsisY 
6Containers
6.1Tuple typesY 
6.1.1Header <tuple> synopsisY 
6.1.2Additions to header <utility> synopsisY 
6.1.3Class template tupleY 
6.1.3.1ConstructionY 
6.1.3.2Tuple creation functionsY 
6.1.3.3Tuple helper classesY 
6.1.3.4Element accessY 
6.1.3.5Relational operatorsY 
6.1.4PairsY 
6.2Fixed size arrayY 
6.2.1Header <array> synopsisY 
6.2.2Class template arrayY 
6.2.2.1array constructors, copy, and assignmentY 
6.2.2.2array specialized algorithmsY 
6.2.2.3array sizeY 
6.2.2.4Zero sized arraysY 
6.2.2.5Tuple interface to class template arrayY 
6.3Unordered associative containersY 
6.3.1Unordered associative container requirementsY 
6.3.1.1Exception safety guaranteesY 
6.3.2Additions to header <functional> synopsisY 
6.3.3Class template hashY 
6.3.4Unordered associative container classesY 
6.3.4.1Header <unordered_set> synopsisY 
6.3.4.2Header <unordered_map> synopsisY 
6.3.4.3Class template unordered_setY 
6.3.4.3.1unordered_set constructorsY 
6.3.4.3.2unordered_set swapY 
6.3.4.4Class template unordered_mapY 
6.3.4.4.1unordered_map constructorsY 
6.3.4.4.2unordered_map element accessY 
6.3.4.4.3unordered_map swapY 
6.3.4.5Class template unordered_multisetY 
6.3.4.5.1unordered_multiset constructorsY 
6.3.4.5.2unordered_multiset swapY 
6.3.4.6Class template unordered_multimapY 
6.3.4.6.1unordered_multimap constructorsY 
6.3.4.6.2unordered_multimap swapY 
7Regular Expressions
7.1DefinitionsN 
7.2RequirementsN 
7.3Regular expressions summaryN 
7.4Header <regex> synopsisN 
7.5Namespace tr1::regex_constantsN 
7.5.1Bitmask Type syntax_option_typeN 
7.5.2Bitmask Type regex_constants::match_flag_typeN 
7.5.3Implementation defined error_typeN 
7.6Class regex_errorN 
7.7Class template regex_traitsN 
7.8Class template basic_regexN 
7.8.1basic_regex constantsN 
7.8.2basic_regex constructorsN 
7.8.3basic_regex assignN 
7.8.4basic_regex constant operationsN 
7.8.5basic_regex localeN 
7.8.6basic_regex swapN 
7.8.7basic_regex non-member functionsN 
7.8.7.1basic_regex non-member swapN 
7.9Class template sub_matchN 
7.9.1sub_match membersN 
7.9.2sub_match non-member operatorsN 
7.10Class template match_resultsN 
7.10.1match_results constructorsN 
7.10.2match_results sizeN 
7.10.3match_results element accessN 
7.10.4match_results formattingN 
7.10.5match_results allocatorN 
7.10.6match_results swapN 
7.11Regular expression algorithmsN 
7.11.1exceptionsN 
7.11.2regex_matchN 
7.11.3regex_searchN 
7.11.4regex_replaceN 
7.12Regular expression IteratorsN 
7.12.1Class template regex_iteratorN 
7.12.1.1regex_iterator constructorsN 
7.12.1.2regex_iterator comparisonsN 
7.12.1.3regex_iterator dereferenceN 
7.12.1.4regex_iterator incrementN 
7.12.2Class template regex_token_iteratorN 
7.12.2.1regex_token_iterator constructorsN 
7.12.2.2regex_token_iterator comparisonsN 
7.12.2.3regex_token_iterator dereferenceN 
7.12.2.4regex_token_iterator incrementN 
7.13Modified ECMAScript regular expression grammarN 
8C Compatibility
8.1Additions to header <complex>Y 
8.1.1SynopsisY 
8.1.2Function acosY 
8.1.3Function asinY 
8.1.4Function atanY 
8.1.5Function acoshY 
8.1.6Function asinhY 
8.1.7Function atanhY 
8.1.8Function fabsY 
8.1.9Additional OverloadsY 
8.2Header <ccomplex>NDR 551
8.3Header <complex.h>NDR 551
8.4Additions to header <cctype>Y 
8.4.1SynopsisY 
8.4.2Function isblankY 
8.5Additions to header <ctype.h>Y 
8.6Header <cfenv>Y 
8.6.1SynopsisY 
8.6.2DefinitionsY 
8.7Header <fenv.h>Y 
8.8Additions to header <cfloat>Y 
8.9Additions to header <float.h>Y 
8.10Additions to header <ios>N 
8.10.1SynopsisN 
8.10.2Function hexfloatN 
8.11Header <cinttypes>Y 
8.11.1SynopsisYDR 557
8.11.2DefinitionsY 
8.12Header <inttypes.h>Y 
8.13Additions to header <climits>Y 
8.14Additions to header <limits.h>Y 
8.15Additions to header <locale>N 
8.16Additions to header <cmath>Y 
8.16.1SynopsisY 
8.16.2DefinitionsY 
8.16.3Function template definitionsY 
8.16.4Additional overloadsYDR 568; DR 550
8.17Additions to header <math.h>Y 
8.18Additions to header <cstdarg>Y 
8.19Additions to header <stdarg.h>Y 
8.20The header <cstdbool>Y 
8.21The header <stdbool.h>Y 
8.22The header <cstdint>Y 
8.22.1SynopsisY 
8.22.2DefinitionsY 
8.23The header <stdint.h>Y 
8.24Additions to header <cstdio>Y 
8.24.1SynopsisY 
8.24.2DefinitionsY 
8.24.3Additional format specifiersYC library dependency
8.24.4Additions to header <stdio.h>Y 
8.25Additions to header <cstdlib>Y 
8.25.1SynopsisY 
8.25.2DefinitionsY 
8.25.3Function absY 
8.25.4Function divY 
8.26Additions to header <stdlib.h>Y 
8.27Header <ctgmath>YDR 551
8.28Header <tgmath.h>YDR 551
8.29Additions to header <ctime>YC library dependency
8.30Additions to header <cwchar>Y 
8.30.1SynopsisY 
8.30.2DefinitionsY 
8.30.3Additional wide format specifiersYC library dependency
8.31Additions to header <wchar.h>Y 
8.32Additions to header <cwctype>Y 
8.32.1SynopsisY 
8.32.2Function iswblankY 
8.33Additions to header <wctype.h>Y 

+This table is based on the table of contents of +ISO/IEC TR 24733 Date: 2009-08-28 +Extension for the programming language C++ to support +decimal floating-point arithmetic +

+This page describes the TR 24733 support in mainline GCC SVN, not in any +particular release. +

Table 1.4. C++ TR 24733 Implementation Status

SectionDescriptionStatusComments
+ 0 + + Introduction +
+ 1 + + Normative references +
+ 2 + + Conventions +
+ 3 + + Decimal floating-point types +
3.1Characteristics of decimal floating-point types  
3.2Decimal Types  
3.2.1Class decimal synopsisPartialMissing declarations for formatted input/output; non-conforming extension for functions converting to integral type
3.2.2Class decimal32PartialMissing 3.2.2.5 conversion to integral type; conforming extension for conversion from scalar decimal floating-point
3.2.3Class decimal64PartialMissing 3.2.3.5 conversion to integral type; conforming extension for conversion from scalar decimal floating-point
3.2.4Class decimal128PartialMissing 3.2.4.5 conversion to integral type; conforming extension for conversion from scalar decimal floating-point
3.2.5Initialization from coefficient and exponentY 
3.2.6Conversion to generic floating-point typeY 
3.2.7Unary arithmetic operatorsY 
3.2.8Binary arithmetic operatorsY 
3.2.9Comparison operatorsY 
3.2.10Formatted inputN 
3.2.11Formatted outputN 
3.3Additions to header limitsN 
3.4Headers cfloat and float.h  
3.4.2Additions to header cfloat synopsisY 
3.4.3Additions to header float.h synopsisN 
3.4.4Maximum finite valueY 
3.4.5EpsilonY 
3.4.6Minimum positive normal valueY 
3.4.7Minimum positive subnormal valueY 
3.4.8Evaluation formatY 
3.5Additions to cfenv and fenv.hOutside the scope of GCC 
3.6Additions to cmath and math.hOutside the scope of GCC 
3.7Additions to cstdio and stdio.hOutside the scope of GCC 
3.8Additions to cstdlib and stdlib.hOutside the scope of GCC 
3.9Additions to cwchar and wchar.hOutside the scope of GCC 
3.10FacetsN 
3.11Type traitsN 
3.12Hash functionsN 
+ 4 + + Notes on C compatibility +

diff --git a/libstdc++-v3/doc/html/manual/streambufs.html b/libstdc++-v3/doc/html/manual/streambufs.html new file mode 100644 index 000000000..92c148dfc --- /dev/null +++ b/libstdc++-v3/doc/html/manual/streambufs.html @@ -0,0 +1,137 @@ + + +Stream Buffers

+

Creating your own stream buffers for I/O can be remarkably easy. + If you are interested in doing so, we highly recommend two very + excellent books: + Standard C++ + IOStreams and Locales by Langer and Kreft, ISBN 0-201-18395-1, and + The C++ Standard Library + by Nicolai Josuttis, ISBN 0-201-37926-0. Both are published by + Addison-Wesley, who isn't paying us a cent for saying that, honest. +

Here is a simple example, io/outbuf1, from the Josuttis text. It + transforms everything sent through it to uppercase. This version + assumes many things about the nature of the character type being + used (for more information, read the books or the newsgroups): +

+    #include <iostream>
+    #include <streambuf>
+    #include <locale>
+    #include <cstdio>
+
+    class outbuf : public std::streambuf
+    {
+      protected:
+	/* central output function
+	 * - print characters in uppercase mode
+	 */
+	virtual int_type overflow (int_type c) {
+	    if (c != EOF) {
+		// convert lowercase to uppercase
+		c = std::toupper(static_cast<char>(c),getloc());
+
+		// and write the character to the standard output
+		if (putchar(c) == EOF) {
+		    return EOF;
+		}
+	    }
+	    return c;
+	}
+    };
+
+    int main()
+    {
+	// create special output buffer
+	outbuf ob;
+	// initialize output stream with that output buffer
+	std::ostream out(&ob);
+
+	out << "31 hexadecimal: "
+	    << std::hex << 31 << std::endl;
+	return 0;
+    }
+   

Try it yourself! More examples can be found in 3.1.x code, in + include/ext/*_filebuf.h, and in this article by James Kanze: + Filtering + Streambufs. +

First, are you sure that you understand buffering? Particularly + the fact that C++ may not, in fact, have anything to do with it? +

The rules for buffering can be a little odd, but they aren't any + different from those of C. (Maybe that's why they can be a bit + odd.) Many people think that writing a newline to an output + stream automatically flushes the output buffer. This is true only + when the output stream is, in fact, a terminal and not a file + or some other device -- and that may not even be true + since C++ says nothing about files nor terminals. All of that is + system-dependent. (The "newline-buffer-flushing only occurring + on terminals" thing is mostly true on Unix systems, though.) +

Some people also believe that sending endl down an + output stream only writes a newline. This is incorrect; after a + newline is written, the buffer is also flushed. Perhaps this + is the effect you want when writing to a screen -- get the text + out as soon as possible, etc -- but the buffering is largely + wasted when doing this to a file: +

+   output << "a line of text" << endl;
+   output << some_data_variable << endl;
+   output << "another line of text" << endl; 

The proper thing to do in this case to just write the data out + and let the libraries and the system worry about the buffering. + If you need a newline, just write a newline: +

+   output << "a line of text\n"
+	  << some_data_variable << '\n'
+	  << "another line of text\n"; 

I have also joined the output statements into a single statement. + You could make the code prettier by moving the single newline to + the start of the quoted text on the last line, for example. +

If you do need to flush the buffer above, you can send an + endl if you also need a newline, or just flush the buffer + yourself: +

+   output << ...... << flush;    // can use std::flush manipulator
+   output.flush();               // or call a member fn 

On the other hand, there are times when writing to a file should + be like writing to standard error; no buffering should be done + because the data needs to appear quickly (a prime example is a + log file for security-related information). The way to do this is + just to turn off the buffering before any I/O operations at + all have been done (note that opening counts as an I/O operation): +

+   std::ofstream    os;
+   std::ifstream    is;
+   int   i;
+
+   os.rdbuf()->pubsetbuf(0,0);
+   is.rdbuf()->pubsetbuf(0,0);
+
+   os.open("/foo/bar/baz");
+   is.open("/qux/quux/quuux");
+   ...
+   os << "this data is written immediately\n";
+   is >> i;   // and this will probably cause a disk read 

Since all aspects of buffering are handled by a streambuf-derived + member, it is necessary to get at that member with rdbuf(). + Then the public version of setbuf can be called. The + arguments are the same as those for the Standard C I/O Library + function (a buffer area followed by its size). +

A great deal of this is implementation-dependent. For example, + streambuf does not specify any actions for its own + setbuf()-ish functions; the classes derived from + streambuf each define behavior that "makes + sense" for that class: an argument of (0,0) turns off buffering + for filebuf but does nothing at all for its siblings + stringbuf and strstreambuf, and specifying + anything other than (0,0) has varying effects. + User-defined classes derived from streambuf can + do whatever they want. (For filebuf and arguments for + (p,s) other than zeros, libstdc++ does what you'd expect: + the first s bytes of p are used as a buffer, + which you must allocate and deallocate.) +

A last reminder: there are usually more buffers involved than + just those at the language/library level. Kernel buffers, disk + buffers, and the like will also have an effect. Inspecting and + changing those are system-dependent. +

diff --git a/libstdc++-v3/doc/html/manual/strings.html b/libstdc++-v3/doc/html/manual/strings.html new file mode 100644 index 000000000..a70edcdb8 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/strings.html @@ -0,0 +1,366 @@ + + +Chapter 7.  Strings

+ Here are Standard, simple, and portable ways to perform common + transformations on a string instance, such as + "convert to all upper case." The word transformations + is especially apt, because the standard template function + transform<> is used. +

+ This code will go through some iterations. Here's a simple + version: +

+   #include <string>
+   #include <algorithm>
+   #include <cctype>      // old <ctype.h>
+
+   struct ToLower
+   {
+     char operator() (char c) const  { return std::tolower(c); }
+   };
+
+   struct ToUpper
+   {
+     char operator() (char c) const  { return std::toupper(c); }
+   };
+
+   int main()
+   {
+     std::string  s ("Some Kind Of Initial Input Goes Here");
+
+     // Change everything into upper case
+     std::transform (s.begin(), s.end(), s.begin(), ToUpper());
+
+     // Change everything into lower case
+     std::transform (s.begin(), s.end(), s.begin(), ToLower());
+
+     // Change everything back into upper case, but store the
+     // result in a different string
+     std::string  capital_s;
+     capital_s.resize(s.size());
+     std::transform (s.begin(), s.end(), capital_s.begin(), ToUpper());
+   }
+   

+ Note that these calls all + involve the global C locale through the use of the C functions + toupper/tolower. This is absolutely guaranteed to work -- + but only if the string contains only characters + from the basic source character set, and there are only + 96 of those. Which means that not even all English text can be + represented (certain British spellings, proper names, and so forth). + So, if all your input forevermore consists of only those 96 + characters (hahahahahaha), then you're done. +

Note that the + ToUpper and ToLower function objects + are needed because toupper and tolower + are overloaded names (declared in <cctype> and + <locale>) so the template-arguments for + transform<> cannot be deduced, as explained in + this + message. + + At minimum, you can write short wrappers like +

+   char toLower (char c)
+   {
+      return std::tolower(c);
+   } 

(Thanks to James Kanze for assistance and suggestions on all of this.) +

Another common operation is trimming off excess whitespace. Much + like transformations, this task is trivial with the use of string's + find family. These examples are broken into multiple + statements for readability: +

+   std::string  str (" \t blah blah blah    \n ");
+
+   // trim leading whitespace
+   string::size_type  notwhite = str.find_first_not_of(" \t\n");
+   str.erase(0,notwhite);
+
+   // trim trailing whitespace
+   notwhite = str.find_last_not_of(" \t\n");
+   str.erase(notwhite+1); 

Obviously, the calls to find could be inserted directly + into the calls to erase, in case your compiler does not + optimize named temporaries out of existence. +

+

The well-known-and-if-it-isn't-well-known-it-ought-to-be + Guru of the Week + discussions held on Usenet covered this topic in January of 1998. + Briefly, the challenge was, write a 'ci_string' class which + is identical to the standard 'string' class, but is + case-insensitive in the same way as the (common but nonstandard) + C function stricmp(). +

+   ci_string s( "AbCdE" );
+
+   // case insensitive
+   assert( s == "abcde" );
+   assert( s == "ABCDE" );
+
+   // still case-preserving, of course
+   assert( strcmp( s.c_str(), "AbCdE" ) == 0 );
+   assert( strcmp( s.c_str(), "abcde" ) != 0 ); 

The solution is surprisingly easy. The original answer was + posted on Usenet, and a revised version appears in Herb Sutter's + book Exceptional C++ and on his website as GotW 29. +

See? Told you it was easy!

+ Added June 2000: The May 2000 issue of C++ + Report contains a fascinating article by + Matt Austern (yes, the Matt Austern) on why + case-insensitive comparisons are not as easy as they seem, and + why creating a class is the wrong way to go + about it in production code. (The GotW answer mentions one of + the principle difficulties; his article mentions more.) +

Basically, this is "easy" only if you ignore some things, + things which may be too important to your program to ignore. (I chose + to ignore them when originally writing this entry, and am surprised + that nobody ever called me on it...) The GotW question and answer + remain useful instructional tools, however. +

Added September 2000: James Kanze provided a link to a + Unicode + Technical Report discussing case handling, which provides some + very good information. +

+

The std::basic_string is tantalizingly general, in that + it is parameterized on the type of the characters which it holds. + In theory, you could whip up a Unicode character class and instantiate + std::basic_string<my_unicode_char>, or assuming + that integers are wider than characters on your platform, maybe just + declare variables of type std::basic_string<int>. +

That's the theory. Remember however that basic_string has additional + type parameters, which take default arguments based on the character + type (called CharT here): +

+      template <typename CharT,
+		typename Traits = char_traits<CharT>,
+		typename Alloc = allocator<CharT> >
+      class basic_string { .... };

Now, allocator<CharT> will probably Do The Right + Thing by default, unless you need to implement your own allocator + for your characters. +

But char_traits takes more work. The char_traits + template is declared but not defined. + That means there is only +

+      template <typename CharT>
+	struct char_traits
+	{
+	    static void foo (type1 x, type2 y);
+	    ...
+	};

and functions such as char_traits<CharT>::foo() are not + actually defined anywhere for the general case. The C++ standard + permits this, because writing such a definition to fit all possible + CharT's cannot be done. +

The C++ standard also requires that char_traits be specialized for + instantiations of char and wchar_t, and it + is these template specializations that permit entities like + basic_string<char,char_traits<char>> to work. +

If you want to use character types other than char and wchar_t, + such as unsigned char and int, you will + need suitable specializations for them. For a time, in earlier + versions of GCC, there was a mostly-correct implementation that + let programmers be lazy but it broke under many situations, so it + was removed. GCC 3.4 introduced a new implementation that mostly + works and can be specialized even for int and other + built-in types. +

If you want to use your own special character class, then you have + a lot + of work to do, especially if you with to use i18n features + (facets require traits information but don't have a traits argument). +

Another example of how to specialize char_traits was given on the + mailing list and at a later date was put into the file + include/ext/pod_char_traits.h. We agree + that the way it's used with basic_string (scroll down to main()) + doesn't look nice, but that's because the + nice-looking first attempt turned out to not + be conforming C++, due to the rule that CharT must be a POD. + (See how tricky this is?) +

+

The Standard C (and C++) function strtok() leaves a lot to + be desired in terms of user-friendliness. It's unintuitive, it + destroys the character string on which it operates, and it requires + you to handle all the memory problems. But it does let the client + code decide what to use to break the string into pieces; it allows + you to choose the "whitespace," so to speak. +

A C++ implementation lets us keep the good things and fix those + annoyances. The implementation here is more intuitive (you only + call it once, not in a loop with varying argument), it does not + affect the original string at all, and all the memory allocation + is handled for you. +

It's called stringtok, and it's a template function. Sources are + as below, in a less-portable form than it could be, to keep this + example simple (for example, see the comments on what kind of + string it will accept). +

+#include <string>
+template <typename Container>
+void
+stringtok(Container &container, string const &in,
+	  const char * const delimiters = " \t\n")
+{
+    const string::size_type len = in.length();
+	  string::size_type i = 0;
+
+    while (i < len)
+    {
+	// Eat leading whitespace
+	i = in.find_first_not_of(delimiters, i);
+	if (i == string::npos)
+	  return;   // Nothing left but white space
+
+	// Find the end of the token
+	string::size_type j = in.find_first_of(delimiters, i);
+
+	// Push token
+	if (j == string::npos)
+	{
+	  container.push_back(in.substr(i));
+	  return;
+	}
+	else
+	  container.push_back(in.substr(i, j-i));
+
+	// Set up for next loop
+	i = j + 1;
+    }
+}
+

+ The author uses a more general (but less readable) form of it for + parsing command strings and the like. If you compiled and ran this + code using it: +

+   std::list<string>  ls;
+   stringtok (ls, " this  \t is\t\n  a test  ");
+   for (std::list<string>const_iterator i = ls.begin();
+	i != ls.end(); ++i)
+   {
+       std::cerr << ':' << (*i) << ":\n";
+   } 

You would see this as output: +

+   :this:
+   :is:
+   :a:
+   :test: 

with all the whitespace removed. The original s is still + available for use, ls will clean up after itself, and + ls.size() will return how many tokens there were. +

As always, there is a price paid here, in that stringtok is not + as fast as strtok. The other benefits usually outweigh that, however. +

Added February 2001: Mark Wilden pointed out that the + standard std::getline() function can be used with standard + istringstreams to perform + tokenizing as well. Build an istringstream from the input text, + and then use std::getline with varying delimiters (the three-argument + signature) to extract tokens into a string. +

+

A common lament seen in various newsgroups deals with the Standard + string class as opposed to the Microsoft Foundation Class called + CString. Often programmers realize that a standard portable + answer is better than a proprietary nonportable one, but in porting + their application from a Win32 platform, they discover that they + are relying on special functions offered by the CString class. +

Things are not as bad as they seem. In + this + message, Joe Buck points out a few very important things: +

  • The Standard string supports all the operations + that CString does, with three exceptions. +

  • Two of those exceptions (whitespace trimming and case + conversion) are trivial to implement. In fact, we do so + on this page. +

  • The third is CString::Format, which allows formatting + in the style of sprintf. This deserves some mention: +

+ The old libg++ library had a function called form(), which did much + the same thing. But for a Standard solution, you should use the + stringstream classes. These are the bridge between the iostream + hierarchy and the string class, and they operate with regular + streams seamlessly because they inherit from the iostream + hierarchy. An quick example: +

+   #include <iostream>
+   #include <string>
+   #include <sstream>
+
+   string f (string& incoming)     // incoming is "foo  N"
+   {
+       istringstream   incoming_stream(incoming);
+       string          the_word;
+       int             the_number;
+
+       incoming_stream >> the_word        // extract "foo"
+		       >> the_number;     // extract N
+
+       ostringstream   output_stream;
+       output_stream << "The word was " << the_word
+		     << " and 3*N was " << (3*the_number);
+
+       return output_stream.str();
+   } 

A serious problem with CString is a design bug in its memory + allocation. Specifically, quoting from that same message: +

+   CString suffers from a common programming error that results in
+   poor performance.  Consider the following code:
+
+   CString n_copies_of (const CString& foo, unsigned n)
+   {
+	   CString tmp;
+	   for (unsigned i = 0; i < n; i++)
+		   tmp += foo;
+	   return tmp;
+   }
+
+   This function is O(n^2), not O(n).  The reason is that each +=
+   causes a reallocation and copy of the existing string.  Microsoft
+   applications are full of this kind of thing (quadratic performance
+   on tasks that can be done in linear time) -- on the other hand,
+   we should be thankful, as it's created such a big market for high-end
+   ix86 hardware. :-)
+
+   If you replace CString with string in the above function, the
+   performance is O(n).
+   

Joe Buck also pointed out some other things to keep in mind when + comparing CString and the Standard string class: +

  • CString permits access to its internal representation; coders + who exploited that may have problems moving to string. +

  • Microsoft ships the source to CString (in the files + MFC\SRC\Str{core,ex}.cpp), so you could fix the allocation + bug and rebuild your MFC libraries. + Note: It looks like the CString shipped + with VC++6.0 has fixed this, although it may in fact have been + one of the VC++ SPs that did it. +

  • string operations like this have O(n) complexity + if the implementors do it correctly. The libstdc++ + implementors did it correctly. Other vendors might not. +

  • While chapters of the SGI STL are used in libstdc++, their + string class is not. The SGI string is essentially + vector<char> and does not do any reference + counting like libstdc++'s does. (It is O(n), though.) + So if you're thinking about SGI's string or rope classes, + you're now looking at four possibilities: CString, the + libstdc++ string, the SGI string, and the SGI rope, and this + is all before any allocator or traits customizations! (More + choices than you can shake a stick at -- want fries with that?) +

diff --git a/libstdc++-v3/doc/html/manual/stringstreams.html b/libstdc++-v3/doc/html/manual/stringstreams.html new file mode 100644 index 000000000..1107d61b1 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/stringstreams.html @@ -0,0 +1,37 @@ + + +Memory Based Streams

+

Stringstreams (defined in the header <sstream>) + are in this author's opinion one of the coolest things since + sliced time. An example of their use is in the Received Wisdom + section for Sect1 21 (Strings), + describing how to + format strings. +

The quick definition is: they are siblings of ifstream and ofstream, + and they do for std::string what their siblings do for + files. All that work you put into writing << and + >> functions for your classes now pays off + again! Need to format a string before passing the string + to a function? Send your stuff via << to an + ostringstream. You've read a string as input and need to parse it? + Initialize an istringstream with that string, and then pull pieces + out of it with >>. Have a stringstream and need to + get a copy of the string inside? Just call the str() + member function. +

This only works if you've written your + <</>> functions correctly, though, + and correctly means that they take istreams and ostreams as + parameters, not ifstreams and ofstreams. If they + take the latter, then your I/O operators will work fine with + file streams, but with nothing else -- including stringstreams. +

If you are a user of the strstream classes, you need to update + your code. You don't have to explicitly append ends to + terminate the C-style character array, you don't have to mess with + "freezing" functions, and you don't have to manage the + memory yourself. The strstreams have been officially deprecated, + which means that 1) future revisions of the C++ Standard won't + support them, and 2) if you use them, people will laugh at you. +

diff --git a/libstdc++-v3/doc/html/manual/support.html b/libstdc++-v3/doc/html/manual/support.html new file mode 100644 index 000000000..39c8185c6 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/support.html @@ -0,0 +1,130 @@ + + +Chapter 4.  Support

+ This part deals with the functions called and objects created + automatically during the course of a program's existence. +

+ While we can't reproduce the contents of the Standard here (you + need to get your own copy from your nation's member body; see our + homepage for help), we can mention a couple of changes in what + kind of support a C++ program gets from the Standard Library. +

+ The header limits defines + traits classes to give access to various implementation + defined-aspects of the fundamental types. The traits classes -- + fourteen in total -- are all specializations of the template class + numeric_limits, documented here + and defined as follows: +

+   template<typename T>
+     struct class
+     {
+       static const bool is_specialized;
+       static T max() throw();
+       static T min() throw();
+
+       static const int digits;
+       static const int digits10;
+       static const bool is_signed;
+       static const bool is_integer;
+       static const bool is_exact;
+       static const int radix;
+       static T epsilon() throw();
+       static T round_error() throw();
+
+       static const int min_exponent;
+       static const int min_exponent10;
+       static const int max_exponent;
+       static const int max_exponent10;
+
+       static const bool has_infinity;
+       static const bool has_quiet_NaN;
+       static const bool has_signaling_NaN;
+       static const float_denorm_style has_denorm;
+       static const bool has_denorm_loss;
+       static T infinity() throw();
+       static T quiet_NaN() throw();
+       static T denorm_min() throw();
+
+       static const bool is_iec559;
+       static const bool is_bounded;
+       static const bool is_modulo;
+
+       static const bool traps;
+       static const bool tinyness_before;
+       static const float_round_style round_style;
+     };
+   
diff --git a/libstdc++-v3/doc/html/manual/termination.html b/libstdc++-v3/doc/html/manual/termination.html new file mode 100644 index 000000000..cc5235943 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/termination.html @@ -0,0 +1,124 @@ + + +Termination

+ If you are having difficulty with uncaught exceptions and want a + little bit of help debugging the causes of the core dumps, you can + make use of a GNU extension, the verbose terminate handler. +

+#include <exception>
+
+int main()
+{
+  std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
+  ...
+
+  throw anything;
+}
+

+ The __verbose_terminate_handler function + obtains the name of the current exception, attempts to demangle + it, and prints it to stderr. If the exception is derived from + exception then the output from + what() will be included. +

+ Any replacement termination function is required to kill the + program without returning; this one calls abort. +

+ For example: +

+#include <exception>
+#include <stdexcept>
+
+struct argument_error : public std::runtime_error
+{
+  argument_error(const std::string& s): std::runtime_error(s) { }
+};
+
+int main(int argc)
+{
+  std::set_terminate(__gnu_cxx::__verbose_terminate_handler);
+  if (argc > 5)
+    throw argument_error(argc is greater than 5!);
+  else
+    throw argc;
+}
+

+ With the verbose terminate handler active, this gives: +

+   
+   % ./a.out
+   terminate called after throwing a `int'
+   Aborted
+   % ./a.out f f f f f f f f f f f
+   terminate called after throwing an instance of `argument_error'
+   what(): argc is greater than 5!
+   Aborted
+   
+   

+ The 'Aborted' line comes from the call to + abort(), of course. +

+ This is the default termination handler; nothing need be done to + use it. To go back to the previous silent death + method, simply include exception and + cstdlib, and call +

+     std::set_terminate(std::abort);
+   

+ After this, all calls to terminate will use + abort as the terminate handler. +

+ Note: the verbose terminate handler will attempt to write to + stderr. If your application closes stderr or redirects it to an + inappropriate location, + __verbose_terminate_handler will behave in + an unspecified manner. +

diff --git a/libstdc++-v3/doc/html/manual/test.html b/libstdc++-v3/doc/html/manual/test.html new file mode 100644 index 000000000..b346c422b --- /dev/null +++ b/libstdc++-v3/doc/html/manual/test.html @@ -0,0 +1,639 @@ + + +Test

+The libstdc++ testsuite includes testing for standard conformance, +regressions, ABI, and performance. +

+ The directory libsrcdir/testsuite contains the + individual test cases organized in sub-directories corresponding to + chapters of the C++ standard (detailed below), the dejagnu test + harness support files, and sources to various testsuite utilities + that are packaged in a separate testing library. +

+ All test cases for functionality required by the runtime components + of the C++ standard (ISO 14882) are files within the following + directories. +

+17_intro
+18_support
+19_diagnostics
+20_util
+21_strings
+22_locale
+23_containers
+25_algorithms
+26_numerics
+27_io
+28_regex
+29_atomics
+30_threads
+   

+ In addition, the following directories include test files: +

+tr1		  Tests for components as described by the Technical Report on Standard Library Extensions (TR1).
+backward	  Tests for backwards compatibility and deprecated features.
+demangle	  Tests for __cxa_demangle, the IA 64 C++ ABI demangler
+ext		  Tests for extensions.
+performance	  Tests for performance analysis, and performance regressions.
+   

+ Some directories don't have test files, but instead contain + auxiliary information: +

+config		  Files for the dejagnu test harness.
+lib		  Files for the dejagnu test harness.
+libstdc++*     	  Files for the dejagnu test harness.
+data		  Sample text files for testing input and output.
+util		  Files for libtestc++, utilities and testing routines.
+   

+ Within a directory that includes test files, there may be + additional subdirectories, or files. Originally, test cases + were appended to one file that represented a particular section + of the chapter under test, and was named accordingly. For + instance, to test items related to 21.3.6.1 - + basic_string::find [lib.string::find] in the standard, + the following was used: +

+21_strings/find.cc
+   

+ However, that practice soon became a liability as the test cases + became huge and unwieldy, and testing new or extended + functionality (like wide characters or named locales) became + frustrating, leading to aggressive pruning of test cases on some + platforms that covered up implementation errors. Now, the test + suite has a policy of one file, one test case, which solves the + above issues and gives finer grained results and more manageable + error debugging. As an example, the test case quoted above + becomes: +

+21_strings/basic_string/find/char/1.cc
+21_strings/basic_string/find/char/2.cc
+21_strings/basic_string/find/char/3.cc
+21_strings/basic_string/find/wchar_t/1.cc
+21_strings/basic_string/find/wchar_t/2.cc
+21_strings/basic_string/find/wchar_t/3.cc
+   

+ All new tests should be written with the policy of one test + case, one file in mind. +

+ In addition, there are some special names and suffixes that are + used within the testsuite to designate particular kinds of + tests. +

+ There are several options for running tests, including testing + the regression tests, testing a subset of the regression tests, + testing the performance tests, testing just compilation, testing + installed tools, etc. In addition, there is a special rule for + checking the exported symbols of the shared library. +

+ To debug the dejagnu test harness during runs, try invoking with a + specific argument to the variable RUNTESTFLAGS, as below. +

+make check-target-libstdc++-v3 RUNTESTFLAGS="-v"
+

+ or +

+make check-target-libstdc++-v3 RUNTESTFLAGS="-v -v"
+

+ To run a subset of the library tests, you will need to generate + the testsuite_files file by running + make testsuite_files in the + libbuilddir/testsuite directory, described + below. Edit the file to remove the tests you don't want and + then run the testsuite as normal. +

+ There are two ways to run on a simulator: set up DEJAGNU to point to a + specially crafted site.exp, or pass down --target_board flags. +

+ Example flags to pass down for various embedded builds are as follows: +

+      --target=powerpc-eabism (libgloss/sim)
+make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=powerpc-sim"
+
+--target=calmrisc32 (libgloss/sid)
+make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=calmrisc32-sid"
+
+--target=xscale-elf (newlib/sim)
+make check-target-libstdc++-v3 RUNTESTFLAGS="--target_board=arm-sim"
+

+ Also, here is an example of how to run the libstdc++ testsuite + for a multilibed build directory with different ABI settings: +

+make check-target-libstdc++-v3 RUNTESTFLAGS='--target_board \"unix{-mabi=32,,-mabi=64}\"'
+

+ You can run the tests with a compiler and library that have + already been installed. Make sure that the compiler (e.g., + g++) is in your PATH. If you are + using shared libraries, then you must also ensure that the + directory containing the shared version of libstdc++ is in your + LD_LIBRARY_PATH, or equivalent. If your GCC source + tree is at /path/to/gcc, then you can run the tests + as follows: +

+runtest --tool libstdc++ --srcdir=/path/to/gcc/libstdc++-v3/testsuite
+

+ The testsuite will create a number of files in the directory in + which you run this command,. Some of those files might use the + same name as files created by other testsuites (like the ones + for GCC and G++), so you should not try to run all the + testsuites in parallel from the same directory. +

+ In addition, there are some testing options that are mostly of + interest to library maintainers and system integrators. As such, + these tests may not work on all cpu and host combinations, and + may need to be executed in the + libbuilddir/testsuite directory. These + options include, but are not necessarily limited to, the + following: +

+   make testsuite_files
+   

+ Five files are generated that determine what test files + are run. These files are: +

+   make check-abi
+   

+ The library ABI can be tested. This involves testing the shared + library against an ABI-defining previous version of symbol + exports. +

+   make check-compile
+  

+ This rule compiles, but does not link or execute, the + testsuite_files test cases and displays the + output on stdout. +

+   make check-performance
+   

+ This rule runs through the + testsuite_files_performance test cases and + collects information for performance analysis and can be used to + spot performance regressions. Various timing information is + collected, as well as number of hard page faults, and memory + used. This is not run by default, and the implementation is in + flux. +

+ We are interested in any strange failures of the testsuite; + please email the main libstdc++ mailing list if you see + something odd or have questions. +

+ To run the libstdc++ test suite under the debug mode, edit + libstdc++-v3/scripts/testsuite_flags to add the + compile-time flag -D_GLIBCXX_DEBUG to the + result printed by the --build-cxx + option. Additionally, add the + -D_GLIBCXX_DEBUG_PEDANTIC flag to turn on + pedantic checking. The libstdc++ test suite should produce + precisely the same results under debug mode that it does under + release mode: any deviation indicates an error in either the + library or the test suite. +

+ The parallel + mode can be tested in much the same manner, substituting + -D_GLIBCXX_PARALLEL for + -D_GLIBCXX_DEBUG in the previous paragraph. +

+ Or, just run the testsuites with CXXFLAGS + set to -D_GLIBCXX_DEBUG or + -D_GLIBCXX_PARALLEL. +

+ The first step in making a new test case is to choose the correct + directory and file name, given the organization as previously + described. +

+ All files are copyright the FSF, and GPL'd: this is very + important. The first copyright year should correspond to the date + the file was checked in to SVN. +

+ As per the dejagnu instructions, always return 0 from main to + indicate success. +

+ A bunch of utility functions and classes have already been + abstracted out into the testsuite utility library, + libtestc++. To use this functionality, just include the + appropriate header file: the library or specific object files will + automatically be linked in as part of the testsuite run. +

+ For a test that needs to take advantage of the dejagnu test + harness, what follows below is a list of special keyword that + harness uses. Basically, a test case contains dg-keywords (see + dg.exp) indicating what to do and what kinds of behavior are to be + expected. New test cases should be written with the new style + DejaGnu framework in mind. +

+ To ease transition, here is the list of dg-keyword documentation + lifted from dg.exp. +

+# The currently supported options are:
+#
+# dg-prms-id N
+#	set prms_id to N
+#
+# dg-options "options ..." [{ target selector }]
+#	specify special options to pass to the tool (eg: compiler)
+#
+# dg-do do-what-keyword [{ target/xfail selector }]
+#	`do-what-keyword' is tool specific and is passed unchanged to
+#	${tool}-dg-test.  An example is gcc where `keyword' can be any of:
+#	preprocess|compile|assemble|link|run
+#	and will do one of: produce a .i, produce a .s, produce a .o,
+#	produce an a.out, or produce an a.out and run it (the default is
+#	compile).
+#
+# dg-error regexp comment [{ target/xfail selector } [{.|0|linenum}]]
+#	indicate an error message <regexp> is expected on this line
+#	(the test fails if it doesn't occur)
+#	Linenum=0 for general tool messages (eg: -V arg missing).
+#	"." means the current line.
+#
+# dg-warning regexp comment [{ target/xfail selector } [{.|0|linenum}]]
+#	indicate a warning message <regexp> is expected on this line
+#	(the test fails if it doesn't occur)
+#
+# dg-bogus regexp comment [{ target/xfail selector } [{.|0|linenum}]]
+#	indicate a bogus error message <regexp> use to occur here
+#	(the test fails if it does occur)
+#
+# dg-build regexp comment [{ target/xfail selector }]
+#	indicate the build use to fail for some reason
+#	(errors covered here include bad assembler generated, tool crashes,
+#	and link failures)
+#	(the test fails if it does occur)
+#
+# dg-excess-errors comment [{ target/xfail selector }]
+#	indicate excess errors are expected (any line)
+#	(this should only be used sparingly and temporarily)
+#
+# dg-output regexp [{ target selector }]
+#	indicate the expected output of the program is <regexp>
+#	(there may be multiple occurrences of this, they are concatenated)
+#
+# dg-final { tcl code }
+#	add some tcl code to be run at the end
+#	(there may be multiple occurrences of this, they are concatenated)
+#	(unbalanced braces must be \-escaped)
+#
+# "{ target selector }" is a list of expressions that determine whether the
+# test succeeds or fails for a particular target, or in some cases whether the
+# option applies for a particular target.  If the case of `dg-do' it specifies
+# whether the test case is even attempted on the specified target.
+#
+# The target selector is always optional.  The format is one of:
+#
+# { xfail *-*-* ... } - the test is expected to fail for the given targets
+# { target *-*-* ... } - the option only applies to the given targets
+#
+# At least one target must be specified, use *-*-* for "all targets".
+# At present it is not possible to specify both `xfail' and `target'.
+# "native" may be used in place of "*-*-*".
+
+Example 1: Testing compilation only
+// { dg-do compile }
+
+Example 2: Testing for expected warnings on line 36, which all targets fail
+// { dg-warning "string literals" "" { xfail *-*-* } 36
+
+Example 3: Testing for expected warnings on line 36
+// { dg-warning "string literals" "" { target *-*-* } 36
+
+Example 4: Testing for compilation errors on line 41
+// { dg-do compile }
+// { dg-error "no match for" "" { target *-*-* } 41 }
+
+Example 5: Testing with special command line settings, or without the
+use of pre-compiled headers, in particular the stdc++.h.gch file. Any
+options here will override the DEFAULT_CXXFLAGS and PCH_CXXFLAGS set
+up in the normal.exp file.
+// { dg-options "-O0" { target *-*-* } }
+

+ More examples can be found in the libstdc++-v3/testsuite/*/*.cc files. +

+ Underlying details of testing for conformance and regressions are + abstracted via the GNU Dejagnu package. This is similar to the + rest of GCC. +

This is information for those looking at making changes to the testsuite +structure, and/or needing to trace dejagnu's actions with --verbose. This +will not be useful to people who are "merely" adding new tests to the existing +structure. +

The first key point when working with dejagnu is the idea of a "tool". +Files, directories, and functions are all implicitly used when they are +named after the tool in use. Here, the tool will always be "libstdc++". +

The lib subdir contains support routines. The +lib/libstdc++.exp file ("support library") is loaded +automagically, and must explicitly load the others. For example, files can +be copied from the core compiler's support directory into lib. +

Some routines in lib/libstdc++.exp are callbacks, some are +our own. Callbacks must be prefixed with the name of the tool. To easily +distinguish the others, by convention our own routines are named "v3-*". +

The next key point when working with dejagnu is "test files". Any +directory whose name starts with the tool name will be searched for test files. +(We have only one.) In those directories, any .exp file is +considered a test file, and will be run in turn. Our main test file is called +normal.exp; it runs all the tests in testsuite_files using the +callbacks loaded from the support library. +

The config directory is searched for any particular "target +board" information unique to this library. This is currently unused and sets +only default variables. +

+

+ The testsuite directory also contains some files that implement + functionality that is intended to make writing test cases easier, + or to avoid duplication, or to provide error checking in a way that + is consistent across platforms and test harnesses. A stand-alone + executable, called abi_check, and a static + library called libtestc++ are + constructed. Both of these items are not installed, and only used + during testing. +

+ These files include the following functionality: +

diff --git a/libstdc++-v3/doc/html/manual/traits.html b/libstdc++-v3/doc/html/manual/traits.html new file mode 100644 index 000000000..4c04c7b15 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/traits.html @@ -0,0 +1,10 @@ + + +Traits

+

diff --git a/libstdc++-v3/doc/html/manual/using.html b/libstdc++-v3/doc/html/manual/using.html new file mode 100644 index 000000000..f9eeb59bd --- /dev/null +++ b/libstdc++-v3/doc/html/manual/using.html @@ -0,0 +1,15 @@ + + +Chapter 3. Using
diff --git a/libstdc++-v3/doc/html/manual/using_concurrency.html b/libstdc++-v3/doc/html/manual/using_concurrency.html new file mode 100644 index 000000000..a0ca2a651 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/using_concurrency.html @@ -0,0 +1,205 @@ + + +Concurrency

This section discusses issues surrounding the proper compilation + of multithreaded applications which use the Standard C++ + library. This information is GCC-specific since the C++ + standard does not address matters of multithreaded applications. +

All normal disclaimers aside, multithreaded C++ application are + only supported when libstdc++ and all user code was built with + compilers which report (via gcc/g++ -v ) the same thread + model and that model is not single. As long as your + final application is actually single-threaded, then it should be + safe to mix user code built with a thread model of + single with a libstdc++ and other C++ libraries built + with another thread model useful on the platform. Other mixes + may or may not work but are not considered supported. (Thus, if + you distribute a shared C++ library in binary form only, it may + be best to compile it with a GCC configured with + --enable-threads for maximal interchangeability and usefulness + with a user population that may have built GCC with either + --enable-threads or --disable-threads.) +

When you link a multithreaded application, you will probably + need to add a library or flag to g++. This is a very + non-standardized area of GCC across ports. Some ports support a + special flag (the spelling isn't even standardized yet) to add + all required macros to a compilation (if any such flags are + required then you must provide the flag for all compilations not + just linking) and link-library additions and/or replacements at + link time. The documentation is weak. Here is a quick summary + to display how ad hoc this is: On Solaris, both -pthreads and + -threads (with subtly different meanings) are honored. On OSF, + -pthread and -threads (with subtly different meanings) are + honored. On Linux/i386, -pthread is honored. On FreeBSD, + -pthread is honored. Some other ports use other switches. + AFAIK, none of this is properly documented anywhere other than + in ``gcc -dumpspecs'' (look at lib and cpp entries). +

+We currently use the SGI STL definition of thread safety. +

The library strives to be thread-safe when all of the following + conditions are met: +

  • The system's libc is itself thread-safe, +

  • + The compiler in use reports a thread model other than + 'single'. This can be tested via output from gcc + -v. Multi-thread capable versions of gcc output + something like this: +

    +%gcc -v
    +Using built-in specs.
    +...
    +Thread model: posix
    +gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)
    +

    Look for "Thread model" lines that aren't equal to "single."

  • + Requisite command-line flags are used for atomic operations + and threading. Examples of this include -pthread + and -march=native, although specifics vary + depending on the host environment. See Machine + Dependent Options. +

  • + An implementation of atomicity.h functions + exists for the architecture in question. See the internals documentation for more details. +

The user-code must guard against concurrent method calls which may + access any particular library object's state. Typically, the + application programmer may infer what object locks must be held + based on the objects referenced in a method call. Without getting + into great detail, here is an example which requires user-level + locks: +

+     library_class_a shared_object_a;
+
+     thread_main () {
+       library_class_b *object_b = new library_class_b;
+       shared_object_a.add_b (object_b);   // must hold lock for shared_object_a
+       shared_object_a.mutate ();          // must hold lock for shared_object_a
+     }
+
+     // Multiple copies of thread_main() are started in independent threads.

Under the assumption that object_a and object_b are never exposed to + another thread, here is an example that should not require any + user-level locks: +

+     thread_main () {
+       library_class_a object_a;
+       library_class_b *object_b = new library_class_b;
+       object_a.add_b (object_b);
+       object_a.mutate ();
+     } 

All library objects are safe to use in a multithreaded program as + long as each thread carefully locks out access by any other + thread while it uses any object visible to another thread, i.e., + treat library objects like any other shared resource. In general, + this requirement includes both read and write access to objects; + unless otherwise documented as safe, do not assume that two threads + may access a shared standard library object at the same time. +

This gets a bit tricky. Please read carefully, and bear with me. +

This section discusses issues surrounding the design of + multithreaded applications which use Standard C++ containers. + All information in this section is current as of the gcc 3.0 + release and all later point releases. Although earlier gcc + releases had a different approach to threading configuration and + proper compilation, the basic code design rules presented here + were similar. For information on all other aspects of + multithreading as it relates to libstdc++, including details on + the proper compilation of threaded code (and compatibility between + threaded and non-threaded code), see Chapter 17. +

Two excellent pages to read when working with the Standard C++ + containers and threads are + SGI's + http://www.sgi.com/tech/stl/thread_safety.html and + SGI's + http://www.sgi.com/tech/stl/Allocators.html. +

However, please ignore all discussions about the user-level + configuration of the lock implementation inside the STL + container-memory allocator on those pages. For the sake of this + discussion, libstdc++ configures the SGI STL implementation, + not you. This is quite different from how gcc pre-3.0 worked. + In particular, past advice was for people using g++ to + explicitly define _PTHREADS or other macros or port-specific + compilation options on the command line to get a thread-safe + STL. This is no longer required for any port and should no + longer be done unless you really know what you are doing and + assume all responsibility. +

Since the container implementation of libstdc++ uses the SGI + code, we use the same definition of thread safety as SGI when + discussing design. A key point that beginners may miss is the + fourth major paragraph of the first page mentioned above + (For most clients...), which points out that + locking must nearly always be done outside the container, by + client code (that'd be you, not us). There is a notable + exceptions to this rule. Allocators called while a container or + element is constructed uses an internal lock obtained and + released solely within libstdc++ code (in fact, this is the + reason STL requires any knowledge of the thread configuration). +

For implementing a container which does its own locking, it is + trivial to provide a wrapper class which obtains the lock (as + SGI suggests), performs the container operation, and then + releases the lock. This could be templatized to a certain + extent, on the underlying container and/or a locking + mechanism. Trying to provide a catch-all general template + solution would probably be more trouble than it's worth. +

The library implementation may be configured to use the + high-speed caching memory allocator, which complicates thread + safety issues. For all details about how to globally override + this at application run-time + see here. Also + useful are details + on allocator + options and capabilities. +

diff --git a/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html b/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html new file mode 100644 index 000000000..6ca06caa7 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/using_dynamic_or_shared.html @@ -0,0 +1,109 @@ + + +Linking

+ Or as close as it gets: freestanding. This is a minimal + configuration, with only partial support for the standard + library. Assume only the following header files can be used: +

+ In addition, throw in +

+ In the + C++0x dialect add +

  • + initializer_list +

  • + type_traits +

There exists a library that offers runtime support for + just these headers, and it is called + libsupc++.a. To use it, compile with gcc instead of g++, like so: +

+ gcc foo.cc -lsupc++ +

+ No attempt is made to verify that only the minimal subset + identified above is actually used at compile time. Violations + are diagnosed as undefined symbols at link time. +

+ If the only library built is the static library + (libstdc++.a), or if + specifying static linking, this section is can be skipped. But + if building or using a shared library + (libstdc++.so), then + additional location information will need to be provided. +

+ But how? +

+A quick read of the relevant part of the GCC + manual, Compiling + C++ Programs, specifies linking against a C++ + library. More details from the + GCC FAQ, + which states GCC does not, by default, specify a + location so that the dynamic linker can find dynamic libraries at + runtime. +

+ Users will have to provide this information. +

+ Methods vary for different platforms and different styles, and + are printed to the screen during installation. To summarize: +

  • + At runtime set LD_LIBRARY_PATH in your + environment correctly, so that the shared library for + libstdc++ can be found and loaded. Be certain that you + understand all of the other implications and behavior + of LD_LIBRARY_PATH first. +

  • + Compile the path to find the library at runtime into the + program. This can be done by passing certain options to + g++, which will in turn pass them on to + the linker. The exact format of the options is dependent on + which linker you use: +

    • + GNU ld (default on Linux): + -Wl,-rpath,destdir/lib +

    • + IRIX ld: + -Wl,-rpath,destdir/lib +

    • + Solaris ld: + -Wl,-Rdestdir/lib +

  • + Some linkers allow you to specify the path to the library by + setting LD_RUN_PATH in your environment + when linking. +

  • + On some platforms the system administrator can configure the + dynamic linker to always look for libraries in + destdir/lib, for example + by using the ldconfig utility on Linux + or the crle utility on Solaris. This is a + system-wide change which can make the system unusable so if you + are unsure then use one of the other methods described above. +

+ Use the ldd utility on the linked executable + to show + which libstdc++.so + library the system will get at runtime. +

+ A libstdc++.la file is + also installed, for use with Libtool. If you use Libtool to + create your executables, these details are taken care of for + you. +

diff --git a/libstdc++-v3/doc/html/manual/using_exceptions.html b/libstdc++-v3/doc/html/manual/using_exceptions.html new file mode 100644 index 000000000..d1e2693ab --- /dev/null +++ b/libstdc++-v3/doc/html/manual/using_exceptions.html @@ -0,0 +1,307 @@ + + +Exceptions

+The C++ language provides language support for stack unwinding +with try and catch blocks and +the throw keyword. +

+These are very powerful constructs, and require some thought when +applied to the standard library in order to yield components that work +efficiently while cleaning up resources when unexpectedly killed via +exceptional circumstances. +

+Two general topics of discussion follow: +exception neutrality and exception safety. +

+ Simply put, once thrown an exception object should continue in + flight unless handled explicitly. In practice, this means + propagating exceptions should not be swallowed in + gratuitous catch(...) blocks. Instead, + matching try and catch + blocks should have specific catch handlers and allow un-handed + exception objects to propagate. If a + terminating catch(...) blocks exist then it + should end with a throw to re-throw the current + exception. +

+ Why do this? +

+ By allowing exception objects to propagate, a more flexible + approach to error handling is made possible (although not + required.) Instead of dealing with an error immediately, one can + allow the exception to propagate up until sufficient context is + available and the choice of exiting or retrying can be made in an + informed manner. +

+ Unfortunately, this tends to be more of a guideline than a strict + rule as applied to the standard library. As such, the following is + a list of known problem areas where exceptions are not propagated. +

+ C++ is a language that strives to be as efficient as is possible + in delivering features. As such, considerable care is used by both + language implementer and designers to make sure unused features + not impose hidden or unexpected costs. The GNU system tries to be + as flexible and as configurable as possible. So, it should come as + no surprise that GNU C++ provides an optional language extension, + spelled -fno-exceptions, as a way to excise the + implicitly generated magic necessary to + support try and catch blocks + and thrown objects. (Language support + for -fno-exceptions is documented in the GNU + GCC manual.) +

Before detailing the library support + for -fno-exceptions, first a passing note on + the things lost when this flag is used: it will break exceptions + trying to pass through code compiled + with -fno-exceptions whether or not that code + has any try or catch + constructs. If you might have some code that throws, you shouldn't + use -fno-exceptions. If you have some code that + uses try or catch, you + shouldn't use -fno-exceptions. +

+ And what it to be gained, tinkering in the back alleys with a + language like this? Exception handling overhead can be measured + in the size of the executable binary, and varies with the + capabilities of the underlying operating system and specific + configuration of the C++ compiler. On recent hardware with GNU + system software of the same age, the combined code and data size + overhead for enabling exception handling is around 7%. Of course, + if code size is of singular concern than using the appropriate + optimizer setting with exception handling enabled + (ie, -Os -fexceptions) may save up to twice + that, and preserve error checking. +

+ So. Hell bent, we race down the slippery track, knowing the brakes + are a little soft and that the right front wheel has a tendency to + wobble at speed. Go on: detail the standard library support + for -fno-exceptions. +

+ In sum, valid C++ code with exception handling is transformed into + a dialect without exception handling. In detailed steps: all use + of the C++ + keywords try, catch, + and throw in the standard library have been + permanently replaced with the pre-processor controlled equivalents + spelled __try, __catch, + and __throw_exception_again. They are defined + as follows. +

+#ifdef __EXCEPTIONS
+# define __try      try
+# define __catch(X) catch(X)
+# define __throw_exception_again throw
+#else
+# define __try      if (true)
+# define __catch(X) if (false)
+# define __throw_exception_again
+#endif
+

+ In addition, for every object derived from + class exception, there exists a corresponding + function with C language linkage. An example: +

+#ifdef __EXCEPTIONS
+  void __throw_bad_exception(void)
+  { throw bad_exception(); }
+#else
+  void __throw_bad_exception(void)
+  { abort(); }
+#endif
+

+ The last language feature needing to be transformed + by -fno-exceptions is treatment of exception + specifications on member functions. Fortunately, the compiler deals + with this by ignoring exception specifications and so no alternate + source markup is needed. +

+ By using this combination of language re-specification by the + compiler, and the pre-processor tricks and the functional + indirection layer for thrown exception objects by the library, + libstdc++ files can be compiled + with -fno-exceptions. +

+ User code that uses C++ keywords + like throw, try, + and catch will produce errors even if the user + code has included libstdc++ headers and is using constructs + like basic_iostream. Even though the standard + library has been transformed, user code may need modification. User + code that attempts or expects to do error checking on standard + library components compiled with exception handling disabled should + be evaluated and potentially made conditional. +

+ Some issues remain with this approach (see bugzilla entry + 25191). Code paths are not equivalent, in + particular catch blocks are not evaluated. Also + problematic are throw expressions expecting a + user-defined throw handler. Known problem areas in the standard + library include using an instance + of basic_istream + with exceptions set to specific + ios_base::iostate conditions, or + cascading catch blocks that dispatch error + handling or recovery efforts based on the type of exception object + thrown. +

+ Oh, and by the way: none of this hackery is at all + special. (Although perhaps well-deserving of a raised eyebrow.) + Support continues to evolve and may change in the future. Similar + and even additional techniques are used in other C++ libraries and + compilers. +

+ C++ hackers with a bent for language and control-flow purity have + been successfully consoled by grizzled C veterans lamenting the + substitution of the C language keyword + const with the uglified + doppelganger __const. +

diff --git a/libstdc++-v3/doc/html/manual/using_headers.html b/libstdc++-v3/doc/html/manual/using_headers.html new file mode 100644 index 000000000..fde253e36 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/using_headers.html @@ -0,0 +1,104 @@ + + +Headers

+ The C++ standard specifies the entire set of header files that + must be available to all hosted implementations. Actually, the + word "files" is a misnomer, since the contents of the + headers don't necessarily have to be in any kind of external + file. The only rule is that when one #include's a + header, the contents of that header become available, no matter + how. +

+ That said, in practice files are used. +

+ There are two main types of include files: header files related + to a specific version of the ISO C++ standard (called Standard + Headers), and all others (TR1, C++ ABI, and Extensions). +

+ Two dialects of standard headers are supported, corresponding to + the 1998 standard as updated for 2003, and the draft of the + upcoming 200x standard. +

+ C++98/03 include files. These are available in the default compilation mode, i.e. -std=c++98 or -std=gnu++98. +



+C++0x include files. These are only available in C++0x compilation +mode, i.e. -std=c++0x or -std=gnu++0x. +



+ In addition, TR1 includes as: +



Decimal floating-point arithmetic is available if the C++ +compiler supports scalar decimal floating-point types defined via +__attribute__((mode(SD|DD|LD))). +


+ Also included are files for the C++ ABI interface: +


+ And a large variety of extensions. +





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. +

How 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:

+g++ -v hello.cc
+
+#include <...> search starts here:
+ /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0
+...
+End of search list.
+

Then, create a precompiled header file with the same flags that +will be used to compile other projects.

+g++ -Winvalid-pch -x c++-header -g -O2 -o ./stdc++.h.gch /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/x86_64-unknown-linux-gnu/bits/stdc++.h
+

The resulting file will be quite large: the current size is around +thirty megabytes.

How to use the resulting file.

+g++ -I. -include stdc++.h  -H -g -O2 hello.cc
+

Verification that the PCH file is being used is easy:

+g++ -Winvalid-pch -I. -include stdc++.h -H -g -O2 hello.cc -o test.exe
+! ./stdc++.h.gch
+. /mnt/share/bld/H-x86-gcc.20071201/include/c++/4.3.0/iostream
+. /mnt/share/bld/H-x86-gcc.20071201include/c++/4.3.0/string
+

The exclamation point to the left of the stdc++.h.gch listing means that the generated PCH file was used, and thus the

Detailed information about creating precompiled header files can be found in the GCC documentation. +

diff --git a/libstdc++-v3/doc/html/manual/using_macros.html b/libstdc++-v3/doc/html/manual/using_macros.html new file mode 100644 index 000000000..3e124e909 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/using_macros.html @@ -0,0 +1,77 @@ + + +Macros

+ All library macros begin with _GLIBCXX_. +

+ Furthermore, all pre-processor macros, switches, and + configuration options are gathered in the + file c++config.h, which + is generated during the libstdc++ configuration and build + process. This file is then included when needed by files part of + the public libstdc++ API, like <ios>. Most of these macros + should not be used by consumers of libstdc++, and are reserved + for internal implementation use. These macros cannot + be redefined. +

+ A select handful of macros control libstdc++ extensions and extra + features, or provide versioning information for the API. Only + those macros listed below are offered for consideration by the + general public. +

Below is the macro which users may check for library version + information.

Below are the macros which users may change with #define/#undef or + with -D/-U compiler flags. The default state of the symbol is + listed.

Configurable (or Not configurable) means + that the symbol is initially chosen (or not) based on + --enable/--disable options at library build and configure time + (documented here), with the + various --enable/--disable choices being translated to + #define/#undef). +

ABI means that changing from the default value may + mean changing the ABI of compiled code. In other words, these + choices control code which has already been compiled (i.e., in a + binary such as libstdc++.a/.so). If you explicitly #define or + #undef these macros, the headers may see different code + paths, but the libraries which you link against will not. + Experimenting with different values with the expectation of + consistent linkage requires changing the config headers before + building/installing the library. +

_GLIBCXX_USE_DEPRECATED

+ Defined by default. Not configurable. ABI-changing. Turning this off + removes older ARM-style iostreams code, and other anachronisms + from the API. This macro is dependent on the version of the + standard being tracked, and as a result may give different results for + -std=c++98 and -std=c++0x. This may + be useful in updating old C++ code which no longer meet the + requirements of the language, or for checking current code + against new language standards. +

_GLIBCXX_FORCE_NEW

+ Undefined by default. When defined, memory allocation and + allocators controlled by libstdc++ call operator new/delete + without caching and pooling. Configurable via + --enable-libstdcxx-allocator. ABI-changing. +

_GLIBCXX_CONCEPT_CHECKS

+ Undefined by default. Configurable via + --enable-concept-checks. When defined, performs + compile-time checking on certain template instantiations to + detect violations of the requirements of the standard. This + is described in more detail here. +

_GLIBCXX_DEBUG

+ Undefined by default. When defined, compiles user code using + the debug mode. +

_GLIBCXX_DEBUG_PEDANTIC

+ Undefined by default. When defined while compiling with + the debug mode, makes + the debug mode extremely picky by making the use of libstdc++ + extensions and libstdc++-specific behavior into errors. +

_GLIBCXX_PARALLEL

Undefined by default. When defined, compiles user code + using the parallel + mode. +

_GLIBCXX_PROFILE

Undefined by default. When defined, compiles user code + using the profile + mode. +

diff --git a/libstdc++-v3/doc/html/manual/using_namespaces.html b/libstdc++-v3/doc/html/manual/using_namespaces.html new file mode 100644 index 000000000..ffd6c6f63 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/using_namespaces.html @@ -0,0 +1,61 @@ + + +Namespaces
diff --git a/libstdc++-v3/doc/html/manual/utilities.html b/libstdc++-v3/doc/html/manual/utilities.html new file mode 100644 index 000000000..e41e994d2 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/utilities.html @@ -0,0 +1,17 @@ + + +Chapter 6.  Utilities
-- cgit v1.2.3