[libcxx-commits] [libcxx] [libc++] Make the __availability header a sub-header of __config (PR #93083)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed May 22 11:16:21 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Louis Dionne (ldionne)
<details>
<summary>Changes</summary>
In essence, this header has always been related to configuration of
the library but we didn't want to put it inside <__config> due to
complexity reasons. Now that we have sub-headers in <__config>, we
can move <__availability> to it and stop including it everywhere since
we already obtain the required macros via <__config>.
---
Patch is 49.57 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/93083.diff
62 Files Affected:
- (modified) libcxx/include/CMakeLists.txt (+4-1)
- (modified) libcxx/include/__atomic/atomic_base.h (-1)
- (modified) libcxx/include/__atomic/atomic_flag.h (-1)
- (modified) libcxx/include/__atomic/atomic_sync.h (-1)
- (modified) libcxx/include/__charconv/to_chars_floating_point.h (-1)
- (modified) libcxx/include/__chrono/file_clock.h (-1)
- (modified) libcxx/include/__config (+4-191)
- (added) libcxx/include/__configuration/abi.h (+147)
- (renamed) libcxx/include/__configuration/availability.h (+5-4)
- (added) libcxx/include/__configuration/compiler.h (+51)
- (added) libcxx/include/__configuration/platform.h (+54)
- (modified) libcxx/include/__exception/exception_ptr.h (-1)
- (modified) libcxx/include/__expected/bad_expected_access.h (-1)
- (modified) libcxx/include/__filesystem/directory_entry.h (-1)
- (modified) libcxx/include/__filesystem/directory_iterator.h (-1)
- (modified) libcxx/include/__filesystem/filesystem_error.h (-1)
- (modified) libcxx/include/__filesystem/operations.h (-1)
- (modified) libcxx/include/__filesystem/path.h (-1)
- (modified) libcxx/include/__filesystem/path_iterator.h (-1)
- (modified) libcxx/include/__filesystem/recursive_directory_iterator.h (-1)
- (modified) libcxx/include/__filesystem/u8path.h (-1)
- (modified) libcxx/include/__functional/function.h (-1)
- (modified) libcxx/include/__fwd/memory_resource.h (-1)
- (modified) libcxx/include/__fwd/string.h (-1)
- (modified) libcxx/include/__memory_resource/memory_resource.h (-1)
- (modified) libcxx/include/__memory_resource/monotonic_buffer_resource.h (-1)
- (modified) libcxx/include/__memory_resource/polymorphic_allocator.h (-1)
- (modified) libcxx/include/__memory_resource/synchronized_pool_resource.h (-1)
- (modified) libcxx/include/__memory_resource/unsynchronized_pool_resource.h (-1)
- (modified) libcxx/include/__ostream/print.h (-1)
- (modified) libcxx/include/__stop_token/stop_callback.h (-1)
- (modified) libcxx/include/__stop_token/stop_source.h (-1)
- (modified) libcxx/include/__stop_token/stop_state.h (-1)
- (modified) libcxx/include/__stop_token/stop_token.h (-1)
- (modified) libcxx/include/__thread/jthread.h (-1)
- (modified) libcxx/include/__thread/poll_with_backoff.h (-1)
- (modified) libcxx/include/__verbose_abort (-1)
- (modified) libcxx/include/barrier (-1)
- (modified) libcxx/include/condition_variable (-1)
- (modified) libcxx/include/deque (-1)
- (modified) libcxx/include/forward_list (-1)
- (modified) libcxx/include/fstream (-1)
- (modified) libcxx/include/latch (-1)
- (modified) libcxx/include/list (-1)
- (modified) libcxx/include/map (-1)
- (modified) libcxx/include/module.modulemap (+4-4)
- (modified) libcxx/include/optional (-1)
- (modified) libcxx/include/print (-1)
- (modified) libcxx/include/regex (-1)
- (modified) libcxx/include/semaphore (-1)
- (modified) libcxx/include/set (-1)
- (modified) libcxx/include/sstream (-1)
- (modified) libcxx/include/unordered_map (-1)
- (modified) libcxx/include/unordered_set (-1)
- (modified) libcxx/include/variant (-1)
- (modified) libcxx/include/vector (-1)
- (modified) libcxx/include/version (-1)
- (modified) libcxx/src/optional.cpp (-1)
- (modified) libcxx/src/ostream.cpp (-1)
- (modified) libcxx/test/libcxx/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp (+1-1)
- (modified) libcxx/utils/generate_feature_test_macro_components.py (-1)
- (modified) libcxx/utils/generate_iwyu_mapping.py (+2)
``````````diff
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 01e9c247560ca..39fae8e2dd669 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -232,7 +232,6 @@ set(files
__atomic/is_always_lock_free.h
__atomic/kill_dependency.h
__atomic/memory_order.h
- __availability
__bit/bit_cast.h
__bit/bit_ceil.h
__bit/bit_floor.h
@@ -327,6 +326,10 @@ set(files
__concepts/totally_ordered.h
__condition_variable/condition_variable.h
__config
+ __configuration/abi.h
+ __configuration/availability.h
+ __configuration/compiler.h
+ __configuration/platform.h
__coroutine/coroutine_handle.h
__coroutine/coroutine_traits.h
__coroutine/noop_coroutine_handle.h
diff --git a/libcxx/include/__atomic/atomic_base.h b/libcxx/include/__atomic/atomic_base.h
index e9badccc25a62..d7a5b99b54691 100644
--- a/libcxx/include/__atomic/atomic_base.h
+++ b/libcxx/include/__atomic/atomic_base.h
@@ -14,7 +14,6 @@
#include <__atomic/cxx_atomic_impl.h>
#include <__atomic/is_always_lock_free.h>
#include <__atomic/memory_order.h>
-#include <__availability>
#include <__config>
#include <__memory/addressof.h>
#include <__type_traits/is_integral.h>
diff --git a/libcxx/include/__atomic/atomic_flag.h b/libcxx/include/__atomic/atomic_flag.h
index 3ec3366ecaaf9..00b157cdff78b 100644
--- a/libcxx/include/__atomic/atomic_flag.h
+++ b/libcxx/include/__atomic/atomic_flag.h
@@ -13,7 +13,6 @@
#include <__atomic/contention_t.h>
#include <__atomic/cxx_atomic_impl.h>
#include <__atomic/memory_order.h>
-#include <__availability>
#include <__chrono/duration.h>
#include <__config>
#include <__memory/addressof.h>
diff --git a/libcxx/include/__atomic/atomic_sync.h b/libcxx/include/__atomic/atomic_sync.h
index e583dca38c4c7..bd628b09cc62d 100644
--- a/libcxx/include/__atomic/atomic_sync.h
+++ b/libcxx/include/__atomic/atomic_sync.h
@@ -12,7 +12,6 @@
#include <__atomic/contention_t.h>
#include <__atomic/cxx_atomic_impl.h>
#include <__atomic/memory_order.h>
-#include <__availability>
#include <__chrono/duration.h>
#include <__config>
#include <__memory/addressof.h>
diff --git a/libcxx/include/__charconv/to_chars_floating_point.h b/libcxx/include/__charconv/to_chars_floating_point.h
index 08720e1078852..118f316b21a10 100644
--- a/libcxx/include/__charconv/to_chars_floating_point.h
+++ b/libcxx/include/__charconv/to_chars_floating_point.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H
#define _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H
-#include <__availability>
#include <__charconv/chars_format.h>
#include <__charconv/to_chars_result.h>
#include <__config>
diff --git a/libcxx/include/__chrono/file_clock.h b/libcxx/include/__chrono/file_clock.h
index 7d25729fec013..4dd3f88ce5ba4 100644
--- a/libcxx/include/__chrono/file_clock.h
+++ b/libcxx/include/__chrono/file_clock.h
@@ -10,7 +10,6 @@
#ifndef _LIBCPP___CHRONO_FILE_CLOCK_H
#define _LIBCPP___CHRONO_FILE_CLOCK_H
-#include <__availability>
#include <__chrono/duration.h>
#include <__chrono/system_clock.h>
#include <__chrono/time_point.h>
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 104a244cc82cc..0ba192c4df6f3 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -11,41 +11,17 @@
#define _LIBCPP___CONFIG
#include <__config_site>
+#include <__configuration/abi.h>
+#include <__configuration/availability.h>
+#include <__configuration/compiler.h>
+#include <__configuration/platform.h>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
# pragma GCC system_header
#endif
-#if defined(__apple_build_version__)
-// Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403)
-# define _LIBCPP_COMPILER_CLANG_BASED
-# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000)
-#elif defined(__clang__)
-# define _LIBCPP_COMPILER_CLANG_BASED
-# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
-#elif defined(__GNUC__)
-# define _LIBCPP_COMPILER_GCC
-# define _LIBCPP_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
-#endif
-
#ifdef __cplusplus
-// Warn if a compiler version is used that is not supported anymore
-// LLVM RELEASE Update the minimum compiler versions
-# if defined(_LIBCPP_CLANG_VER)
-# if _LIBCPP_CLANG_VER < 1700
-# warning "Libc++ only supports Clang 17 and later"
-# endif
-# elif defined(_LIBCPP_APPLE_CLANG_VER)
-# if _LIBCPP_APPLE_CLANG_VER < 1500
-# warning "Libc++ only supports AppleClang 15 and later"
-# endif
-# elif defined(_LIBCPP_GCC_VER)
-# if _LIBCPP_GCC_VER < 1300
-# warning "Libc++ only supports GCC 13 and later"
-# endif
-# endif
-
// The attributes supported by clang are documented at https://clang.llvm.org/docs/AttributeReference.html
// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
@@ -79,135 +55,6 @@
# endif // _LIBCPP_STD_VER
// NOLINTEND(libcpp-cpp-version-check)
-# if defined(__ELF__)
-# define _LIBCPP_OBJECT_FORMAT_ELF 1
-# elif defined(__MACH__)
-# define _LIBCPP_OBJECT_FORMAT_MACHO 1
-# elif defined(_WIN32)
-# define _LIBCPP_OBJECT_FORMAT_COFF 1
-# elif defined(__wasm__)
-# define _LIBCPP_OBJECT_FORMAT_WASM 1
-# elif defined(_AIX)
-# define _LIBCPP_OBJECT_FORMAT_XCOFF 1
-# else
-// ... add new file formats here ...
-# endif
-
-// ABI {
-
-# if _LIBCPP_ABI_VERSION >= 2
-// Change short string representation so that string data starts at offset 0,
-// improving its alignment in some cases.
-# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-// Fix deque iterator type in order to support incomplete types.
-# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
-// Fix undefined behavior in how std::list stores its linked nodes.
-# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
-// Fix undefined behavior in how __tree stores its end and parent nodes.
-# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
-// Fix undefined behavior in how __hash_table stores its pointer types.
-# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
-# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
-# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
-// Override the default return value of exception::what() for bad_function_call::what()
-// with a string that is specific to bad_function_call (see http://wg21.link/LWG2233).
-// This is an ABI break on platforms that sign and authenticate vtable function pointers
-// because it changes the mangling of the virtual function located in the vtable, which
-// changes how it gets signed.
-# define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
-// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
-# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
-// Give reverse_iterator<T> one data member of type T, not two.
-// Also, in C++17 and later, don't derive iterator types from std::iterator.
-# define _LIBCPP_ABI_NO_ITERATOR_BASES
-// Use the smallest possible integer type to represent the index of the variant.
-// Previously libc++ used "unsigned int" exclusively.
-# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
-// Unstable attempt to provide a more optimized std::function
-# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
-// All the regex constants must be distinct and nonzero.
-# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
-// Re-worked external template instantiations for std::string with a focus on
-// performance and fast-path inlining.
-# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
-// Enable clang::trivial_abi on std::unique_ptr.
-# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
-// Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr
-# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
-// std::random_device holds some state when it uses an implementation that gets
-// entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this
-// implementation to another one on a platform that has already shipped
-// std::random_device, one needs to retain the same object layout to remain ABI
-// compatible. This switch removes these workarounds for platforms that don't care
-// about ABI compatibility.
-# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT
-// Don't export the legacy __basic_string_common class and its methods from the built library.
-# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
-// Don't export the legacy __vector_base_common class and its methods from the built library.
-# define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON
-// According to the Standard, `bitset::operator[] const` returns bool
-# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
-// Fix the implementation of CityHash used for std::hash<fundamental-type>.
-// This is an ABI break because `std::hash` will return a different result,
-// which means that hashing the same object in translation units built against
-// different versions of libc++ can return inconsistent results. This is especially
-// tricky since std::hash is used in the implementation of unordered containers.
-//
-// The incorrect implementation of CityHash has the problem that it drops some
-// bits on the floor.
-# define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION
-// Remove the base 10 implementation of std::to_chars from the dylib.
-// The implementation moved to the header, but we still export the symbols from
-// the dylib for backwards compatibility.
-# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
-// Define std::array/std::string_view iterators to be __wrap_iters instead of raw
-// pointers, which prevents people from relying on a non-portable implementation
-// detail. This is especially useful because enabling bounded iterators hardening
-// requires code not to make these assumptions.
-# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
-# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
-# elif _LIBCPP_ABI_VERSION == 1
-# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
-// Enable compiling copies of now inline methods into the dylib to support
-// applications compiled against older libraries. This is unnecessary with
-// COFF dllexport semantics, since dllexport forces a non-inline definition
-// of inline functions to be emitted anyway. Our own non-inline copy would
-// conflict with the dllexport-emitted copy, so we disable it. For XCOFF,
-// the linker will take issue with the symbols in the shared object if the
-// weak inline methods get visibility (such as from -fvisibility-inlines-hidden),
-// so disable it.
-# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
-# endif
-// Feature macros for disabling pre ABI v1 features. All of these options
-// are deprecated.
-# if defined(__FreeBSD__) && __FreeBSD__ < 14
-# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
-# endif
-# endif
-
-// We had some bugs where we use [[no_unique_address]] together with construct_at,
-// which causes UB as the call on construct_at could write to overlapping subobjects
-//
-// https://github.com/llvm/llvm-project/issues/70506
-// https://github.com/llvm/llvm-project/issues/70494
-//
-// To fix the bug we had to change the ABI of some classes to remove [[no_unique_address]] under certain conditions.
-// The macro below is used for all classes whose ABI have changed as part of fixing these bugs.
-# define _LIBCPP_ABI_LLVM18_NO_UNIQUE_ADDRESS __attribute__((__abi_tag__("llvm18_nua")))
-
-// Changes the iterator type of select containers (see below) to a bounded iterator that keeps track of whether it's
-// within the bounds of the original container and asserts it on every dereference.
-//
-// ABI impact: changes the iterator type of the relevant containers.
-//
-// Supported containers:
-// - `span`;
-// - `string_view`;
-// - `array`.
-// #define _LIBCPP_ABI_BOUNDED_ITERATORS
-
-// } ABI
-
// HARDENING {
// TODO(hardening): deprecate this in LLVM 19.
@@ -411,31 +258,10 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM
# endif
-// Need to detect which libc we're using if we're on Linux.
-# if defined(__linux__)
-# include <features.h>
-# if defined(__GLIBC_PREREQ)
-# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
-# else
-# define _LIBCPP_GLIBC_PREREQ(a, b) 0
-# endif // defined(__GLIBC_PREREQ)
-# endif // defined(__linux__)
-
# if defined(__MVS__)
# include <features.h> // for __NATIVE_ASCII_F
# endif
-# ifndef __BYTE_ORDER__
-# error \
- "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform"
-# endif
-
-# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-# define _LIBCPP_LITTLE_ENDIAN
-# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-# define _LIBCPP_BIG_ENDIAN
-# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-
# if defined(_WIN32)
# define _LIBCPP_WIN32API
# define _LIBCPP_SHORT_WCHAR 1
@@ -547,19 +373,6 @@ typedef __char32_t char32_t;
# if defined(_LIBCPP_COMPILER_CLANG_BASED)
-# if defined(__APPLE__)
-# if defined(__i386__) || defined(__x86_64__)
-// use old string layout on x86_64 and i386
-# elif defined(__arm__)
-// use old string layout on arm (which does not include aarch64/arm64), except on watch ABIs
-# if defined(__ARM_ARCH_7K__) && __ARM_ARCH_7K__ >= 2
-# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-# endif
-# else
-# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
-# endif
-# endif
-
// Objective-C++ features (opt-in)
# if __has_feature(objc_arc)
# define _LIBCPP_HAS_OBJC_ARC
diff --git a/libcxx/include/__configuration/abi.h b/libcxx/include/__configuration/abi.h
new file mode 100644
index 0000000000000..c570b9aaba48d
--- /dev/null
+++ b/libcxx/include/__configuration/abi.h
@@ -0,0 +1,147 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___CONFIGURATION_ABI_H
+#define _LIBCPP___CONFIGURATION_ABI_H
+
+#include <__config_site>
+#include <__configuration/compiler.h>
+#include <__configuration/platform.h>
+
+#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+# pragma GCC system_header
+#endif
+
+#if _LIBCPP_ABI_VERSION >= 2
+// Change short string representation so that string data starts at offset 0,
+// improving its alignment in some cases.
+# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
+// Fix deque iterator type in order to support incomplete types.
+# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
+// Fix undefined behavior in how std::list stores its linked nodes.
+# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
+// Fix undefined behavior in how __tree stores its end and parent nodes.
+# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
+// Fix undefined behavior in how __hash_table stores its pointer types.
+# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
+# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
+# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
+// Override the default return value of exception::what() for bad_function_call::what()
+// with a string that is specific to bad_function_call (see http://wg21.link/LWG2233).
+// This is an ABI break on platforms that sign and authenticate vtable function pointers
+// because it changes the mangling of the virtual function located in the vtable, which
+// changes how it gets signed.
+# define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
+// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
+# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
+// Give reverse_iterator<T> one data member of type T, not two.
+// Also, in C++17 and later, don't derive iterator types from std::iterator.
+# define _LIBCPP_ABI_NO_ITERATOR_BASES
+// Use the smallest possible integer type to represent the index of the variant.
+// Previously libc++ used "unsigned int" exclusively.
+# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
+// Unstable attempt to provide a more optimized std::function
+# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
+// All the regex constants must be distinct and nonzero.
+# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
+// Re-worked external template instantiations for std::string with a focus on
+// performance and fast-path inlining.
+# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
+// Enable clang::trivial_abi on std::unique_ptr.
+# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
+// Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr
+# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
+// std::random_device holds some state when it uses an implementation that gets
+// entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this
+// implementation to another one on a platform that has already shipped
+// std::random_device, one needs to retain the same object layout to remain ABI
+// compatible. This switch removes these workarounds for platforms that don't care
+// about ABI compatibility.
+# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT
+// Don't export the legacy __basic_string_common class and its methods from the built library.
+# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
+// Don't export the legacy __vector_base_common class and its methods from the built library.
+# define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON
+// According to the Standard, `bitset::operator[] const` returns bool
+# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
+// Fix the implementation of CityHash used for std::hash<fundamental-type>.
+// This is an ABI break because `std::hash` will return a different result,
+// which means that hashing the same object in translation units built against
+// different versions of libc++ can return inconsistent results. This is especially
+// tricky since std::hash is used in the implementation of unordered containers.
+//
+// The incorrect implementation of CityHash has the problem that it drops some
+// bits on the floor.
+# define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION
+// Remove the base 10 implementation of std::to_chars from the dylib.
+// The implementation moved to the header, but we still export the symbols from
+// the dylib for backwards compatibility.
+# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
+// Define std::array/std::string_view iterators to be __wrap_iters instead of raw
+// pointers, which prevents people from relying on a non-portable implementation
+// detail. This is especially useful because enabling bounded iterators hardening
+// requires code not to make these assumptions.
+# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_ARRAY
+# define _LIBCPP_ABI_USE_WRAP_ITER_IN_STD_STRING_VIEW
+#elif _LIBCPP_ABI_VERSION == 1
+# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
+// Enable compiling copies of now inline methods into the dylib to support
+// applications compiled against older libraries. This is unnecessary with
+// COFF dllexport semantics, since dllexport forces a non-inline definition
+// of inline functions to be emitted anyway. Our own non-inline copy would
+// conflict with the dllexport-emitted copy, so we disable it. For XCOFF,
+// the linker will take issue with the symbols in the shared object if the
+// weak inline methods get visibility (such as from -fvisibility-inlines-hidden),
+// so disable it.
+# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
+# endif
+// Feature macros for disabling pre ABI v1 features. All of these options
+// are deprecated.
+# if defined(__FreeBSD__) && __FreeBSD__ < 14
+# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
+# endif
+#endif
+
+// We had some bugs where we use [[no_unique_address]] together with construct_at,
+// which causes UB as the call on construct_at could write to overlapping subobjects
+//
+// https://github.com/llvm/llvm-proj...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/93083
More information about the libcxx-commits
mailing list