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