Skip to content

Commit 12563ea

Browse files
authored
[libc++][NFC] Refactor _LIBCPP_AVAILABILITY_HAS_* macros to always be defined (llvm#71002)
This makes the conditionals quite a bit simpler to understand, since it avoids double negatives and makes sure we have <__availability> included. For vendors which use availability macros, it also enforces that they check when specific features are introduced and define the macro for their platform appropriately.
1 parent a3c0f70 commit 12563ea

17 files changed

+245
-230
lines changed

libcxx/include/__availability

Lines changed: 104 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -87,57 +87,57 @@
8787

8888
#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
8989

90-
// These macros control the availability of std::bad_optional_access and
91-
// other exception types. These were put in the shared library to prevent
92-
// code bloat from every user program defining the vtable for these exception
93-
// types.
94-
//
95-
// Note that when exceptions are disabled, the methods that normally throw
96-
// these exceptions can be used even on older deployment targets, but those
97-
// methods will abort instead of throwing.
98-
// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_OPTIONAL_ACCESS
99-
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
100-
101-
// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS
102-
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
103-
104-
// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST
105-
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
106-
107-
// These macros control the availability of all parts of <filesystem> that
108-
// depend on something in the dylib.
109-
// # define _LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM_LIBRARY
110-
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
111-
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
112-
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
113-
114-
// This controls the availability of floating-point std::to_chars functions.
115-
// These overloads were added later than the integer overloads.
116-
// # define _LIBCPP_AVAILABILITY_HAS_NO_TO_CHARS_FLOATING_POINT
117-
# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT
118-
119-
// This controls the availability of the C++20 synchronization library,
120-
// which requires shared library support for various operations
121-
// (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
122-
// <semaphore>, and notification functions on std::atomic.
123-
// # define _LIBCPP_AVAILABILITY_HAS_NO_SYNC
124-
# define _LIBCPP_AVAILABILITY_SYNC
125-
126-
// This controls whether the library claims to provide a default verbose
127-
// termination function, and consequently whether the headers will try
128-
// to use it when the mechanism isn't overriden at compile-time.
129-
// # define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT
130-
# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT
131-
132-
// This controls the availability of the C++17 std::pmr library,
133-
// which is implemented in large part in the built library.
134-
// # define _LIBCPP_AVAILABILITY_HAS_NO_PMR
135-
# define _LIBCPP_AVAILABILITY_PMR
136-
137-
// This controls the availability of the C++20 time zone database.
138-
// The parser code is built in the library.
139-
// # define _LIBCPP_AVAILABILITY_HAS_NO_TZDB
140-
# define _LIBCPP_AVAILABILITY_TZDB
90+
// These macros control the availability of std::bad_optional_access and
91+
// other exception types. These were put in the shared library to prevent
92+
// code bloat from every user program defining the vtable for these exception
93+
// types.
94+
//
95+
// Note that when exceptions are disabled, the methods that normally throw
96+
// these exceptions can be used even on older deployment targets, but those
97+
// methods will abort instead of throwing.
98+
# define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS 1
99+
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
100+
101+
# define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS 1
102+
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
103+
104+
# define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST 1
105+
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
106+
107+
// These macros control the availability of all parts of <filesystem> that
108+
// depend on something in the dylib.
109+
# define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 1
110+
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY
111+
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
112+
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP
113+
114+
// This controls the availability of floating-point std::to_chars functions.
115+
// These overloads were added later than the integer overloads.
116+
# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1
117+
# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT
118+
119+
// This controls the availability of the C++20 synchronization library,
120+
// which requires shared library support for various operations
121+
// (see libcxx/src/atomic.cpp). This includes <barier>, <latch>,
122+
// <semaphore>, and notification functions on std::atomic.
123+
# define _LIBCPP_AVAILABILITY_HAS_SYNC 1
124+
# define _LIBCPP_AVAILABILITY_SYNC
125+
126+
// This controls whether the library claims to provide a default verbose
127+
// termination function, and consequently whether the headers will try
128+
// to use it when the mechanism isn't overriden at compile-time.
129+
# define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT 1
130+
# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT
131+
132+
// This controls the availability of the C++17 std::pmr library,
133+
// which is implemented in large part in the built library.
134+
# define _LIBCPP_AVAILABILITY_HAS_PMR 1
135+
# define _LIBCPP_AVAILABILITY_PMR
136+
137+
// This controls the availability of the C++20 time zone database.
138+
// The parser code is built in the library.
139+
# define _LIBCPP_AVAILABILITY_HAS_TZDB 1
140+
# define _LIBCPP_AVAILABILITY_TZDB
141141

142142
// Enable additional explicit instantiations of iostreams components. This
143143
// reduces the number of weak definitions generated in programs that use
@@ -146,28 +146,33 @@
146146
// TODO: Enable additional explicit instantiations on GCC once it supports exclude_from_explicit_instantiation,
147147
// or once libc++ doesn't use the attribute anymore.
148148
// TODO: Enable them on Windows once https://llvm.org/PR41018 has been fixed.
149-
#if defined(_LIBCPP_COMPILER_GCC) || defined(_WIN32)
150-
# define _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
151-
#endif
149+
# if !defined(_LIBCPP_COMPILER_GCC) && !defined(_WIN32)
150+
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 1
151+
# else
152+
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
153+
# endif
152154

153155
#elif defined(__APPLE__)
154156

155-
# if (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000)
156-
# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_OPTIONAL_ACCESS
157-
# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS
158-
# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST
159-
# endif
157+
# define _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS \
158+
(!defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) || __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 50000)
159+
160+
# define _LIBCPP_AVAILABILITY_HAS_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS
161+
# define _LIBCPP_AVAILABILITY_HAS_BAD_ANY_CAST _LIBCPP_AVAILABILITY_HAS_BAD_OPTIONAL_ACCESS
162+
160163
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((availability(watchos,strict,introduced=5.0)))
161164
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
162165
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
163166

