Skip to content

Commit ef4f479

Browse files
martinlichtldionne
andauthored
[libc++] Documentation for _LIBCPP_REMOVE_TRANSITIVE_INCLUDES (#130560)
Closes #130486 --------- Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
1 parent 8f3f93c commit ef4f479

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

libcxx/docs/UserDocumentation.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,28 @@ enable or disable extended libc++ behavior.
128128
replacement scenarios from working, e.g. replacing `operator new` and
129129
expecting a non-replaced `operator new[]` to call the replaced `operator new`.
130130

131+
**_LIBCPP_REMOVE_TRANSITIVE_INCLUDES**:
132+
When this macro is defined, the standard library headers will adhere to a
133+
stricter policy regarding the (transitive) inclusion of other standard library
134+
headers, only guaranteeing to provide those definitions explicitly mandated by
135+
the standard. Please notice that defining this macro might break existing codebases
136+
that implicitly rely on standard headers providing definitions not explicitly
137+
required by the standard.
138+
139+
The primary motivation for this configuration macro is to improve compilation
140+
times. In most standard library implementations, header files include more
141+
definitions than officially required because the implementation details give rise
142+
to internal dependencies. The common practice is to have the standard headers
143+
internally include other standard headers, but this generally results in
144+
increased compilation overhead. This configuration option attempts to mitigate
145+
this problem by avoiding such unnecessary inclusions. Compiling
146+
a codebase with this macro may improve portability by identifying
147+
missing standard header inclusions.
148+
149+
However, be aware that enabling this macro may lead to breakages
150+
when updating to a newer version of the library, since transitive includes
151+
that your code was previously relying on may have been removed.
152+
131153
**_LIBCPP_DISABLE_DEPRECATION_WARNINGS**:
132154
This macro disables warnings when using deprecated components. For example,
133155
using `std::auto_ptr` when compiling in C++11 mode will normally trigger a

0 commit comments

Comments
 (0)