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