164-
// <filesystem>
165-
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
166-
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
167-
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \
168-
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
169-
# define _LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM_LIBRARY
170-
# endif
167+
// <filesystem>
168+
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
169+
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \
170+
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \
171+
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000)
172+
# define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 0
173+
# else
174+
# define _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY 1
175+
# endif
171176
# define _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY \
172177
__attribute__((availability(macos,strict,introduced=10.15))) \
173178
__attribute__((availability(ios,strict,introduced=13.0))) \
@@ -184,46 +189,52 @@
184189
_Pragma("clang attribute pop") \
185190
_Pragma("clang attribute pop")
186191

187-
// std::to_chars(floating-point)
188-
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130300) || \
189-
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160300) || \
190-
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160300) || \
191-
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90300)
192-
# define _LIBCPP_AVAILABILITY_HAS_NO_TO_CHARS_FLOATING_POINT
193-
# endif
192+
// std::to_chars(floating-point)
193+
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130300) || \
194+
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160300) || \
195+
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160300) || \
196+
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90300)
197+
# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 0
198+
# else
199+
# define _LIBCPP_AVAILABILITY_HAS_TO_CHARS_FLOATING_POINT 1
200+
# endif
194201
# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \
195202
__attribute__((availability(macos,strict,introduced=13.3))) \
196203
__attribute__((availability(ios,strict,introduced=16.3))) \
197204
__attribute__((availability(tvos,strict,introduced=16.3))) \
198205
__attribute__((availability(watchos,strict,introduced=9.3)))
199206

200207
// c++20 synchronization library
201-
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
202-
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
203-
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \
204-
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
205-
# define _LIBCPP_AVAILABILITY_HAS_NO_SYNC
208+
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \
209+
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \
210+
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \
211+
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000)
212+
# define _LIBCPP_AVAILABILITY_HAS_SYNC 0
213+
# else
214+
# define _LIBCPP_AVAILABILITY_HAS_SYNC 1
206215
# endif
207216
# define _LIBCPP_AVAILABILITY_SYNC \
208217
__attribute__((availability(macos,strict,introduced=11.0))) \
209218
__attribute__((availability(ios,strict,introduced=14.0))) \
210219
__attribute__((availability(tvos,strict,introduced=14.0))) \
211220
__attribute__((availability(watchos,strict,introduced=7.0)))
212221

213-
// __libcpp_verbose_abort
214-
# if 1 // TODO: Update once this is released
215-
# define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT
216-
# endif
222+
// __libcpp_verbose_abort
223+
// TODO: Update once this is released
224+
# define _LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT 0
225+
217226
# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT \
218227
__attribute__((unavailable))
219228

220-
// std::pmr
221-
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \
222-
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \
223-
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \
224-
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000)
225-
# define _LIBCPP_AVAILABILITY_HAS_NO_PMR
226-
# endif
229+
// std::pmr
230+
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 140000) || \
231+
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 170000) || \
232+
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 170000) || \
233+
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 100000)
234+
# define _LIBCPP_AVAILABILITY_HAS_PMR 0
235+
# else
236+
# define _LIBCPP_AVAILABILITY_HAS_PMR 1
237+
# endif
227238
// TODO: Enable std::pmr markup once https://github.com/llvm/llvm-project/issues/40340 has been fixed
228239
// Until then, it is possible for folks to try to use `std::pmr` when back-deploying to targets that don't support
229240
// 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
@@ -238,14 +249,16 @@
238249
# define _LIBCPP_AVAILABILITY_PMR
239250
# endif
240251

241-
# define _LIBCPP_AVAILABILITY_HAS_NO_TZDB
252+
# define _LIBCPP_AVAILABILITY_HAS_TZDB 0
242253
# define _LIBCPP_AVAILABILITY_TZDB __attribute__((unavailable))
243254

