__config 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313
  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. #ifndef _LIBCPP___CONFIG
  10. #define _LIBCPP___CONFIG
  11. #include <__config_site>
  12. #if defined(_MSC_VER) && !defined(__clang__)
  13. # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  14. # define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
  15. # endif
  16. #endif
  17. #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
  18. # pragma GCC system_header
  19. #endif
  20. #if defined(__apple_build_version__)
  21. // Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403)
  22. # define _LIBCPP_COMPILER_CLANG_BASED
  23. # define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000)
  24. #elif defined(__clang__)
  25. # define _LIBCPP_COMPILER_CLANG_BASED
  26. # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
  27. #elif defined(__GNUC__)
  28. # define _LIBCPP_COMPILER_GCC
  29. #endif
  30. // Move outside #ifdef __cplusplus because this needs to work in both C and C++ headers.
  31. #if defined(__apple_build_version__)
  32. # define _LIBCPP_COMPILER_CLANG_BASED
  33. # define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000)
  34. #elif defined(__clang__)
  35. # define _LIBCPP_COMPILER_CLANG
  36. # define _LIBCPP_COMPILER_CLANG_BASED
  37. # define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
  38. #elif defined(__GNUC__)
  39. # define _LIBCPP_COMPILER_GCC
  40. #elif defined(_MSC_VER)
  41. # define _LIBCPP_COMPILER_MSVC
  42. # if _MSVC_LANG == 201705L
  43. # define _LIBCPP_STD_VER 20
  44. # elif _MSVC_LANG == 201703L
  45. # define _LIBCPP_STD_VER 17
  46. # else
  47. # define _LIBCPP_STD_VER 14
  48. # endif
  49. #endif
  50. #ifdef __cplusplus
  51. // _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM.
  52. // Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 16.0.1 == 16.00.01), _LIBCPP_VERSION is
  53. // defined to XXYYZZ.
  54. # define _LIBCPP_VERSION 160005
  55. # define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y
  56. # define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y)
  57. // Valid C++ identifier that revs with every libc++ version. This can be used to
  58. // generate identifiers that must be unique for every released libc++ version.
  59. # define _LIBCPP_VERSIONED_IDENTIFIER _LIBCPP_CONCAT(v, _LIBCPP_VERSION)
  60. # if __STDC_HOSTED__ == 0
  61. # define _LIBCPP_FREESTANDING
  62. # endif
  63. # ifndef _LIBCPP_STD_VER
  64. # if __cplusplus <= 201103L
  65. # define _LIBCPP_STD_VER 11
  66. # elif __cplusplus <= 201402L
  67. # define _LIBCPP_STD_VER 14
  68. # elif __cplusplus <= 201703L
  69. # define _LIBCPP_STD_VER 17
  70. # elif __cplusplus <= 202002L
  71. # define _LIBCPP_STD_VER 20
  72. # else
  73. // Expected release year of the next C++ standard
  74. # define _LIBCPP_STD_VER 23
  75. # endif
  76. # endif // _LIBCPP_STD_VER
  77. # if defined(__ELF__)
  78. # define _LIBCPP_OBJECT_FORMAT_ELF 1
  79. # elif defined(__MACH__)
  80. # define _LIBCPP_OBJECT_FORMAT_MACHO 1
  81. # elif defined(_WIN32) || defined(__CYGWIN__)
  82. # define _LIBCPP_OBJECT_FORMAT_COFF 1
  83. # elif defined(__wasm__)
  84. # define _LIBCPP_OBJECT_FORMAT_WASM 1
  85. # elif defined(_AIX)
  86. # define _LIBCPP_OBJECT_FORMAT_XCOFF 1
  87. # else
  88. // ... add new file formats here ...
  89. # endif
  90. # if _LIBCPP_ABI_VERSION >= 2
  91. // Change short string representation so that string data starts at offset 0,
  92. // improving its alignment in some cases.
  93. # define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
  94. // Fix deque iterator type in order to support incomplete types.
  95. # define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
  96. // Fix undefined behavior in how std::list stores its linked nodes.
  97. # define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
  98. // Fix undefined behavior in how __tree stores its end and parent nodes.
  99. # define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
  100. // Fix undefined behavior in how __hash_table stores its pointer types.
  101. # define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
  102. # define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
  103. # define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
  104. // Define a key function for `bad_function_call` in the library, to centralize
  105. // its vtable and typeinfo to libc++ rather than having all other libraries
  106. // using that class define their own copies.
  107. # define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
  108. // Override the default return value of exception::what() for
  109. // bad_function_call::what() with a string that is specific to
  110. // bad_function_call (see http://wg21.link/LWG2233). This is an ABI break
  111. // because it changes the vtable layout of bad_function_call.
  112. # define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE
  113. // Enable optimized version of __do_get_(un)signed which avoids redundant copies.
  114. # define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
  115. // Give reverse_iterator<T> one data member of type T, not two.
  116. // Also, in C++17 and later, don't derive iterator types from std::iterator.
  117. # define _LIBCPP_ABI_NO_ITERATOR_BASES
  118. // Use the smallest possible integer type to represent the index of the variant.
  119. // Previously libc++ used "unsigned int" exclusively.
  120. # define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
  121. // Unstable attempt to provide a more optimized std::function
  122. #ifdef __EMSCRIPTEN__
  123. // XXX EMSCRIPTEN https://github.com/emscripten-core/emscripten/issues/11022
  124. //# define _LIBCPP_ABI_OPTIMIZED_FUNCTION
  125. #else
  126. # define _LIBCPP_ABI_OPTIMIZED_FUNCTION
  127. #endif
  128. // All the regex constants must be distinct and nonzero.
  129. # define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO
  130. // Re-worked external template instantiations for std::string with a focus on
  131. // performance and fast-path inlining.
  132. # define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
  133. // Enable clang::trivial_abi on std::unique_ptr.
  134. # define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
  135. // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr
  136. # define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
  137. // std::random_device holds some state when it uses an implementation that gets
  138. // entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this
  139. // implementation to another one on a platform that has already shipped
  140. // std::random_device, one needs to retain the same object layout to remain ABI
  141. // compatible. This switch removes these workarounds for platforms that don't care
  142. // about ABI compatibility.
  143. # define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT
  144. // Don't export the legacy __basic_string_common class and its methods from the built library.
  145. # define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON
  146. // Don't export the legacy __vector_base_common class and its methods from the built library.
  147. # define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON
  148. // According to the Standard, `bitset::operator[] const` returns bool
  149. # define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL
  150. // Fix the implementation of CityHash used for std::hash<fundamental-type>.
  151. // This is an ABI break because `std::hash` will return a different result,
  152. // which means that hashing the same object in translation units built against
  153. // different versions of libc++ can return inconsistent results. This is especially
  154. // tricky since std::hash is used in the implementation of unordered containers.
  155. //
  156. // The incorrect implementation of CityHash has the problem that it drops some
  157. // bits on the floor.
  158. # define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION
  159. // Remove the base 10 implementation of std::to_chars from the dylib.
  160. // The implementation moved to the header, but we still export the symbols from
  161. // the dylib for backwards compatibility.
  162. # define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10
  163. # elif _LIBCPP_ABI_VERSION == 1
  164. # if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF))
  165. // Enable compiling copies of now inline methods into the dylib to support
  166. // applications compiled against older libraries. This is unnecessary with
  167. // COFF dllexport semantics, since dllexport forces a non-inline definition
  168. // of inline functions to be emitted anyway. Our own non-inline copy would
  169. // conflict with the dllexport-emitted copy, so we disable it. For XCOFF,
  170. // the linker will take issue with the symbols in the shared object if the
  171. // weak inline methods get visibility (such as from -fvisibility-inlines-hidden),
  172. // so disable it.
  173. # define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
  174. # endif
  175. // Feature macros for disabling pre ABI v1 features. All of these options
  176. // are deprecated.
  177. # if defined(__FreeBSD__)
  178. # define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
  179. # endif
  180. # endif
  181. # if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2
  182. // Enable additional explicit instantiations of iostreams components. This
  183. // reduces the number of weak definitions generated in programs that use
  184. // iostreams by providing a single strong definition in the shared library.
  185. # define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
  186. // Define a key function for `bad_function_call` in the library, to centralize
  187. // its vtable and typeinfo to libc++ rather than having all other libraries
  188. // using that class define their own copies.
  189. # define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
  190. # endif
  191. # define _LIBCPP_TOSTRING2(x) #x
  192. # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
  193. # if __cplusplus < 201103L
  194. # define _LIBCPP_CXX03_LANG
  195. # endif
  196. # ifndef __has_attribute
  197. # define __has_attribute(__x) 0
  198. # endif
  199. # ifndef __has_builtin
  200. # define __has_builtin(__x) 0
  201. # endif
  202. # ifndef __has_extension
  203. # define __has_extension(__x) 0
  204. # endif
  205. # ifndef __has_feature
  206. # define __has_feature(__x) 0
  207. # endif
  208. # ifndef __has_cpp_attribute
  209. # define __has_cpp_attribute(__x) 0
  210. # endif
  211. # ifndef __has_constexpr_builtin
  212. # define __has_constexpr_builtin(x) 0
  213. # endif
  214. // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
  215. // the compiler and '1' otherwise.
  216. # ifndef __is_identifier
  217. # define __is_identifier(__x) 1
  218. # endif
  219. # ifndef __has_declspec_attribute
  220. # define __has_declspec_attribute(__x) 0
  221. # endif
  222. # define __has_keyword(__x) !(__is_identifier(__x))
  223. # ifndef __has_include
  224. # define __has_include(...) 0
  225. # endif
  226. # if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L
  227. # error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11"
  228. # endif
  229. // FIXME: ABI detection should be done via compiler builtin macros. This
  230. // is just a placeholder until Clang implements such macros. For now assume
  231. // that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
  232. // and allow the user to explicitly specify the ABI to handle cases where this
  233. // heuristic falls short.
  234. # if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT)
  235. # error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined"
  236. # elif defined(_LIBCPP_ABI_FORCE_ITANIUM)
  237. # define _LIBCPP_ABI_ITANIUM
  238. # elif defined(_LIBCPP_ABI_FORCE_MICROSOFT)
  239. # define _LIBCPP_ABI_MICROSOFT
  240. # else
  241. # if defined(_WIN32) && defined(_MSC_VER)
  242. # define _LIBCPP_ABI_MICROSOFT
  243. # else
  244. # define _LIBCPP_ABI_ITANIUM
  245. # endif
  246. # endif
  247. # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
  248. # define _LIBCPP_ABI_VCRUNTIME
  249. # endif
  250. # if __has_feature(experimental_library)
  251. # ifndef _LIBCPP_ENABLE_EXPERIMENTAL
  252. # define _LIBCPP_ENABLE_EXPERIMENTAL
  253. # endif
  254. # endif
  255. // Incomplete features get their own specific disabling flags. This makes it
  256. // easier to grep for target specific flags once the feature is complete.
  257. # if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY)
  258. //# define _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
  259. # endif
  260. // Need to detect which libc we're using if we're on Linux.
  261. # if defined(__linux__)
  262. # include <features.h>
  263. # if defined(__GLIBC_PREREQ)
  264. # define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
  265. # else
  266. # define _LIBCPP_GLIBC_PREREQ(a, b) 0
  267. # endif // defined(__GLIBC_PREREQ)
  268. # endif // defined(__linux__)
  269. # if defined(__MVS__)
  270. # include <features.h> // for __NATIVE_ASCII_F
  271. # endif
  272. # ifdef __LITTLE_ENDIAN__
  273. # if __LITTLE_ENDIAN__
  274. # define _LIBCPP_LITTLE_ENDIAN
  275. # endif // __LITTLE_ENDIAN__
  276. # endif // __LITTLE_ENDIAN__
  277. # ifdef __BIG_ENDIAN__
  278. # if __BIG_ENDIAN__
  279. # define _LIBCPP_BIG_ENDIAN
  280. # endif // __BIG_ENDIAN__
  281. # endif // __BIG_ENDIAN__
  282. # ifdef __BYTE_ORDER__
  283. # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  284. # define _LIBCPP_LITTLE_ENDIAN
  285. # elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
  286. # define _LIBCPP_BIG_ENDIAN
  287. # endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
  288. # endif // __BYTE_ORDER__
  289. # ifdef __FreeBSD__
  290. # include <sys/endian.h>
  291. # include <osreldate.h>
  292. # if _BYTE_ORDER == _LITTLE_ENDIAN
  293. # define _LIBCPP_LITTLE_ENDIAN
  294. # else // _BYTE_ORDER == _LITTLE_ENDIAN
  295. # define _LIBCPP_BIG_ENDIAN
  296. # endif // _BYTE_ORDER == _LITTLE_ENDIAN
  297. # endif // __FreeBSD__
  298. # if defined(__NetBSD__) || defined(__OpenBSD__)
  299. # include <sys/endian.h>
  300. # if _BYTE_ORDER == _LITTLE_ENDIAN
  301. # define _LIBCPP_LITTLE_ENDIAN
  302. # else // _BYTE_ORDER == _LITTLE_ENDIAN
  303. # define _LIBCPP_BIG_ENDIAN
  304. # endif // _BYTE_ORDER == _LITTLE_ENDIAN
  305. # endif // defined(__NetBSD__) || defined(__OpenBSD__)
  306. # if defined(_WIN32)
  307. # define _LIBCPP_WIN32API
  308. # define _LIBCPP_LITTLE_ENDIAN
  309. # define _LIBCPP_SHORT_WCHAR 1
  310. // Both MinGW and native MSVC provide a "MSVC"-like environment
  311. # define _LIBCPP_MSVCRT_LIKE
  312. // If mingw not explicitly detected, assume using MS C runtime only if
  313. // a MS compatibility version is specified.
  314. # if defined(_MSC_VER) && !defined(__MINGW32__)
  315. # define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
  316. # endif
  317. # if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
  318. # define _LIBCPP_HAS_BITSCAN64
  319. # endif
  320. # define _LIBCPP_HAS_OPEN_WITH_WCHAR
  321. # endif // defined(_WIN32)
  322. # ifdef __sun__
  323. # include <sys/isa_defs.h>
  324. # ifdef _LITTLE_ENDIAN
  325. # define _LIBCPP_LITTLE_ENDIAN
  326. # else
  327. # define _LIBCPP_BIG_ENDIAN
  328. # endif
  329. # endif // __sun__
  330. # if defined(_AIX) && !defined(__64BIT__)
  331. // The size of wchar is 2 byte on 32-bit mode on AIX.
  332. # define _LIBCPP_SHORT_WCHAR 1
  333. # endif
  334. // Libc++ supports various implementations of std::random_device.
  335. //
  336. // _LIBCPP_USING_DEV_RANDOM
  337. // Read entropy from the given file, by default `/dev/urandom`.
  338. // If a token is provided, it is assumed to be the path to a file
  339. // to read entropy from. This is the default behavior if nothing
  340. // else is specified. This implementation requires storing state
  341. // inside `std::random_device`.
  342. //
  343. // _LIBCPP_USING_ARC4_RANDOM
  344. // Use arc4random(). This allows obtaining random data even when
  345. // using sandboxing mechanisms. On some platforms like Apple, this
  346. // is the recommended source of entropy for user-space programs.
  347. // When this option is used, the token passed to `std::random_device`'s
  348. // constructor *must* be "/dev/urandom" -- anything else is an error.
  349. //
  350. // _LIBCPP_USING_GETENTROPY
  351. // Use getentropy().
  352. // When this option is used, the token passed to `std::random_device`'s
  353. // constructor *must* be "/dev/urandom" -- anything else is an error.
  354. //
  355. // _LIBCPP_USING_FUCHSIA_CPRNG
  356. // Use Fuchsia's zx_cprng_draw() system call, which is specified to
  357. // deliver high-quality entropy and cannot fail.
  358. // When this option is used, the token passed to `std::random_device`'s
  359. // constructor *must* be "/dev/urandom" -- anything else is an error.
  360. //
  361. // _LIBCPP_USING_NACL_RANDOM
  362. // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
  363. // including accesses to the special files under `/dev`. This implementation
  364. // uses the NaCL syscall `nacl_secure_random_init()` to get entropy.
  365. // When this option is used, the token passed to `std::random_device`'s
  366. // constructor *must* be "/dev/urandom" -- anything else is an error.
  367. //
  368. // _LIBCPP_USING_WIN32_RANDOM
  369. // Use rand_s(), for use on Windows.
  370. // When this option is used, the token passed to `std::random_device`'s
  371. // constructor *must* be "/dev/urandom" -- anything else is an error.
  372. # if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
  373. defined(__DragonFly__) || defined(__sun__)
  374. # define _LIBCPP_USING_ARC4_RANDOM
  375. # elif defined(__wasi__) || defined(__EMSCRIPTEN__)
  376. # define _LIBCPP_USING_GETENTROPY
  377. # elif defined(__Fuchsia__)
  378. # define _LIBCPP_USING_FUCHSIA_CPRNG
  379. # elif defined(__native_client__)
  380. # define _LIBCPP_USING_NACL_RANDOM
  381. # elif defined(_LIBCPP_WIN32API)
  382. # define _LIBCPP_USING_WIN32_RANDOM
  383. # else
  384. # define _LIBCPP_USING_DEV_RANDOM
  385. # endif
  386. # if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
  387. # include <endian.h>
  388. # if __BYTE_ORDER == __LITTLE_ENDIAN
  389. # define _LIBCPP_LITTLE_ENDIAN
  390. # elif __BYTE_ORDER == __BIG_ENDIAN
  391. # define _LIBCPP_BIG_ENDIAN
  392. # else // __BYTE_ORDER == __BIG_ENDIAN
  393. # error unable to determine endian
  394. # endif
  395. # endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
  396. # if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
  397. # define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
  398. # else
  399. # define _LIBCPP_NO_CFI
  400. # endif
  401. # ifndef _LIBCPP_CXX03_LANG
  402. # define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp)
  403. # define _ALIGNAS_TYPE(x) alignas(x)
  404. # define _ALIGNAS(x) alignas(x)
  405. # define _LIBCPP_NORETURN [[noreturn]]
  406. # define _NOEXCEPT noexcept
  407. # define _NOEXCEPT_(x) noexcept(x)
  408. # define _LIBCPP_CONSTEXPR constexpr
  409. # else
  410. # define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
  411. # define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x))))
  412. # define _ALIGNAS(x) __attribute__((__aligned__(x)))
  413. # define _LIBCPP_NORETURN __attribute__((__noreturn__))
  414. # define _LIBCPP_HAS_NO_NOEXCEPT
  415. # define nullptr __nullptr
  416. # define _NOEXCEPT throw()
  417. # define _NOEXCEPT_(x)
  418. # define static_assert(...) _Static_assert(__VA_ARGS__)
  419. # define decltype(...) __decltype(__VA_ARGS__)
  420. # define _LIBCPP_CONSTEXPR
  421. typedef __char16_t char16_t;
  422. typedef __char32_t char32_t;
  423. # endif
  424. # if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
  425. # define _LIBCPP_NO_EXCEPTIONS
  426. # endif
  427. # define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
  428. # if defined(_LIBCPP_COMPILER_CLANG_BASED)
  429. # if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)
  430. # define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
  431. # endif
  432. // Objective-C++ features (opt-in)
  433. # if __has_feature(objc_arc)
  434. # define _LIBCPP_HAS_OBJC_ARC
  435. # endif
  436. # if __has_feature(objc_arc_weak)
  437. # define _LIBCPP_HAS_OBJC_ARC_WEAK
  438. # endif
  439. # if __has_extension(blocks)
  440. # define _LIBCPP_HAS_EXTENSION_BLOCKS
  441. # endif
  442. # if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
  443. # define _LIBCPP_HAS_BLOCKS_RUNTIME
  444. # endif
  445. # if !__has_feature(address_sanitizer)
  446. # define _LIBCPP_HAS_NO_ASAN
  447. # endif
  448. // Allow for build-time disabling of unsigned integer sanitization
  449. # if __has_attribute(no_sanitize)
  450. # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
  451. # endif
  452. # define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
  453. # define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
  454. # elif defined(_LIBCPP_COMPILER_GCC)
  455. # if !defined(__SANITIZE_ADDRESS__)
  456. # define _LIBCPP_HAS_NO_ASAN
  457. # endif
  458. # define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
  459. # define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
  460. # endif // _LIBCPP_COMPILER_[CLANG|GCC]
  461. # if defined(_LIBCPP_OBJECT_FORMAT_COFF)
  462. # ifdef _DLL
  463. # define _LIBCPP_CRT_FUNC __declspec(dllimport)
  464. # else
  465. # define _LIBCPP_CRT_FUNC
  466. # endif
  467. # if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY))
  468. # define _LIBCPP_DLL_VIS
  469. # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
  470. # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
  471. # define _LIBCPP_OVERRIDABLE_FUNC_VIS
  472. # define _LIBCPP_EXPORTED_FROM_ABI
  473. # elif defined(_LIBCPP_BUILDING_LIBRARY)
  474. # define _LIBCPP_DLL_VIS __declspec(dllexport)
  475. # if defined(__MINGW32__)
  476. # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
  477. # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
  478. # else
  479. # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
  480. # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
  481. # endif
  482. # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
  483. # define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
  484. # else
  485. # define _LIBCPP_DLL_VIS __declspec(dllimport)
  486. # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
  487. # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
  488. # define _LIBCPP_OVERRIDABLE_FUNC_VIS
  489. # define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport)
  490. # endif
  491. # define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
  492. # define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
  493. # define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
  494. # define _LIBCPP_HIDDEN
  495. # define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
  496. # define _LIBCPP_TEMPLATE_VIS
  497. # define _LIBCPP_TEMPLATE_DATA_VIS
  498. # define _LIBCPP_ENUM_VIS
  499. # else
  500. # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
  501. # define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis)))
  502. # else
  503. # define _LIBCPP_VISIBILITY(vis)
  504. # endif
  505. # define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden")
  506. # define _LIBCPP_FUNC_VIS _LIBCPP_VISIBILITY("default")
  507. # define _LIBCPP_TYPE_VIS _LIBCPP_VISIBILITY("default")
  508. # define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default")
  509. # define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default")
  510. # define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBILITY("default")
  511. # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default")
  512. # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
  513. // TODO: Make this a proper customization point or remove the option to override it.
  514. # ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
  515. # define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default")
  516. # endif
  517. # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
  518. // The inline should be removed once PR32114 is resolved
  519. # define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
  520. # else
  521. # define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
  522. # endif
  523. # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
  524. # if __has_attribute(__type_visibility__)
  525. # define _LIBCPP_TEMPLATE_VIS __attribute__((__type_visibility__("default")))
  526. # else
  527. # define _LIBCPP_TEMPLATE_VIS __attribute__((__visibility__("default")))
  528. # endif
  529. # else
  530. # define _LIBCPP_TEMPLATE_VIS
  531. # endif
  532. # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
  533. # define _LIBCPP_ENUM_VIS __attribute__((__type_visibility__("default")))
  534. # else
  535. # define _LIBCPP_ENUM_VIS
  536. # endif
  537. # endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
  538. # if __has_attribute(exclude_from_explicit_instantiation)
  539. # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__))
  540. # else
  541. // Try to approximate the effect of exclude_from_explicit_instantiation
  542. // (which is that entities are not assumed to be provided by explicit
  543. // template instantiations in the dylib) by always inlining those entities.
  544. # define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
  545. # endif
  546. // This macro marks a symbol as being hidden from libc++'s ABI. This is achieved
  547. // on two levels:
  548. // 1. The symbol is given hidden visibility, which ensures that users won't start exporting
  549. // symbols from their dynamic library by means of using the libc++ headers. This ensures
  550. // that those symbols stay private to the dynamic library in which it is defined.
  551. //
  552. // 2. The symbol is given an ABI tag that changes with each version of libc++. This ensures
  553. // that no ODR violation can arise from mixing two TUs compiled with different versions
  554. // of libc++ where we would have changed the definition of a symbol. If the symbols shared
  555. // the same name, the ODR would require that their definitions be token-by-token equivalent,
  556. // which basically prevents us from being able to make any change to any function in our
  557. // headers. Using this ABI tag ensures that the symbol name is "bumped" artificially at
  558. // each release, which lets us change the definition of these symbols at our leisure.
  559. // Note that historically, this has been achieved in various ways, including force-inlining
  560. // all functions or giving internal linkage to all functions. Both these (previous) solutions
  561. // suffer from drawbacks that lead notably to code bloat.
  562. //
  563. // Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend
  564. // on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library.
  565. //
  566. // Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions
  567. // instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled
  568. // name of a virtual function is part of its ABI, since some architectures like arm64e can sign
  569. // the virtual function pointer in the vtable based on the mangled name of the function. Since
  570. // we use an ABI tag that changes with each released version, the mangled name of the virtual
  571. // function would change, which is incorrect. Note that it doesn't make much sense to change
  572. // the implementation of a virtual function in an ABI-incompatible way in the first place,
  573. // since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable.
  574. //
  575. // TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing
  576. // the length of symbols with an ABI tag. In practice, we should remove the escape hatch and
  577. // use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70.
  578. # if !defined(_LIBCPP_NO_ABI_TAG) && !defined(__CUDACC__)
  579. # define _LIBCPP_HIDE_FROM_ABI \
  580. _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \
  581. __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
  582. # else
  583. # define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
  584. # endif
  585. # define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
  586. // This macro provides a HIDE_FROM_ABI equivalent that can be applied to extern
  587. // "C" function, as those lack mangling.
  588. # define _LIBCPP_HIDE_FROM_ABI_C _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
  589. # ifdef _LIBCPP_BUILDING_LIBRARY
  590. # if _LIBCPP_ABI_VERSION > 1
  591. # define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI
  592. # else
  593. # define _LIBCPP_HIDE_FROM_ABI_AFTER_V1
  594. # endif
  595. # else
  596. # define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI
  597. # endif
  598. // Just so we can migrate to the new macros gradually.
  599. # define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
  600. // Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
  601. // clang-format off
  602. # define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE {
  603. # define _LIBCPP_END_NAMESPACE_STD }}
  604. # define _VSTD std
  605. _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
  606. # if _LIBCPP_STD_VER > 14
  607. # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
  608. _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem {
  609. # else
  610. # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
  611. _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
  612. # endif
  613. # define _LIBCPP_END_NAMESPACE_FILESYSTEM _LIBCPP_END_NAMESPACE_STD }}
  614. // clang-format on
  615. # define _VSTD_FS std::__fs::filesystem
  616. # if __has_attribute(__enable_if__)
  617. # define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, "")))
  618. # endif
  619. # ifndef __SIZEOF_INT128__
  620. # define _LIBCPP_HAS_NO_INT128
  621. # endif
  622. # ifndef __cpp_consteval
  623. # define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR
  624. # else
  625. # define _LIBCPP_CONSTEVAL consteval
  626. # endif
  627. # if __has_attribute(__malloc__)
  628. # define _LIBCPP_NOALIAS __attribute__((__malloc__))
  629. # else
  630. # define _LIBCPP_NOALIAS
  631. # endif
  632. # if __has_attribute(__using_if_exists__)
  633. # define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__))
  634. # else
  635. # define _LIBCPP_USING_IF_EXISTS
  636. # endif
  637. # ifdef _LIBCPP_CXX03_LANG
  638. # define _LIBCPP_DECLARE_STRONG_ENUM(x) \
  639. struct _LIBCPP_TYPE_VIS x { \
  640. enum __lx
  641. // clang-format off
  642. # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
  643. __lx __v_; \
  644. _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \
  645. _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
  646. _LIBCPP_INLINE_VISIBILITY operator int() const { return __v_; } \
  647. };
  648. // clang-format on
  649. # else // _LIBCPP_CXX03_LANG
  650. # define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
  651. # define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
  652. # endif // _LIBCPP_CXX03_LANG
  653. # if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__sun__) || \
  654. defined(__NetBSD__)
  655. # define _LIBCPP_LOCALE__L_EXTENSIONS 1
  656. # endif
  657. # ifdef __FreeBSD__
  658. # define _DECLARE_C99_LDBL_MATH 1
  659. # endif
  660. // If we are getting operator new from the MSVC CRT, then allocation overloads
  661. // for align_val_t were added in 19.12, aka VS 2017 version 15.3.
  662. # if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
  663. # define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
  664. # elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
  665. // We're deferring to Microsoft's STL to provide aligned new et al. We don't
  666. // have it unless the language feature test macro is defined.
  667. # define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
  668. # elif defined(__MVS__)
  669. # define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
  670. # endif
  671. # if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
  672. # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
  673. # endif
  674. // It is not yet possible to use aligned_alloc() on all Apple platforms since
  675. // 10.15 was the first version to ship an implementation of aligned_alloc().
  676. # if defined(__APPLE__)
  677. # if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
  678. __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500)
  679. # define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
  680. # endif
  681. # elif defined(__ANDROID__) && __ANDROID_API__ < 28
  682. // Android only provides aligned_alloc when targeting API 28 or higher.
  683. # define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
  684. # endif
  685. # if defined(__APPLE__) || defined(__FreeBSD__)
  686. # define _LIBCPP_HAS_DEFAULTRUNELOCALE
  687. # endif
  688. # if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
  689. # define _LIBCPP_WCTYPE_IS_MASK
  690. # endif
  691. # if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)
  692. # define _LIBCPP_HAS_NO_CHAR8_T
  693. # endif
  694. // Deprecation macros.
  695. //
  696. // Deprecations warnings are always enabled, except when users explicitly opt-out
  697. // by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS.
  698. # if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
  699. # if __has_attribute(deprecated)
  700. # define _LIBCPP_DEPRECATED __attribute__((deprecated))
  701. # define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m)))
  702. # elif _LIBCPP_STD_VER > 11
  703. # define _LIBCPP_DEPRECATED [[deprecated]]
  704. # define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]]
  705. # else
  706. # define _LIBCPP_DEPRECATED
  707. # define _LIBCPP_DEPRECATED_(m)
  708. # endif
  709. # else
  710. # define _LIBCPP_DEPRECATED
  711. # define _LIBCPP_DEPRECATED_(m)
  712. # endif
  713. # if !defined(_LIBCPP_CXX03_LANG)
  714. # define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
  715. # else
  716. # define _LIBCPP_DEPRECATED_IN_CXX11
  717. # endif
  718. # if _LIBCPP_STD_VER > 11
  719. # define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
  720. # else
  721. # define _LIBCPP_DEPRECATED_IN_CXX14
  722. # endif
  723. # if _LIBCPP_STD_VER > 14
  724. # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
  725. # else
  726. # define _LIBCPP_DEPRECATED_IN_CXX17
  727. # endif
  728. # if _LIBCPP_STD_VER > 17
  729. # define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED
  730. # else
  731. # define _LIBCPP_DEPRECATED_IN_CXX20
  732. # endif
  733. #if _LIBCPP_STD_VER >= 23
  734. # define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED
  735. #else
  736. # define _LIBCPP_DEPRECATED_IN_CXX23
  737. #endif
  738. # if !defined(_LIBCPP_HAS_NO_CHAR8_T)
  739. # define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
  740. # else
  741. # define _LIBCPP_DEPRECATED_WITH_CHAR8_T
  742. # endif
  743. // Macros to enter and leave a state where deprecation warnings are suppressed.
  744. # if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC)
  745. # define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
  746. _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \
  747. _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
  748. # define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop")
  749. # else
  750. # define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
  751. # define _LIBCPP_SUPPRESS_DEPRECATED_POP
  752. # endif
  753. # if _LIBCPP_STD_VER <= 11
  754. # define _LIBCPP_EXPLICIT_AFTER_CXX11
  755. # else
  756. # define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
  757. # endif
  758. # if _LIBCPP_STD_VER > 11
  759. # define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr
  760. # else
  761. # define _LIBCPP_CONSTEXPR_SINCE_CXX14
  762. # endif
  763. # if _LIBCPP_STD_VER > 14
  764. # define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr
  765. # else
  766. # define _LIBCPP_CONSTEXPR_SINCE_CXX17
  767. # endif
  768. # if _LIBCPP_STD_VER > 17
  769. # define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr
  770. # else
  771. # define _LIBCPP_CONSTEXPR_SINCE_CXX20
  772. # endif
  773. # if _LIBCPP_STD_VER > 20
  774. # define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr
  775. # else
  776. # define _LIBCPP_CONSTEXPR_SINCE_CXX23
  777. # endif
  778. # if __has_cpp_attribute(nodiscard)
  779. # define _LIBCPP_NODISCARD [[nodiscard]]
  780. # else
  781. // We can't use GCC's [[gnu::warn_unused_result]] and
  782. // __attribute__((warn_unused_result)), because GCC does not silence them via
  783. // (void) cast.
  784. # define _LIBCPP_NODISCARD
  785. # endif
  786. // _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
  787. // specified as such as an extension.
  788. # if !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
  789. # define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD
  790. # else
  791. # define _LIBCPP_NODISCARD_EXT
  792. # endif
  793. # if _LIBCPP_STD_VER > 17 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
  794. # define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD
  795. # else
  796. # define _LIBCPP_NODISCARD_AFTER_CXX17
  797. # endif
  798. # if __has_attribute(__no_destroy__)
  799. # define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__))
  800. # else
  801. # define _LIBCPP_NO_DESTROY
  802. # endif
  803. # ifndef _LIBCPP_HAS_NO_ASAN
  804. extern "C" _LIBCPP_FUNC_VIS void
  805. __sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*);
  806. # endif
  807. // Try to find out if RTTI is disabled.
  808. # if !defined(__cpp_rtti) || __cpp_rtti < 199711L
  809. # define _LIBCPP_HAS_NO_RTTI
  810. # endif
  811. # ifndef _LIBCPP_WEAK
  812. # define _LIBCPP_WEAK __attribute__((__weak__))
  813. # endif
  814. // Thread API
  815. // clang-format off
  816. # if !defined(_LIBCPP_HAS_NO_THREADS) && \
  817. !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
  818. !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
  819. !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
  820. # if defined(__FreeBSD__) || \
  821. defined(__wasi__) || \
  822. defined(__NetBSD__) || \
  823. defined(__OpenBSD__) || \
  824. defined(__NuttX__) || \
  825. defined(__linux__) || \
  826. defined(__GNU__) || \
  827. defined(__APPLE__) || \
  828. defined(__sun__) || \
  829. defined(__MVS__) || \
  830. defined(_AIX) || \
  831. defined(__EMSCRIPTEN__) || \
  832. defined(__CYGWIN__)
  833. // clang-format on
  834. # define _LIBCPP_HAS_THREAD_API_PTHREAD
  835. # elif defined(__Fuchsia__)
  836. // TODO(44575): Switch to C11 thread API when possible.
  837. # define _LIBCPP_HAS_THREAD_API_PTHREAD
  838. # elif defined(_LIBCPP_WIN32API)
  839. # define _LIBCPP_HAS_THREAD_API_WIN32
  840. # else
  841. # error "No thread API"
  842. # endif // _LIBCPP_HAS_THREAD_API
  843. # endif // _LIBCPP_HAS_NO_THREADS
  844. # if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
  845. # if defined(__ANDROID__) && __ANDROID_API__ >= 30
  846. # define _LIBCPP_HAS_COND_CLOCKWAIT
  847. # elif defined(_LIBCPP_GLIBC_PREREQ)
  848. # if _LIBCPP_GLIBC_PREREQ(2, 30)
  849. # define _LIBCPP_HAS_COND_CLOCKWAIT
  850. # endif
  851. # endif
  852. # endif
  853. # if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
  854. # error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
  855. _LIBCPP_HAS_NO_THREADS is not defined.
  856. # endif
  857. # if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
  858. # error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
  859. _LIBCPP_HAS_NO_THREADS is defined.
  860. # endif
  861. # if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
  862. # error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
  863. _LIBCPP_HAS_NO_THREADS is defined.
  864. # endif
  865. # if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
  866. # define __STDCPP_THREADS__ 1
  867. # endif
  868. // The glibc and Bionic implementation of pthreads implements
  869. // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
  870. // mutexes have no destroy mechanism.
  871. //
  872. // This optimization can't be performed on Apple platforms, where
  873. // pthread_mutex_destroy can allow the kernel to release resources.
  874. // See https://llvm.org/D64298 for details.
  875. //
  876. // TODO(EricWF): Enable this optimization on Bionic after speaking to their
  877. // respective stakeholders.
  878. // clang-format off
  879. # if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) || \
  880. (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \
  881. defined(_LIBCPP_HAS_THREAD_API_WIN32)
  882. // clang-format on
  883. # define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
  884. # endif
  885. // Destroying a condvar is a nop on Windows.
  886. //
  887. // This optimization can't be performed on Apple platforms, where
  888. // pthread_cond_destroy can allow the kernel to release resources.
  889. // See https://llvm.org/D64298 for details.
  890. //
  891. // TODO(EricWF): This is potentially true for some pthread implementations
  892. // as well.
  893. # if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || defined(_LIBCPP_HAS_THREAD_API_WIN32)
  894. # define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
  895. # endif
  896. // Some systems do not provide gets() in their C library, for security reasons.
  897. # if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || defined(__OpenBSD__)
  898. # define _LIBCPP_C_HAS_NO_GETS
  899. # endif
  900. # if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \
  901. defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
  902. # define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
  903. # endif
  904. # if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
  905. # define _LIBCPP_HAS_C_ATOMIC_IMP
  906. # elif defined(_LIBCPP_COMPILER_GCC)
  907. # define _LIBCPP_HAS_GCC_ATOMIC_IMP
  908. # endif
  909. # if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
  910. !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)
  911. # define _LIBCPP_HAS_NO_ATOMIC_HEADER
  912. # else
  913. # ifndef _LIBCPP_ATOMIC_FLAG_TYPE
  914. # define _LIBCPP_ATOMIC_FLAG_TYPE bool
  915. # endif
  916. # ifdef _LIBCPP_FREESTANDING
  917. # define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
  918. # endif
  919. # endif
  920. # ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
  921. # define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
  922. # endif
  923. # if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
  924. # if defined(__clang__) && __has_attribute(acquire_capability)
  925. // Work around the attribute handling in clang. When both __declspec and
  926. // __attribute__ are present, the processing goes awry preventing the definition
  927. // of the types. In MinGW mode, __declspec evaluates to __attribute__, and thus
  928. // combining the two does work.
  929. # if !defined(_MSC_VER)
  930. # define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
  931. # endif
  932. # endif
  933. # endif
  934. # ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
  935. # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x))
  936. # else
  937. # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x)
  938. # endif
  939. # if _LIBCPP_STD_VER > 17
  940. # define _LIBCPP_CONSTINIT constinit
  941. # elif __has_attribute(__require_constant_initialization__)
  942. # define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__))
  943. # else
  944. # define _LIBCPP_CONSTINIT
  945. # endif
  946. # if !__has_builtin(__builtin_is_constant_evaluated) || (defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER < 900) || __CUDACC_VER_MAJOR__ == 10
  947. # define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
  948. # endif
  949. # if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
  950. # define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning")))
  951. # else
  952. # define _LIBCPP_DIAGNOSE_WARNING(...)
  953. # endif
  954. // Use a function like macro to imply that it must be followed by a semicolon
  955. # if __has_cpp_attribute(fallthrough)
  956. # define _LIBCPP_FALLTHROUGH() [[fallthrough]]
  957. # elif __has_attribute(__fallthrough__)
  958. # define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
  959. # else
  960. # define _LIBCPP_FALLTHROUGH() ((void)0)
  961. # endif
  962. # if __has_cpp_attribute(_Clang::__lifetimebound__)
  963. # define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]]
  964. # else
  965. # define _LIBCPP_LIFETIMEBOUND
  966. # endif
  967. # if defined(_LIBCPP_COMPILER_CLANG_BASED)
  968. # define _LIBCPP_REINITIALIZES_OBJECT [[clang::reinitializes]]
  969. # else
  970. # define _LIBCPP_REINITIALIZES_OBJECT
  971. # endif
  972. # if __has_attribute(__nodebug__) && !defined(__CUDACC__)
  973. # define _LIBCPP_NODEBUG __attribute__((__nodebug__))
  974. # else
  975. # define _LIBCPP_NODEBUG
  976. # endif
  977. # if __has_attribute(__standalone_debug__)
  978. # define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__))
  979. # else
  980. # define _LIBCPP_STANDALONE_DEBUG
  981. # endif
  982. # if __has_attribute(__preferred_name__)
  983. # define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
  984. # else
  985. # define _LIBCPP_PREFERRED_NAME(x)
  986. # endif
  987. // We often repeat things just for handling wide characters in the library.
  988. // When wide characters are disabled, it can be useful to have a quick way of
  989. // disabling it without having to resort to #if-#endif, which has a larger
  990. // impact on readability.
  991. # if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
  992. # define _LIBCPP_IF_WIDE_CHARACTERS(...)
  993. # else
  994. # define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__
  995. # endif
  996. # if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases) && !defined(__CUDACC__)
  997. # define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
  998. # else
  999. # define _LIBCPP_DECLSPEC_EMPTY_BASES
  1000. # endif
  1001. # if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
  1002. # define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
  1003. # define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
  1004. # define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
  1005. # define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
  1006. # define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
  1007. # endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
  1008. # if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES)
  1009. # define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS
  1010. # define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION
  1011. # define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS
  1012. # define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS
  1013. # define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR
  1014. # define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS
  1015. # endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES
  1016. // Yandex-specific: We build our own libc++, so it has everything available
  1017. # define _LIBCPP_DISABLE_AVAILABILITY
  1018. // End of Yandex-specific
  1019. # define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")")
  1020. # define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")")
  1021. # ifndef _LIBCPP_NO_AUTO_LINK
  1022. # if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
  1023. # if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
  1024. # pragma comment(lib, "c++.lib")
  1025. # else
  1026. # pragma comment(lib, "libc++.lib")
  1027. # endif
  1028. # endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
  1029. # endif // _LIBCPP_NO_AUTO_LINK
  1030. // Configures the fopen close-on-exec mode character, if any. This string will
  1031. // be appended to any mode string used by fstream for fopen/fdopen.
  1032. //
  1033. // Not all platforms support this, but it helps avoid fd-leaks on platforms that
  1034. // do.
  1035. # if defined(__BIONIC__)
  1036. # define _LIBCPP_FOPEN_CLOEXEC_MODE "e"
  1037. # else
  1038. # define _LIBCPP_FOPEN_CLOEXEC_MODE
  1039. # endif
  1040. // Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set
  1041. // of functions used in cstdio may not be available for low API levels when
  1042. // using 64-bit file offsets on LP32.
  1043. # if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24
  1044. # define _LIBCPP_HAS_NO_FGETPOS_FSETPOS
  1045. # endif
  1046. # if __has_attribute(__init_priority__)
  1047. # define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100)))
  1048. # else
  1049. # define _LIBCPP_INIT_PRIORITY_MAX
  1050. # endif
  1051. # if __has_attribute(__format__)
  1052. // The attribute uses 1-based indices for ordinary and static member functions.
  1053. // The attribute uses 2-based indices for non-static member functions.
  1054. # define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \
  1055. __attribute__((__format__(archetype, format_string_index, first_format_arg_index)))
  1056. # else
  1057. # define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */
  1058. # endif
  1059. # if __has_cpp_attribute(msvc::no_unique_address)
  1060. // MSVC implements [[no_unique_address]] as a silent no-op currently.
  1061. // (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.)
  1062. // However, MSVC implements [[msvc::no_unique_address]] which does what
  1063. // [[no_unique_address]] is supposed to do, in general.
  1064. // Clang-cl does not yet (14.0) implement either [[no_unique_address]] or
  1065. // [[msvc::no_unique_address]] though. If/when it does implement
  1066. // [[msvc::no_unique_address]], this should be preferred though.
  1067. # define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]]
  1068. # elif __has_cpp_attribute(no_unique_address)
  1069. # define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]]
  1070. # else
  1071. # define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */
  1072. // Note that this can be replaced by #error as soon as clang-cl
  1073. // implements msvc::no_unique_address, since there should be no C++20
  1074. // compiler that doesn't support one of the two attributes at that point.
  1075. // We generally don't want to use this macro outside of C++20-only code,
  1076. // because using it conditionally in one language version only would make
  1077. // the ABI inconsistent.
  1078. # endif
  1079. # ifdef _LIBCPP_COMPILER_CLANG_BASED
  1080. # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
  1081. # define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
  1082. # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str))
  1083. # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
  1084. # elif defined(_LIBCPP_COMPILER_GCC)
  1085. # define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
  1086. # define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
  1087. # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
  1088. # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str))
  1089. # else
  1090. # define _LIBCPP_DIAGNOSTIC_PUSH
  1091. # define _LIBCPP_DIAGNOSTIC_POP
  1092. # define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str)
  1093. # define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str)
  1094. # endif
  1095. # if defined(_AIX) && !defined(_LIBCPP_COMPILER_GCC)
  1096. # define _LIBCPP_PACKED_BYTE_FOR_AIX _Pragma("pack(1)")
  1097. # define _LIBCPP_PACKED_BYTE_FOR_AIX_END _Pragma("pack(pop)")
  1098. # else
  1099. # define _LIBCPP_PACKED_BYTE_FOR_AIX /* empty */
  1100. # define _LIBCPP_PACKED_BYTE_FOR_AIX_END /* empty */
  1101. # endif
  1102. # if __has_attribute(__packed__) && !defined(__CUDACC__)
  1103. # define _LIBCPP_PACKED __attribute__((__packed__))
  1104. # else
  1105. # define _LIBCPP_PACKED
  1106. # endif
  1107. // c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these
  1108. // functions is gradually being added to existing C libraries. The conditions
  1109. // below check for known C library versions and conditions under which these
  1110. // functions are declared by the C library.
  1111. # define _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8
  1112. // GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if
  1113. // __cpp_char8_t is defined or if C2X extensions are enabled. Determining
  1114. // the latter depends on internal GNU libc details that are not appropriate
  1115. // to depend on here, so any declarations present when __cpp_char8_t is not
  1116. // defined are ignored.
  1117. # if defined(_LIBCPP_GLIBC_PREREQ)
  1118. # if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
  1119. # undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8
  1120. # endif
  1121. # endif
  1122. // There are a handful of public standard library types that are intended to
  1123. // support CTAD but don't need any explicit deduction guides to do so. This
  1124. // macro is used to mark them as such, which suppresses the
  1125. // '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code
  1126. // with these classes.
  1127. #if _LIBCPP_STD_VER >= 17
  1128. # define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \
  1129. template <class ..._Tag> \
  1130. _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...>
  1131. #else
  1132. # define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "")
  1133. #endif
  1134. // TODO(varconst): currently, there are bugs in Clang's intrinsics when handling Objective-C++ `id`, so don't use
  1135. // compiler intrinsics in the Objective-C++ mode.
  1136. # ifdef __OBJC__
  1137. # define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS
  1138. # endif
  1139. #endif // __cplusplus
  1140. #endif // _LIBCPP___CONFIG