1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___CONFIGURATION_AVAILABILITY_H
11#define _LIBCPP___CONFIGURATION_AVAILABILITY_H
12
13#include <__configuration/compiler.h>
14#include <__configuration/language.h>
15
16#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17# pragma GCC system_header
18#endif
19
20// This file defines a framework that can be used by vendors to encode the version of an operating system that various
21// features of libc++ has been shipped in. This is primarily intended to allow safely deploying an executable built with
22// a new version of the library on a platform containing an older version of the built library.
23// Detailed documentation for this can be found at https://libcxx.llvm.org/VendorDocumentation.html#availability-markup
24
25// Availability markup is disabled when building the library, or when a non-Clang
26// compiler is used because only Clang supports the necessary attributes.
27//
28// We also allow users to force-disable availability markup via the `_LIBCPP_DISABLE_AVAILABILITY`
29// macro because that is the only way to work around a Clang bug related to availability
30// attributes: https://llvm.org/PR134151.
31// Once that bug has been fixed, we should remove the macro.
32#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCXXABI_BUILDING_LIBRARY) || \
33 !defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_DISABLE_AVAILABILITY)
34# undef _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
35# define _LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS 0
36#endif
37
38// When availability annotations are disabled, we take for granted that features introduced
39// in all versions of the library are available.
40#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS
41
42# define _LIBCPP_INTRODUCED_IN_LLVM_23 1
43# define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE /* nothing */
44
45# define _LIBCPP_INTRODUCED_IN_LLVM_22 1
46# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE /* nothing */
47
48# define _LIBCPP_INTRODUCED_IN_LLVM_21 1
49# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE /* nothing */
50
51# define _LIBCPP_INTRODUCED_IN_LLVM_20 1
52# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE /* nothing */
53
54# define _LIBCPP_INTRODUCED_IN_LLVM_19 1
55# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE /* nothing */
56
57# define _LIBCPP_INTRODUCED_IN_LLVM_18 1
58# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE /* nothing */
59
60# define _LIBCPP_INTRODUCED_IN_LLVM_16 1
61# define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE /* nothing */
62
63# define _LIBCPP_INTRODUCED_IN_LLVM_15 1
64# define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE /* nothing */
65
66# define _LIBCPP_INTRODUCED_IN_LLVM_14 1
67# define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE /* nothing */
68
69# define _LIBCPP_INTRODUCED_IN_LLVM_12 1
70# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE /* nothing */
71
72#elif defined(__APPLE__)
73
74// clang-format off
75
76// LLVM 23
77// TODO: Fill this in
78# define _LIBCPP_INTRODUCED_IN_LLVM_23 0
79# define _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE __attribute__((unavailable))
80
81// LLVM 22
82// TODO: Fill this in
83# define _LIBCPP_INTRODUCED_IN_LLVM_22 0
84# define _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE __attribute__((unavailable))
85
86// LLVM 21
87# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 260400) || \
88 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260400) || \
89 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260400) || \
90 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260400) || \
91 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100400) || \
92 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 250400)
93# define _LIBCPP_INTRODUCED_IN_LLVM_21 0
94# else
95# define _LIBCPP_INTRODUCED_IN_LLVM_21 1
96# endif
97# define _LIBCPP_INTRODUCED_IN_LLVM_21_ATTRIBUTE \
98 __attribute__((availability(macos, strict, introduced = 26.4))) \
99 __attribute__((availability(ios, strict, introduced = 26.4))) \
100 __attribute__((availability(tvos, strict, introduced = 26.4))) \
101 __attribute__((availability(watchos, strict, introduced = 26.4))) \
102 __attribute__((availability(bridgeos, strict, introduced = 10.4))) \
103 __attribute__((availability(driverkit, strict, introduced = 25.4)))
104
105// LLVM 20
106//
107// Note that versions for most Apple OSes were bumped forward and aligned in that release.
108# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 260000) || \
109 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 260000) || \
110 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 260000) || \
111 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 260000) || \
112 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 100000) || \
113 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 250000)
114# define _LIBCPP_INTRODUCED_IN_LLVM_20 0
115# else
116# define _LIBCPP_INTRODUCED_IN_LLVM_20 1
117# endif
118# define _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE \
119 __attribute__((availability(macos, strict, introduced = 26.0))) \
120 __attribute__((availability(ios, strict, introduced = 26.0))) \
121 __attribute__((availability(tvos, strict, introduced = 26.0))) \
122 __attribute__((availability(watchos, strict, introduced = 26.0))) \
123 __attribute__((availability(bridgeos, strict, introduced = 10.0))) \
124 __attribute__((availability(driverkit, strict, introduced = 25.0)))
125
126// LLVM 19
127# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150400) || \
128 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180400) || \
129 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180400) || \
130 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110400) || \
131 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90400) || \
132 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 240400)
133# define _LIBCPP_INTRODUCED_IN_LLVM_19 0
134# else
135# define _LIBCPP_INTRODUCED_IN_LLVM_19 1
136# endif
137# define _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE \
138 __attribute__((availability(macos, strict, introduced = 15.4))) \
139 __attribute__((availability(ios, strict, introduced = 18.4))) \
140 __attribute__((availability(tvos, strict, introduced = 18.4))) \
141 __attribute__((availability(watchos, strict, introduced = 11.4))) \
142 __attribute__((availability(bridgeos, strict, introduced = 9.4))) \
143 __attribute__((availability(driverkit, strict, introduced = 24.4)))
144
145// LLVM 18
146# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 150000) || \
147 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 180000) || \
148 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 180000) || \
149 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 110000) || \
150 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 90000) || \
151 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 240000)
152# define _LIBCPP_INTRODUCED_IN_LLVM_18 0
153# else
154# define _LIBCPP_INTRODUCED_IN_LLVM_18 1
155# endif
156# define _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE \
157 __attribute__((availability(macos, strict, introduced = 15.0))) \
158 __attribute__((availability(ios, strict, introduced = 18.0))) \
159 __attribute__((availability(tvos, strict, introduced = 18.0))) \
160 __attribute__((availability(watchos, strict, introduced = 11.0))) \
161 __attribute__((availability(bridgeos, strict, introduced = 9.0))) \
162 __attribute__((availability(driverkit, strict, introduced = 24.0)))
163
164// LLVM 16
165# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \
166 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \
167 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \
168 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000) || \
169 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 80000) || \
170 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 230000)
171# define _LIBCPP_INTRODUCED_IN_LLVM_16 0
172# else
173# define _LIBCPP_INTRODUCED_IN_LLVM_16 1
174# endif
175# define _LIBCPP_INTRODUCED_IN_LLVM_16_ATTRIBUTE \
176 __attribute__((availability(macos, strict, introduced = 14.0))) \
177 __attribute__((availability(ios, strict, introduced = 17.0))) \
178 __attribute__((availability(tvos, strict, introduced = 17.0))) \
179 __attribute__((availability(watchos, strict, introduced = 10.0))) \
180 __attribute__((availability(bridgeos, strict, introduced = 8.0))) \
181 __attribute__((availability(driverkit, strict, introduced = 23.0)))
182
183// LLVM 15
184# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130300) || \
185 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160300) || \
186 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160300) || \
187 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90300) || \
188 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 70500) || \
189 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 220400)
190# define _LIBCPP_INTRODUCED_IN_LLVM_15 0
191# else
192# define _LIBCPP_INTRODUCED_IN_LLVM_15 1
193# endif
194# define _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE \
195 __attribute__((availability(macos, strict, introduced = 13.3))) \
196 __attribute__((availability(ios, strict, introduced = 16.3))) \
197 __attribute__((availability(tvos, strict, introduced = 16.3))) \
198 __attribute__((availability(watchos, strict, introduced = 9.3))) \
199 __attribute__((availability(bridgeos, strict, introduced = 7.5))) \
200 __attribute__((availability(driverkit, strict, introduced = 22.4)))
201
202// LLVM 14
203# define _LIBCPP_INTRODUCED_IN_LLVM_14 _LIBCPP_INTRODUCED_IN_LLVM_15
204# define _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
205
206// LLVM 12
207# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120300) || \
208 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150300) || \
209 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150300) || \
210 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80300) || \
211 (defined(__ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_BRIDGE_OS_VERSION_MIN_REQUIRED__ < 60000) || \
212 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 210300)
213# define _LIBCPP_INTRODUCED_IN_LLVM_12 0
214# else
215# define _LIBCPP_INTRODUCED_IN_LLVM_12 1
216# endif
217# define _LIBCPP_INTRODUCED_IN_LLVM_12_ATTRIBUTE \
218 __attribute__((availability(macos, strict, introduced = 12.3))) \
219 __attribute__((availability(ios, strict, introduced = 15.3))) \
220 __attribute__((availability(tvos, strict, introduced = 15.3))) \
221 __attribute__((availability(watchos, strict, introduced = 8.3))) \
222 __attribute__((availability(bridgeos, strict, introduced = 6.0))) \
223 __attribute__((availability(driverkit, strict, introduced = 21.3)))
224
225# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
226 (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150000) || \
227 (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150000) || \
228 (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80000) || \
229 (defined(__ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_DRIVERKIT_VERSION_MIN_REQUIRED__ < 200000)
230# warning "The selected platform is no longer supported by libc++."
231# endif
232
233#else
234
235// ...New vendors can add availability markup here...
236
237# error \
238 "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
239
240#endif
241
242// This controls the availability of new implementation of std::atomic's
243// wait, notify_one and notify_all. The new implementation uses
244// the native atomic wait/notify operations on platforms that support them
245// based on the size of the atomic type, instead of the type itself.
246#define _LIBCPP_AVAILABILITY_HAS_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22
247#define _LIBCPP_AVAILABILITY_NEW_SYNC _LIBCPP_INTRODUCED_IN_LLVM_22_ATTRIBUTE
248
249// This controls whether `std::__hash_memory` is available in the dylib, which
250// is used for some `std::hash` specializations.
251#define _LIBCPP_AVAILABILITY_HAS_HASH_MEMORY _LIBCPP_INTRODUCED_IN_LLVM_21
252// No attribute, since we've had hash in the headers before
253
254// This controls whether we provide a message for `bad_function_call::what()` that specific to `std::bad_function_call`.
255// See https://wg21.link/LWG2233. This requires `std::bad_function_call::what()` to be available in the dylib.
256#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE _LIBCPP_INTRODUCED_IN_LLVM_21
257// No attribute, since we've had bad_function_call::what() in the headers before
258
259// This determines whether we assume that the internal std::__bad_variant_access_with_msg class
260// (which carries a message describing the cause of the failure in bad_variant_access::what())
261// provides a key function in the dylib. This allows centralizing its vtable and typeinfo instead
262// of having all TUs provide a weak definition that then gets deduplicated. When it is not available
263// in the dylib, what() is defined inline instead, so the descriptive message is provided regardless.
264#define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS_WITH_MSG_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_23
265// No attribute, since we've had bad_variant_access in the headers before
266
267// This controls the availability of floating-point std::from_chars functions.
268// These overloads were added later than the integer overloads.
269#define _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20
270#define _LIBCPP_AVAILABILITY_FROM_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_20_ATTRIBUTE
271
272// This controls the availability of the C++20 time zone database.
273// The parser code is built in the library.
274#define _LIBCPP_AVAILABILITY_HAS_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19
275#define _LIBCPP_AVAILABILITY_TZDB _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
276
277// These macros determine whether we assume that std::bad_function_call and
278// std::bad_expected_access provide a key function in the dylib. This allows
279// centralizing their vtable and typeinfo instead of having all TUs provide
280// a weak definition that then gets deduplicated.
281#define _LIBCPP_AVAILABILITY_HAS_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
282#define _LIBCPP_AVAILABILITY_BAD_FUNCTION_CALL_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
283#define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
284#define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
285
286// These macros controls the availability of __cxa_init_primary_exception
287// in the built library, which std::make_exception_ptr might use
288// (see libcxx/include/__exception/exception_ptr.h).
289#define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18
290#define _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION _LIBCPP_INTRODUCED_IN_LLVM_18_ATTRIBUTE
291
292// This controls the availability of the C++17 std::pmr library,
293// which is implemented in large part in the built library.
294//
295// TODO: Enable std::pmr markup once https://llvm.org/PR40340 has been fixed
296// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
297// it and it'll be a load-time error, but we don't have a good alternative because the library won't compile if we
298// use availability annotations until that bug has been fixed.
299#define _LIBCPP_AVAILABILITY_HAS_PMR _LIBCPP_INTRODUCED_IN_LLVM_16
300#define _LIBCPP_AVAILABILITY_PMR
301
302// This controls whether the library claims to provide a default verbose
303// termination function, and consequently whether the headers will try
304// to use it when the mechanism isn't overriden at compile-time.
305#define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15
306#define _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_INTRODUCED_IN_LLVM_15_ATTRIBUTE
307
308// This controls the availability of floating-point std::to_chars functions.
309// These overloads were added later than the integer overloads.
310#define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14
311#define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_INTRODUCED_IN_LLVM_14_ATTRIBUTE
312
313// Enable additional explicit instantiations of iostreams components. This
314// reduces the number of weak definitions generated in programs that use
315// iostreams by providing a single strong definition in the shared library.
316//
317// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
318// or once libc++ doesn't use the attribute anymore.
319// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
320#if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
321# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 _LIBCPP_INTRODUCED_IN_LLVM_12
322#else
323# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
324#endif
325
326// Controls whether the implementation for text_encoding::environment() is available
327#define _LIBCPP_AVAILABILITY_HAS_TEXT_ENCODING_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23
328#define _LIBCPP_AVAILABILITY_TEXT_ENCODING_ENVIRONMENT _LIBCPP_INTRODUCED_IN_LLVM_23_ATTRIBUTE
329
330// Only define a bunch of symbols in the dylib if we need to be compatible with LLVM 7 headers or older
331# if defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_AVAILABILITY_MINIMUM_HEADER_VERSION < 8
332# define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8
333# else
334# define _LIBCPP_HIDE_FROM_ABI_SINCE_LLVM8 _LIBCPP_HIDE_FROM_ABI
335# endif
336
337#endif // _LIBCPP___CONFIGURATION_AVAILABILITY_H
338