244255
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 120000) || \
245256
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 150000) || \
246257
(defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 150000) || \
247258
(defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 80000)
248-
# define _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
259+
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 0
260+
# else
261+
# define _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 1
249262
# endif
250263
#else
251264

libcxx/include/__verbose_abort

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void __libcpp_verbose_abort(const char *__format, ...);
3838
// make sure that the program terminates but without taking any complex dependencies in this header.
3939
#if !defined(_LIBCPP_VERBOSE_ABORT)
4040

41-
# if defined(_LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT)
41+
# if !_LIBCPP_AVAILABILITY_HAS_VERBOSE_ABORT
4242
// The decltype is there to suppress -Wunused warnings in this configuration.
4343
void __use(const char*, ...);
4444
# define _LIBCPP_VERBOSE_ABORT(...) (decltype(::std::__use(__VA_ARGS__))(), __builtin_abort())

libcxx/include/fstream

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ basic_fstream<_CharT, _Traits>::close()
17621762
this->setstate(ios_base::failbit);
17631763
}
17641764

1765-
#ifndef _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
1765+
#if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
17661766
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>;
17671767
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>;
17681768
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>;

libcxx/include/sstream

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
11931193
__x.swap(__y);
11941194
}
11951195

1196-
#ifndef _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
1196+
#if _LIBCPP_AVAILABILITY_HAS_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
11971197
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringbuf<char>;
11981198
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringstream<char>;
11991199
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>;

libcxx/include/version

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
244244
*/
245245

246246
#include <__assert> // all public C++ headers provide the assertion handler
247+
#include <__availability>
247248
#include <__config>
248249

249250
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -292,7 +293,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
292293
# define __cpp_lib_clamp 201603L
293294
# define __cpp_lib_enable_shared_from_this 201603L
294295
// # define __cpp_lib_execution 201603L
295-
# if !defined(_LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM_LIBRARY)
296+
# if _LIBCPP_AVAILABILITY_HAS_FILESYSTEM_LIBRARY
296297
# define __cpp_lib_filesystem 201703L
297298
# endif
298299
# define __cpp_lib_gcd_lcm 201606L
@@ -311,7 +312,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
311312
# define __cpp_lib_make_from_tuple 201606L
312313
# define __cpp_lib_map_try_emplace 201411L
313314
// # define __cpp_lib_math_special_functions 201603L
314-
# if !defined(_LIBCPP_AVAILABILITY_HAS_NO_PMR)
315+
# if _LIBCPP_AVAILABILITY_HAS_PMR
315316
# define __cpp_lib_memory_resource 201603L
316317
# endif
317318
# define __cpp_lib_node_extract 201606L
@@ -348,10 +349,10 @@ __cpp_lib_within_lifetime 202306L <type_traits>
348349
// # define __cpp_lib_atomic_ref 201806L
349350
// # define __cpp_lib_atomic_shared_ptr 201711L
350351
# define __cpp_lib_atomic_value_initialization 201911L
351-
# if !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC)
352+
# if _LIBCPP_AVAILABILITY_HAS_SYNC
352353
# define __cpp_lib_atomic_wait 201907L
353354
# endif
354-
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC)
355+
# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
355356
# define __cpp_lib_barrier 201907L
356357
# endif
357358
# define __cpp_lib_bind_front 201907L
@@ -392,21 +393,21 @@ __cpp_lib_within_lifetime 202306L <type_traits>
392393
// # define __cpp_lib_is_layout_compatible 201907L
393394
# define __cpp_lib_is_nothrow_convertible 201806L
394395
// # define __cpp_lib_is_pointer_interconvertible 201907L
395-
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC)
396+
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_STOP_TOKEN) && _LIBCPP_AVAILABILITY_HAS_SYNC
396397
# define __cpp_lib_jthread 201911L
397398
# endif
398-
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC)
399+
# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
399400
# define __cpp_lib_latch 201907L
400401
# endif
401402
# define __cpp_lib_list_remove_return_type 201806L
402403
# define __cpp_lib_math_constants 201907L
403404
# define __cpp_lib_move_iterator_concept 202207L
404-
# if !defined(_LIBCPP_AVAILABILITY_HAS_NO_PMR)
405+
# if _LIBCPP_AVAILABILITY_HAS_PMR
405406
# define __cpp_lib_polymorphic_allocator 201902L
406407
# endif
407408
# define __cpp_lib_ranges 202207L
408409
# define __cpp_lib_remove_cvref 201711L
409-
# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC)
410+
# if !defined(_LIBCPP_HAS_NO_THREADS) && _LIBCPP_AVAILABILITY_HAS_SYNC
410411
# define __cpp_lib_semaphore 201907L
411412
# endif
412413
# undef __cpp_lib_shared_ptr_arrays

0 commit comments

Comments
 (0)