[libcxx-commits] [PATCH] D145798: [libc++] Disables transitive includes in library.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 10 08:34:19 PST 2023


Mordante created this revision.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

I noticed this wile investigating https://llvm.org/PR61314


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145798

Files:
  libcxx/include/__config


Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -273,6 +273,14 @@
 #    define _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
 #  endif
 
+// Make sure the library can be build without transitive includes. This makes
+// it easier to upgrade the library to a newer language standard without build
+// errors. Since users are allowed to define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
+// it can't be set as a compiler flag in CMake.
+#  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && defined(_LIBCPP_BUILDING_LIBRARY)
+#    define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES
+#  endif
+
 // Need to detect which libc we're using if we're on Linux.
 #  if defined(__linux__)
 #    include <features.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145798.504158.patch
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230310/31eb8c05/attachment-0001.bin>


More information about the libcxx-commits mailing list