[libcxx-commits] [libcxx] Solves llvm/llvm-project#130486 (PR #130560)

Martin Licht via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 10 01:10:41 PDT 2025


https://github.com/martinlicht created https://github.com/llvm/llvm-project/pull/130560

Add _LIBCPP_REMOVE_TRANSITIVE_INCLUDES to the list of configuration macros

>From a705cfc897ae392e1d754e29d782914b2c04c592 Mon Sep 17 00:00:00 2001
From: Martin Licht <37779541+martinlicht at users.noreply.github.com>
Date: Mon, 10 Mar 2025 09:04:31 +0100
Subject: [PATCH] Update UserDocumentation.rst

Add _LIBCPP_REMOVE_TRANSITIVE_INCLUDES to the list of configuration macros
---
 libcxx/docs/UserDocumentation.rst | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libcxx/docs/UserDocumentation.rst b/libcxx/docs/UserDocumentation.rst
index 2c1bc1373659c..b55651a62ec5e 100644
--- a/libcxx/docs/UserDocumentation.rst
+++ b/libcxx/docs/UserDocumentation.rst
@@ -128,6 +128,24 @@ enable or disable extended libc++ behavior.
   replacement scenarios from working, e.g. replacing `operator new` and
   expecting a non-replaced `operator new[]` to call the replaced `operator new`.
 
+**_LIBCPP_REMOVE_TRANSITIVE_INCLUDES**:
+  When this macro is defined, the standard library headers will adhere to a
+  stricter policy regarding the (transitive) inclusion of other standard library
+  headers, only guaranteeing to provide those definitions explicitly mandated by
+  the standard. Please notice that defining this macro might break any existing
+  codebase that implicitly relies on standard headers providing any definitions
+  not explicitly required by the standard.
+
+  The primary motivation for this configuration macro is to improve compilation
+  times. In most standard library implementations, header files include more
+  definitions than officially required because the implementation details give rise
+  to internal dependencies. The common practice is to have the standard headers
+  internally include other standard headers, but this generally results in
+  increased compilation overhead. This configuration option attempts to mitigate
+  this problem by avoiding such unnecessary inclusions. In addition, compiling
+  a codebase with this macro may improve maintainability by identifying
+  missing standard header inclusions.
+
 **_LIBCPP_DISABLE_DEPRECATION_WARNINGS**:
   This macro disables warnings when using deprecated components. For example,
   using `std::auto_ptr` when compiling in C++11 mode will normally trigger a



More information about the libcxx-commits mailing list