Skip to content

Commit

Permalink
Define _LIBCPP_REMOVE_TRANSITIVE_INCLUDES (#1987)
Browse files Browse the repository at this point in the history
Defining `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` stops libc++'s headers
from including other libc++ headers except as defined in the language
standard. This is a good idea because it will catch situations where
a header isn't explicitly included, which will cause build errors
with other standard libs like GCC's and MSVC's.
  • Loading branch information
snej authored Mar 28, 2024
1 parent 9329ea1 commit 294c3f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ endif()
add_definitions(
-DCMAKE # Let the source know this is a CMAKE build
-D__STDC_FORMAT_MACROS # Enables printf format macros for variable sized types (e.g. size_t)
-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES # Stop libc++ headers from including extra headers

)

if(BUILD_ENTERPRISE)
Expand Down
7 changes: 7 additions & 0 deletions Xcode/xcconfigs/Project.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ PRODUCT_NAME = $(TARGET_NAME)

ALWAYS_SEARCH_USER_PATHS = NO

// defining `_LIBCPP_REMOVE_TRANSITIVE_INCLUDES` stops libc++'s headers from including other
// libc++ headers except as defined in the language standard. This is a good idea because it will
// catch situations where a header isn't explicitly included, which will cause build errors with
// other standard libs like GCC's and MSVC's.
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _LIBCPP_REMOVE_TRANSITIVE_INCLUDES


CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = YES // range-check C++ STL containers
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = NO // don't flag int over/underflows

Expand Down
2 changes: 1 addition & 1 deletion vendor/fleece

0 comments on commit 294c3f8

Please sign in to comment.