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