Directory Layout and Source Conventions

The libstdc++-v3 directory in the GCC sources 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 <backward/hash_map>. 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, in theory (there are some exceptions).
include/debug, include/parallel, and include/profile
Headers that implement the Debug Mode, Parallel Mode, and Profile Mode extensions.
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.
src/c++98
Source files compiled using -std=gnu++98.
src/c++11
Source files compiled using -std=gnu++11.
src/filesystem
Source files for the Filesystem TS.
src/shared
Source code included by other files under both src/c++98 and src/c++11
testsuites/[backward, demangle, ext, performance, thread, 17_* to 30_*]
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.

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/allocator
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 need to be careful not to collide with names in its bits/ directory. For example <bits/std_mutex.h> has to be renamed from <bits/mutex.h>. Another solution would be to 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.