xref: /aosp_15_r20/external/libcxx/include/__config (revision 58b9f456b02922dfdb1fad8a988d5fd8765ecb80)
1*58b9f456SAndroid Build Coastguard Worker// -*- C++ -*-
2*58b9f456SAndroid Build Coastguard Worker//===--------------------------- __config ---------------------------------===//
3*58b9f456SAndroid Build Coastguard Worker//
4*58b9f456SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
5*58b9f456SAndroid Build Coastguard Worker//
6*58b9f456SAndroid Build Coastguard Worker// This file is dual licensed under the MIT and the University of Illinois Open
7*58b9f456SAndroid Build Coastguard Worker// Source Licenses. See LICENSE.TXT for details.
8*58b9f456SAndroid Build Coastguard Worker//
9*58b9f456SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
10*58b9f456SAndroid Build Coastguard Worker
11*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CONFIG
12*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CONFIG
13*58b9f456SAndroid Build Coastguard Worker
14*58b9f456SAndroid Build Coastguard Worker#if defined(_MSC_VER) && !defined(__clang__)
15*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
17*58b9f456SAndroid Build Coastguard Worker#  endif
18*58b9f456SAndroid Build Coastguard Worker#endif
19*58b9f456SAndroid Build Coastguard Worker
20*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
21*58b9f456SAndroid Build Coastguard Worker#pragma GCC system_header
22*58b9f456SAndroid Build Coastguard Worker#endif
23*58b9f456SAndroid Build Coastguard Worker
24*58b9f456SAndroid Build Coastguard Worker#ifdef __cplusplus
25*58b9f456SAndroid Build Coastguard Worker
26*58b9f456SAndroid Build Coastguard Worker#ifdef __GNUC__
27*58b9f456SAndroid Build Coastguard Worker#  define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
28*58b9f456SAndroid Build Coastguard Worker// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme
29*58b9f456SAndroid Build Coastguard Worker// introduced in GCC 5.0.
30*58b9f456SAndroid Build Coastguard Worker#  define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__)
31*58b9f456SAndroid Build Coastguard Worker#else
32*58b9f456SAndroid Build Coastguard Worker#  define _GNUC_VER 0
33*58b9f456SAndroid Build Coastguard Worker#  define _GNUC_VER_NEW 0
34*58b9f456SAndroid Build Coastguard Worker#endif
35*58b9f456SAndroid Build Coastguard Worker
36*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_VERSION 8000
37*58b9f456SAndroid Build Coastguard Worker
38*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_ABI_VERSION
39*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_VERSION 1
40*58b9f456SAndroid Build Coastguard Worker#endif
41*58b9f456SAndroid Build Coastguard Worker
42*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_STD_VER
43*58b9f456SAndroid Build Coastguard Worker#  if  __cplusplus <= 201103L
44*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_STD_VER 11
45*58b9f456SAndroid Build Coastguard Worker#  elif __cplusplus <= 201402L
46*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_STD_VER 14
47*58b9f456SAndroid Build Coastguard Worker#  elif __cplusplus <= 201703L
48*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_STD_VER 17
49*58b9f456SAndroid Build Coastguard Worker#  else
50*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_STD_VER 18  // current year, or date of c++2a ratification
51*58b9f456SAndroid Build Coastguard Worker#  endif
52*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_STD_VER
53*58b9f456SAndroid Build Coastguard Worker
54*58b9f456SAndroid Build Coastguard Worker#if defined(__ELF__)
55*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_OBJECT_FORMAT_ELF   1
56*58b9f456SAndroid Build Coastguard Worker#elif defined(__MACH__)
57*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_OBJECT_FORMAT_MACHO 1
58*58b9f456SAndroid Build Coastguard Worker#elif defined(_WIN32)
59*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_OBJECT_FORMAT_COFF  1
60*58b9f456SAndroid Build Coastguard Worker#elif defined(__wasm__)
61*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_OBJECT_FORMAT_WASM  1
62*58b9f456SAndroid Build Coastguard Worker#else
63*58b9f456SAndroid Build Coastguard Worker#  error Unknown object file format
64*58b9f456SAndroid Build Coastguard Worker#endif
65*58b9f456SAndroid Build Coastguard Worker
66*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
67*58b9f456SAndroid Build Coastguard Worker// Change short string representation so that string data starts at offset 0,
68*58b9f456SAndroid Build Coastguard Worker// improving its alignment in some cases.
69*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
70*58b9f456SAndroid Build Coastguard Worker// Fix deque iterator type in order to support incomplete types.
71*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
72*58b9f456SAndroid Build Coastguard Worker// Fix undefined behavior in how std::list stores its linked nodes.
73*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
74*58b9f456SAndroid Build Coastguard Worker// Fix undefined behavior in  how __tree stores its end and parent nodes.
75*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
76*58b9f456SAndroid Build Coastguard Worker// Fix undefined behavior in how __hash_table stores its pointer types.
77*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
78*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
79*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
80*58b9f456SAndroid Build Coastguard Worker// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
81*58b9f456SAndroid Build Coastguard Worker// provided under the alternate keyword __nullptr, which changes the mangling
82*58b9f456SAndroid Build Coastguard Worker// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
83*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR
84*58b9f456SAndroid Build Coastguard Worker// Define the `pointer_safety` enum as a C++11 strongly typed enumeration
85*58b9f456SAndroid Build Coastguard Worker// instead of as a class simulating an enum. If this option is enabled
86*58b9f456SAndroid Build Coastguard Worker// `pointer_safety` and `get_pointer_safety()` will no longer be available
87*58b9f456SAndroid Build Coastguard Worker// in C++03.
88*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
89*58b9f456SAndroid Build Coastguard Worker// Define a key function for `bad_function_call` in the library, to centralize
90*58b9f456SAndroid Build Coastguard Worker// its vtable and typeinfo to libc++ rather than having all other libraries
91*58b9f456SAndroid Build Coastguard Worker// using that class define their own copies.
92*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
93*58b9f456SAndroid Build Coastguard Worker// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
94*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
95*58b9f456SAndroid Build Coastguard Worker// Use the smallest possible integer type to represent the index of the variant.
96*58b9f456SAndroid Build Coastguard Worker// Previously libc++ used "unsigned int" exclusivly.
97*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
98*58b9f456SAndroid Build Coastguard Worker// Unstable attempt to provide a more optimized std::function
99*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_OPTIMIZED_FUNCTION
100*58b9f456SAndroid Build Coastguard Worker#elif _LIBCPP_ABI_VERSION == 1
101*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
102*58b9f456SAndroid Build Coastguard Worker// Enable compiling copies of now inline methods into the dylib to support
103*58b9f456SAndroid Build Coastguard Worker// applications compiled against older libraries. This is unnecessary with
104*58b9f456SAndroid Build Coastguard Worker// COFF dllexport semantics, since dllexport forces a non-inline definition
105*58b9f456SAndroid Build Coastguard Worker// of inline functions to be emitted anyway. Our own non-inline copy would
106*58b9f456SAndroid Build Coastguard Worker// conflict with the dllexport-emitted copy, so we disable it.
107*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
108*58b9f456SAndroid Build Coastguard Worker#  endif
109*58b9f456SAndroid Build Coastguard Worker// Feature macros for disabling pre ABI v1 features. All of these options
110*58b9f456SAndroid Build Coastguard Worker// are deprecated.
111*58b9f456SAndroid Build Coastguard Worker#  if defined(__FreeBSD__)
112*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR
113*58b9f456SAndroid Build Coastguard Worker#  endif
114*58b9f456SAndroid Build Coastguard Worker#endif
115*58b9f456SAndroid Build Coastguard Worker
116*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
117*58b9f456SAndroid Build Coastguard Worker#error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
118*58b9f456SAndroid Build Coastguard Worker       use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
119*58b9f456SAndroid Build Coastguard Worker#endif
120*58b9f456SAndroid Build Coastguard Worker
121*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
122*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
123*58b9f456SAndroid Build Coastguard Worker
124*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_ABI_NAMESPACE
125*58b9f456SAndroid Build Coastguard Worker# define _LIBCPP_ABI_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION)
126*58b9f456SAndroid Build Coastguard Worker#endif
127*58b9f456SAndroid Build Coastguard Worker
128*58b9f456SAndroid Build Coastguard Worker#if __cplusplus < 201103L
129*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CXX03_LANG
130*58b9f456SAndroid Build Coastguard Worker#endif
131*58b9f456SAndroid Build Coastguard Worker
132*58b9f456SAndroid Build Coastguard Worker#ifndef __has_attribute
133*58b9f456SAndroid Build Coastguard Worker#define __has_attribute(__x) 0
134*58b9f456SAndroid Build Coastguard Worker#endif
135*58b9f456SAndroid Build Coastguard Worker
136*58b9f456SAndroid Build Coastguard Worker#ifndef __has_builtin
137*58b9f456SAndroid Build Coastguard Worker#define __has_builtin(__x) 0
138*58b9f456SAndroid Build Coastguard Worker#endif
139*58b9f456SAndroid Build Coastguard Worker
140*58b9f456SAndroid Build Coastguard Worker#ifndef __has_extension
141*58b9f456SAndroid Build Coastguard Worker#define __has_extension(__x) 0
142*58b9f456SAndroid Build Coastguard Worker#endif
143*58b9f456SAndroid Build Coastguard Worker
144*58b9f456SAndroid Build Coastguard Worker#ifndef __has_feature
145*58b9f456SAndroid Build Coastguard Worker#define __has_feature(__x) 0
146*58b9f456SAndroid Build Coastguard Worker#endif
147*58b9f456SAndroid Build Coastguard Worker
148*58b9f456SAndroid Build Coastguard Worker#ifndef __has_cpp_attribute
149*58b9f456SAndroid Build Coastguard Worker#define __has_cpp_attribute(__x) 0
150*58b9f456SAndroid Build Coastguard Worker#endif
151*58b9f456SAndroid Build Coastguard Worker
152*58b9f456SAndroid Build Coastguard Worker// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
153*58b9f456SAndroid Build Coastguard Worker// the compiler and '1' otherwise.
154*58b9f456SAndroid Build Coastguard Worker#ifndef __is_identifier
155*58b9f456SAndroid Build Coastguard Worker#define __is_identifier(__x) 1
156*58b9f456SAndroid Build Coastguard Worker#endif
157*58b9f456SAndroid Build Coastguard Worker
158*58b9f456SAndroid Build Coastguard Worker#ifndef __has_declspec_attribute
159*58b9f456SAndroid Build Coastguard Worker#define __has_declspec_attribute(__x) 0
160*58b9f456SAndroid Build Coastguard Worker#endif
161*58b9f456SAndroid Build Coastguard Worker
162*58b9f456SAndroid Build Coastguard Worker#define __has_keyword(__x) !(__is_identifier(__x))
163*58b9f456SAndroid Build Coastguard Worker
164*58b9f456SAndroid Build Coastguard Worker#ifndef __has_include
165*58b9f456SAndroid Build Coastguard Worker#define __has_include(...) 0
166*58b9f456SAndroid Build Coastguard Worker#endif
167*58b9f456SAndroid Build Coastguard Worker
168*58b9f456SAndroid Build Coastguard Worker#if defined(__clang__)
169*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_COMPILER_CLANG
170*58b9f456SAndroid Build Coastguard Worker#  ifndef __apple_build_version__
171*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
172*58b9f456SAndroid Build Coastguard Worker#  endif
173*58b9f456SAndroid Build Coastguard Worker#elif defined(__GNUC__)
174*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_COMPILER_GCC
175*58b9f456SAndroid Build Coastguard Worker#elif defined(_MSC_VER)
176*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_COMPILER_MSVC
177*58b9f456SAndroid Build Coastguard Worker#elif defined(__IBMCPP__)
178*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_COMPILER_IBM
179*58b9f456SAndroid Build Coastguard Worker#endif
180*58b9f456SAndroid Build Coastguard Worker
181*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CLANG_VER
182*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CLANG_VER 0
183*58b9f456SAndroid Build Coastguard Worker#endif
184*58b9f456SAndroid Build Coastguard Worker
185*58b9f456SAndroid Build Coastguard Worker// FIXME: ABI detection should be done via compiler builtin macros. This
186*58b9f456SAndroid Build Coastguard Worker// is just a placeholder until Clang implements such macros. For now assume
187*58b9f456SAndroid Build Coastguard Worker// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
188*58b9f456SAndroid Build Coastguard Worker// and allow the user to explicitly specify the ABI to handle cases where this
189*58b9f456SAndroid Build Coastguard Worker// heuristic falls short.
190*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT)
191*58b9f456SAndroid Build Coastguard Worker#  error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined"
192*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_ABI_FORCE_ITANIUM)
193*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_ITANIUM
194*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT)
195*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_ABI_MICROSOFT
196*58b9f456SAndroid Build Coastguard Worker#else
197*58b9f456SAndroid Build Coastguard Worker#  if defined(_WIN32) && defined(_MSC_VER)
198*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_ABI_MICROSOFT
199*58b9f456SAndroid Build Coastguard Worker#  else
200*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_ABI_ITANIUM
201*58b9f456SAndroid Build Coastguard Worker#  endif
202*58b9f456SAndroid Build Coastguard Worker#endif
203*58b9f456SAndroid Build Coastguard Worker
204*58b9f456SAndroid Build Coastguard Worker// Need to detect which libc we're using if we're on Linux.
205*58b9f456SAndroid Build Coastguard Worker#if defined(__linux__)
206*58b9f456SAndroid Build Coastguard Worker#  include <features.h>
207*58b9f456SAndroid Build Coastguard Worker#  if defined(__GLIBC_PREREQ)
208*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
209*58b9f456SAndroid Build Coastguard Worker#  else
210*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_GLIBC_PREREQ(a, b) 0
211*58b9f456SAndroid Build Coastguard Worker#  endif // defined(__GLIBC_PREREQ)
212*58b9f456SAndroid Build Coastguard Worker#endif // defined(__linux__)
213*58b9f456SAndroid Build Coastguard Worker
214*58b9f456SAndroid Build Coastguard Worker#ifdef __LITTLE_ENDIAN__
215*58b9f456SAndroid Build Coastguard Worker#  if __LITTLE_ENDIAN__
216*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_LITTLE_ENDIAN
217*58b9f456SAndroid Build Coastguard Worker#  endif  // __LITTLE_ENDIAN__
218*58b9f456SAndroid Build Coastguard Worker#endif  // __LITTLE_ENDIAN__
219*58b9f456SAndroid Build Coastguard Worker
220*58b9f456SAndroid Build Coastguard Worker#ifdef __BIG_ENDIAN__
221*58b9f456SAndroid Build Coastguard Worker#  if __BIG_ENDIAN__
222*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_BIG_ENDIAN
223*58b9f456SAndroid Build Coastguard Worker#  endif  // __BIG_ENDIAN__
224*58b9f456SAndroid Build Coastguard Worker#endif  // __BIG_ENDIAN__
225*58b9f456SAndroid Build Coastguard Worker
226*58b9f456SAndroid Build Coastguard Worker#ifdef __BYTE_ORDER__
227*58b9f456SAndroid Build Coastguard Worker#  if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
228*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_LITTLE_ENDIAN
229*58b9f456SAndroid Build Coastguard Worker#  elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
230*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_BIG_ENDIAN
231*58b9f456SAndroid Build Coastguard Worker#  endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
232*58b9f456SAndroid Build Coastguard Worker#endif // __BYTE_ORDER__
233*58b9f456SAndroid Build Coastguard Worker
234*58b9f456SAndroid Build Coastguard Worker#ifdef __FreeBSD__
235*58b9f456SAndroid Build Coastguard Worker#  include <sys/endian.h>
236*58b9f456SAndroid Build Coastguard Worker#  if _BYTE_ORDER == _LITTLE_ENDIAN
237*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_LITTLE_ENDIAN
238*58b9f456SAndroid Build Coastguard Worker#  else  // _BYTE_ORDER == _LITTLE_ENDIAN
239*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_BIG_ENDIAN
240*58b9f456SAndroid Build Coastguard Worker#  endif  // _BYTE_ORDER == _LITTLE_ENDIAN
241*58b9f456SAndroid Build Coastguard Worker#  ifndef __LONG_LONG_SUPPORTED
242*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_NO_LONG_LONG
243*58b9f456SAndroid Build Coastguard Worker#  endif  // __LONG_LONG_SUPPORTED
244*58b9f456SAndroid Build Coastguard Worker#endif  // __FreeBSD__
245*58b9f456SAndroid Build Coastguard Worker
246*58b9f456SAndroid Build Coastguard Worker#ifdef __NetBSD__
247*58b9f456SAndroid Build Coastguard Worker#  include <sys/endian.h>
248*58b9f456SAndroid Build Coastguard Worker#  if _BYTE_ORDER == _LITTLE_ENDIAN
249*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_LITTLE_ENDIAN
250*58b9f456SAndroid Build Coastguard Worker#  else  // _BYTE_ORDER == _LITTLE_ENDIAN
251*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_BIG_ENDIAN
252*58b9f456SAndroid Build Coastguard Worker#  endif  // _BYTE_ORDER == _LITTLE_ENDIAN
253*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_QUICK_EXIT
254*58b9f456SAndroid Build Coastguard Worker#endif  // __NetBSD__
255*58b9f456SAndroid Build Coastguard Worker
256*58b9f456SAndroid Build Coastguard Worker#if defined(_WIN32)
257*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_WIN32API
258*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_LITTLE_ENDIAN
259*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_SHORT_WCHAR   1
260*58b9f456SAndroid Build Coastguard Worker// Both MinGW and native MSVC provide a "MSVC"-like enviroment
261*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_MSVCRT_LIKE
262*58b9f456SAndroid Build Coastguard Worker// If mingw not explicitly detected, assume using MS C runtime only if
263*58b9f456SAndroid Build Coastguard Worker// a MS compatibility version is specified.
264*58b9f456SAndroid Build Coastguard Worker#  if defined(_MSC_VER) && !defined(__MINGW32__)
265*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
266*58b9f456SAndroid Build Coastguard Worker#  endif
267*58b9f456SAndroid Build Coastguard Worker#  if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
268*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_BITSCAN64
269*58b9f456SAndroid Build Coastguard Worker#  endif
270*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_OPEN_WITH_WCHAR
271*58b9f456SAndroid Build Coastguard Worker#  if defined(_LIBCPP_MSVCRT)
272*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_QUICK_EXIT
273*58b9f456SAndroid Build Coastguard Worker#  endif
274*58b9f456SAndroid Build Coastguard Worker
275*58b9f456SAndroid Build Coastguard Worker// Some CRT APIs are unavailable to store apps
276*58b9f456SAndroid Build Coastguard Worker#  if defined(WINAPI_FAMILY)
277*58b9f456SAndroid Build Coastguard Worker#    include <winapifamily.h>
278*58b9f456SAndroid Build Coastguard Worker#    if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) &&                  \
279*58b9f456SAndroid Build Coastguard Worker        (!defined(WINAPI_PARTITION_SYSTEM) ||                                  \
280*58b9f456SAndroid Build Coastguard Worker         !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
281*58b9f456SAndroid Build Coastguard Worker#      define _LIBCPP_WINDOWS_STORE_APP
282*58b9f456SAndroid Build Coastguard Worker#    endif
283*58b9f456SAndroid Build Coastguard Worker#  endif
284*58b9f456SAndroid Build Coastguard Worker#endif // defined(_WIN32)
285*58b9f456SAndroid Build Coastguard Worker
286*58b9f456SAndroid Build Coastguard Worker#ifdef __sun__
287*58b9f456SAndroid Build Coastguard Worker#  include <sys/isa_defs.h>
288*58b9f456SAndroid Build Coastguard Worker#  ifdef _LITTLE_ENDIAN
289*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_LITTLE_ENDIAN
290*58b9f456SAndroid Build Coastguard Worker#  else
291*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_BIG_ENDIAN
292*58b9f456SAndroid Build Coastguard Worker#  endif
293*58b9f456SAndroid Build Coastguard Worker#endif // __sun__
294*58b9f456SAndroid Build Coastguard Worker
295*58b9f456SAndroid Build Coastguard Worker#if defined(__CloudABI__)
296*58b9f456SAndroid Build Coastguard Worker   // Certain architectures provide arc4random(). Prefer using
297*58b9f456SAndroid Build Coastguard Worker   // arc4random() over /dev/{u,}random to make it possible to obtain
298*58b9f456SAndroid Build Coastguard Worker   // random data even when using sandboxing mechanisms such as chroots,
299*58b9f456SAndroid Build Coastguard Worker   // Capsicum, etc.
300*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_USING_ARC4_RANDOM
301*58b9f456SAndroid Build Coastguard Worker#elif defined(__Fuchsia__)
302*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_USING_GETENTROPY
303*58b9f456SAndroid Build Coastguard Worker#elif defined(__native_client__)
304*58b9f456SAndroid Build Coastguard Worker   // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
305*58b9f456SAndroid Build Coastguard Worker   // including accesses to the special files under /dev. C++11's
306*58b9f456SAndroid Build Coastguard Worker   // std::random_device is instead exposed through a NaCl syscall.
307*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_USING_NACL_RANDOM
308*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_WIN32API)
309*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_USING_WIN32_RANDOM
310*58b9f456SAndroid Build Coastguard Worker#else
311*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_USING_DEV_RANDOM
312*58b9f456SAndroid Build Coastguard Worker#endif
313*58b9f456SAndroid Build Coastguard Worker
314*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
315*58b9f456SAndroid Build Coastguard Worker#  include <endian.h>
316*58b9f456SAndroid Build Coastguard Worker#  if __BYTE_ORDER == __LITTLE_ENDIAN
317*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_LITTLE_ENDIAN
318*58b9f456SAndroid Build Coastguard Worker#  elif __BYTE_ORDER == __BIG_ENDIAN
319*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_BIG_ENDIAN
320*58b9f456SAndroid Build Coastguard Worker#  else  // __BYTE_ORDER == __BIG_ENDIAN
321*58b9f456SAndroid Build Coastguard Worker#    error unable to determine endian
322*58b9f456SAndroid Build Coastguard Worker#  endif
323*58b9f456SAndroid Build Coastguard Worker#endif  // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
324*58b9f456SAndroid Build Coastguard Worker
325*58b9f456SAndroid Build Coastguard Worker#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
326*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
327*58b9f456SAndroid Build Coastguard Worker#else
328*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NO_CFI
329*58b9f456SAndroid Build Coastguard Worker#endif
330*58b9f456SAndroid Build Coastguard Worker
331*58b9f456SAndroid Build Coastguard Worker#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
332*58b9f456SAndroid Build Coastguard Worker#  if defined(__FreeBSD__)
333*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_QUICK_EXIT
334*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_C11_FEATURES
335*58b9f456SAndroid Build Coastguard Worker#  elif defined(__Fuchsia__)
336*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_QUICK_EXIT
337*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_TIMESPEC_GET
338*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_C11_FEATURES
339*58b9f456SAndroid Build Coastguard Worker#  elif defined(__linux__)
340*58b9f456SAndroid Build Coastguard Worker#    if !defined(_LIBCPP_HAS_MUSL_LIBC)
341*58b9f456SAndroid Build Coastguard Worker#      if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
342*58b9f456SAndroid Build Coastguard Worker#        define _LIBCPP_HAS_QUICK_EXIT
343*58b9f456SAndroid Build Coastguard Worker#      endif
344*58b9f456SAndroid Build Coastguard Worker#      if _LIBCPP_GLIBC_PREREQ(2, 17)
345*58b9f456SAndroid Build Coastguard Worker#        define _LIBCPP_HAS_C11_FEATURES
346*58b9f456SAndroid Build Coastguard Worker#        define _LIBCPP_HAS_TIMESPEC_GET
347*58b9f456SAndroid Build Coastguard Worker#      endif
348*58b9f456SAndroid Build Coastguard Worker#    else // defined(_LIBCPP_HAS_MUSL_LIBC)
349*58b9f456SAndroid Build Coastguard Worker#      define _LIBCPP_HAS_QUICK_EXIT
350*58b9f456SAndroid Build Coastguard Worker#      define _LIBCPP_HAS_TIMESPEC_GET
351*58b9f456SAndroid Build Coastguard Worker#      define _LIBCPP_HAS_C11_FEATURES
352*58b9f456SAndroid Build Coastguard Worker#    endif
353*58b9f456SAndroid Build Coastguard Worker#  endif // __linux__
354*58b9f456SAndroid Build Coastguard Worker#endif
355*58b9f456SAndroid Build Coastguard Worker
356*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_COMPILER_CLANG)
357*58b9f456SAndroid Build Coastguard Worker
358*58b9f456SAndroid Build Coastguard Worker// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
359*58b9f456SAndroid Build Coastguard Worker// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
360*58b9f456SAndroid Build Coastguard Worker#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) &&       \
361*58b9f456SAndroid Build Coastguard Worker     (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) ||                           \
362*58b9f456SAndroid Build Coastguard Worker    defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
363*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
364*58b9f456SAndroid Build Coastguard Worker#endif
365*58b9f456SAndroid Build Coastguard Worker
366*58b9f456SAndroid Build Coastguard Worker#if __has_feature(cxx_alignas)
367*58b9f456SAndroid Build Coastguard Worker#  define _ALIGNAS_TYPE(x) alignas(x)
368*58b9f456SAndroid Build Coastguard Worker#  define _ALIGNAS(x) alignas(x)
369*58b9f456SAndroid Build Coastguard Worker#else
370*58b9f456SAndroid Build Coastguard Worker#  define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
371*58b9f456SAndroid Build Coastguard Worker#  define _ALIGNAS(x) __attribute__((__aligned__(x)))
372*58b9f456SAndroid Build Coastguard Worker#endif
373*58b9f456SAndroid Build Coastguard Worker
374*58b9f456SAndroid Build Coastguard Worker#if __cplusplus < 201103L
375*58b9f456SAndroid Build Coastguard Workertypedef __char16_t char16_t;
376*58b9f456SAndroid Build Coastguard Workertypedef __char32_t char32_t;
377*58b9f456SAndroid Build Coastguard Worker#endif
378*58b9f456SAndroid Build Coastguard Worker
379*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_exceptions)) && !defined(_LIBCPP_NO_EXCEPTIONS)
380*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NO_EXCEPTIONS
381*58b9f456SAndroid Build Coastguard Worker#endif
382*58b9f456SAndroid Build Coastguard Worker
383*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI)
384*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NO_RTTI
385*58b9f456SAndroid Build Coastguard Worker#endif
386*58b9f456SAndroid Build Coastguard Worker
387*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_strong_enums))
388*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_STRONG_ENUMS
389*58b9f456SAndroid Build Coastguard Worker#endif
390*58b9f456SAndroid Build Coastguard Worker
391*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_decltype))
392*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_DECLTYPE
393*58b9f456SAndroid Build Coastguard Worker#endif
394*58b9f456SAndroid Build Coastguard Worker
395*58b9f456SAndroid Build Coastguard Worker#if __has_feature(cxx_attributes)
396*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NORETURN [[noreturn]]
397*58b9f456SAndroid Build Coastguard Worker#else
398*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NORETURN __attribute__ ((noreturn))
399*58b9f456SAndroid Build Coastguard Worker#endif
400*58b9f456SAndroid Build Coastguard Worker
401*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_lambdas))
402*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_LAMBDAS
403*58b9f456SAndroid Build Coastguard Worker#endif
404*58b9f456SAndroid Build Coastguard Worker
405*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_nullptr))
406*58b9f456SAndroid Build Coastguard Worker#  if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
407*58b9f456SAndroid Build Coastguard Worker#    define nullptr __nullptr
408*58b9f456SAndroid Build Coastguard Worker#  else
409*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_NO_NULLPTR
410*58b9f456SAndroid Build Coastguard Worker#  endif
411*58b9f456SAndroid Build Coastguard Worker#endif
412*58b9f456SAndroid Build Coastguard Worker
413*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_rvalue_references))
414*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
415*58b9f456SAndroid Build Coastguard Worker#endif
416*58b9f456SAndroid Build Coastguard Worker
417*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_auto_type))
418*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_AUTO_TYPE
419*58b9f456SAndroid Build Coastguard Worker#endif
420*58b9f456SAndroid Build Coastguard Worker
421*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_variadic_templates))
422*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIADICS
423*58b9f456SAndroid Build Coastguard Worker#endif
424*58b9f456SAndroid Build Coastguard Worker
425*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_generalized_initializers))
426*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
427*58b9f456SAndroid Build Coastguard Worker#endif
428*58b9f456SAndroid Build Coastguard Worker
429*58b9f456SAndroid Build Coastguard Worker#if __has_feature(is_base_of)
430*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_IS_BASE_OF
431*58b9f456SAndroid Build Coastguard Worker#endif
432*58b9f456SAndroid Build Coastguard Worker
433*58b9f456SAndroid Build Coastguard Worker#if __has_feature(is_final)
434*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_IS_FINAL
435*58b9f456SAndroid Build Coastguard Worker#endif
436*58b9f456SAndroid Build Coastguard Worker
437*58b9f456SAndroid Build Coastguard Worker// Objective-C++ features (opt-in)
438*58b9f456SAndroid Build Coastguard Worker#if __has_feature(objc_arc)
439*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_OBJC_ARC
440*58b9f456SAndroid Build Coastguard Worker#endif
441*58b9f456SAndroid Build Coastguard Worker
442*58b9f456SAndroid Build Coastguard Worker#if __has_feature(objc_arc_weak)
443*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_OBJC_ARC_WEAK
444*58b9f456SAndroid Build Coastguard Worker#endif
445*58b9f456SAndroid Build Coastguard Worker
446*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_constexpr))
447*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_CONSTEXPR
448*58b9f456SAndroid Build Coastguard Worker#endif
449*58b9f456SAndroid Build Coastguard Worker
450*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_relaxed_constexpr))
451*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
452*58b9f456SAndroid Build Coastguard Worker#endif
453*58b9f456SAndroid Build Coastguard Worker
454*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_variable_templates))
455*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
456*58b9f456SAndroid Build Coastguard Worker#endif
457*58b9f456SAndroid Build Coastguard Worker
458*58b9f456SAndroid Build Coastguard Worker#if !(__has_feature(cxx_noexcept))
459*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NOEXCEPT
460*58b9f456SAndroid Build Coastguard Worker#endif
461*58b9f456SAndroid Build Coastguard Worker
462*58b9f456SAndroid Build Coastguard Worker#if __has_feature(underlying_type)
463*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
464*58b9f456SAndroid Build Coastguard Worker#endif
465*58b9f456SAndroid Build Coastguard Worker
466*58b9f456SAndroid Build Coastguard Worker#if __has_feature(is_literal)
467*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_IS_LITERAL(T) __is_literal(T)
468*58b9f456SAndroid Build Coastguard Worker#endif
469*58b9f456SAndroid Build Coastguard Worker
470*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
471*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_ASAN
472*58b9f456SAndroid Build Coastguard Worker#endif
473*58b9f456SAndroid Build Coastguard Worker
474*58b9f456SAndroid Build Coastguard Worker// Allow for build-time disabling of unsigned integer sanitization
475*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
476*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
477*58b9f456SAndroid Build Coastguard Worker#endif
478*58b9f456SAndroid Build Coastguard Worker
479*58b9f456SAndroid Build Coastguard Worker#if __has_builtin(__builtin_launder)
480*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
481*58b9f456SAndroid Build Coastguard Worker#endif
482*58b9f456SAndroid Build Coastguard Worker
483*58b9f456SAndroid Build Coastguard Worker#if !__is_identifier(__has_unique_object_representations)
484*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
485*58b9f456SAndroid Build Coastguard Worker#endif
486*58b9f456SAndroid Build Coastguard Worker
487*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
488*58b9f456SAndroid Build Coastguard Worker
489*58b9f456SAndroid Build Coastguard Worker// No apple compilers support ""d and ""y at this time.
490*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__)
491*58b9f456SAndroid Build Coastguard Worker#define	_LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
492*58b9f456SAndroid Build Coastguard Worker#endif
493*58b9f456SAndroid Build Coastguard Worker
494*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_COMPILER_GCC)
495*58b9f456SAndroid Build Coastguard Worker
496*58b9f456SAndroid Build Coastguard Worker#define _ALIGNAS(x) __attribute__((__aligned__(x)))
497*58b9f456SAndroid Build Coastguard Worker#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
498*58b9f456SAndroid Build Coastguard Worker
499*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NORETURN __attribute__((noreturn))
500*58b9f456SAndroid Build Coastguard Worker
501*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER >= 407
502*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T)
503*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_IS_LITERAL(T) __is_literal_type(T)
504*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_IS_FINAL
505*58b9f456SAndroid Build Coastguard Worker#endif
506*58b9f456SAndroid Build Coastguard Worker
507*58b9f456SAndroid Build Coastguard Worker#if defined(__GNUC__) && _GNUC_VER >= 403
508*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_IS_BASE_OF
509*58b9f456SAndroid Build Coastguard Worker#endif
510*58b9f456SAndroid Build Coastguard Worker
511*58b9f456SAndroid Build Coastguard Worker#if !__EXCEPTIONS && !defined(_LIBCPP_NO_EXCEPTIONS)
512*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NO_EXCEPTIONS
513*58b9f456SAndroid Build Coastguard Worker#endif
514*58b9f456SAndroid Build Coastguard Worker
515*58b9f456SAndroid Build Coastguard Worker// constexpr was added to GCC in 4.6.
516*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER < 406
517*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_NO_CONSTEXPR
518*58b9f456SAndroid Build Coastguard Worker// Can only use constexpr in c++11 mode.
519*58b9f456SAndroid Build Coastguard Worker#elif !defined(__GXX_EXPERIMENTAL_CXX0X__) && __cplusplus < 201103L
520*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_NO_CONSTEXPR
521*58b9f456SAndroid Build Coastguard Worker#endif
522*58b9f456SAndroid Build Coastguard Worker
523*58b9f456SAndroid Build Coastguard Worker// Determine if GCC supports relaxed constexpr
524*58b9f456SAndroid Build Coastguard Worker#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
525*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
526*58b9f456SAndroid Build Coastguard Worker#endif
527*58b9f456SAndroid Build Coastguard Worker
528*58b9f456SAndroid Build Coastguard Worker// GCC 5 will support variable templates
529*58b9f456SAndroid Build Coastguard Worker#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
530*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
531*58b9f456SAndroid Build Coastguard Worker#endif
532*58b9f456SAndroid Build Coastguard Worker
533*58b9f456SAndroid Build Coastguard Worker#ifndef __GXX_EXPERIMENTAL_CXX0X__
534*58b9f456SAndroid Build Coastguard Worker
535*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_DECLTYPE
536*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NULLPTR
537*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_UNICODE_CHARS
538*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIADICS
539*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
540*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_STRONG_ENUMS
541*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NOEXCEPT
542*58b9f456SAndroid Build Coastguard Worker
543*58b9f456SAndroid Build Coastguard Worker#else  // __GXX_EXPERIMENTAL_CXX0X__
544*58b9f456SAndroid Build Coastguard Worker
545*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER < 403
546*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
547*58b9f456SAndroid Build Coastguard Worker#endif
548*58b9f456SAndroid Build Coastguard Worker
549*58b9f456SAndroid Build Coastguard Worker
550*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER < 404
551*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_DECLTYPE
552*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_UNICODE_CHARS
553*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIADICS
554*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
555*58b9f456SAndroid Build Coastguard Worker#endif  // _GNUC_VER < 404
556*58b9f456SAndroid Build Coastguard Worker
557*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER < 406
558*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NOEXCEPT
559*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NULLPTR
560*58b9f456SAndroid Build Coastguard Worker#endif
561*58b9f456SAndroid Build Coastguard Worker
562*58b9f456SAndroid Build Coastguard Worker#endif  // __GXX_EXPERIMENTAL_CXX0X__
563*58b9f456SAndroid Build Coastguard Worker
564*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
565*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_ASAN
566*58b9f456SAndroid Build Coastguard Worker#endif
567*58b9f456SAndroid Build Coastguard Worker
568*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER >= 700
569*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
570*58b9f456SAndroid Build Coastguard Worker#endif
571*58b9f456SAndroid Build Coastguard Worker
572*58b9f456SAndroid Build Coastguard Worker#if _GNUC_VER >= 700
573*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
574*58b9f456SAndroid Build Coastguard Worker#endif
575*58b9f456SAndroid Build Coastguard Worker
576*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
577*58b9f456SAndroid Build Coastguard Worker
578*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_COMPILER_MSVC)
579*58b9f456SAndroid Build Coastguard Worker
580*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_TOSTRING2(x) #x
581*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
582*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
583*58b9f456SAndroid Build Coastguard Worker
584*58b9f456SAndroid Build Coastguard Worker#if _MSC_VER < 1900
585*58b9f456SAndroid Build Coastguard Worker#error "MSVC versions prior to Visual Studio 2015 are not supported"
586*58b9f456SAndroid Build Coastguard Worker#endif
587*58b9f456SAndroid Build Coastguard Worker
588*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_IS_BASE_OF
589*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_CONSTEXPR
590*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
591*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
592*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NOEXCEPT
593*58b9f456SAndroid Build Coastguard Worker#define __alignof__ __alignof
594*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NORETURN __declspec(noreturn)
595*58b9f456SAndroid Build Coastguard Worker#define _ALIGNAS(x) __declspec(align(x))
596*58b9f456SAndroid Build Coastguard Worker#define _ALIGNAS_TYPE(x) alignas(x)
597*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIADICS
598*58b9f456SAndroid Build Coastguard Worker
599*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_WEAK
600*58b9f456SAndroid Build Coastguard Worker
601*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_ASAN
602*58b9f456SAndroid Build Coastguard Worker
603*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ALWAYS_INLINE __forceinline
604*58b9f456SAndroid Build Coastguard Worker
605*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
606*58b9f456SAndroid Build Coastguard Worker
607*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_COMPILER_IBM)
608*58b9f456SAndroid Build Coastguard Worker
609*58b9f456SAndroid Build Coastguard Worker#define _ALIGNAS(x) __attribute__((__aligned__(x)))
610*58b9f456SAndroid Build Coastguard Worker#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
611*58b9f456SAndroid Build Coastguard Worker#define _ATTRIBUTE(x) __attribute__((x))
612*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NORETURN __attribute__((noreturn))
613*58b9f456SAndroid Build Coastguard Worker
614*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
615*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NOEXCEPT
616*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_NULLPTR
617*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_UNICODE_CHARS
618*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_IS_BASE_OF
619*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_IS_FINAL
620*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
621*58b9f456SAndroid Build Coastguard Worker
622*58b9f456SAndroid Build Coastguard Worker#if defined(_AIX)
623*58b9f456SAndroid Build Coastguard Worker#define __MULTILOCALE_API
624*58b9f456SAndroid Build Coastguard Worker#endif
625*58b9f456SAndroid Build Coastguard Worker
626*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_ASAN
627*58b9f456SAndroid Build Coastguard Worker
628*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
629*58b9f456SAndroid Build Coastguard Worker
630*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_VECTOR_EXTENSION
631*58b9f456SAndroid Build Coastguard Worker
632*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
633*58b9f456SAndroid Build Coastguard Worker
634*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
635*58b9f456SAndroid Build Coastguard Worker
636*58b9f456SAndroid Build Coastguard Worker#ifdef _DLL
637*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CRT_FUNC __declspec(dllimport)
638*58b9f456SAndroid Build Coastguard Worker#else
639*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CRT_FUNC
640*58b9f456SAndroid Build Coastguard Worker#endif
641*58b9f456SAndroid Build Coastguard Worker
642*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
643*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DLL_VIS
644*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
645*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
646*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_OVERRIDABLE_FUNC_VIS
647*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPORTED_FROM_ABI
648*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_BUILDING_LIBRARY)
649*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DLL_VIS __declspec(dllexport)
650*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
651*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS
652*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS
653*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport)
654*58b9f456SAndroid Build Coastguard Worker#else
655*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DLL_VIS __declspec(dllimport)
656*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS
657*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
658*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_OVERRIDABLE_FUNC_VIS
659*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport)
660*58b9f456SAndroid Build Coastguard Worker#endif
661*58b9f456SAndroid Build Coastguard Worker
662*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_TYPE_VIS            _LIBCPP_DLL_VIS
663*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_FUNC_VIS            _LIBCPP_DLL_VIS
664*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_EXCEPTION_ABI       _LIBCPP_DLL_VIS
665*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HIDDEN
666*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
667*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_TEMPLATE_VIS
668*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ENUM_VIS
669*58b9f456SAndroid Build Coastguard Worker
670*58b9f456SAndroid Build Coastguard Worker#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
671*58b9f456SAndroid Build Coastguard Worker
672*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HIDDEN
673*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
674*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
675*58b9f456SAndroid Build Coastguard Worker#  else
676*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDDEN
677*58b9f456SAndroid Build Coastguard Worker#  endif
678*58b9f456SAndroid Build Coastguard Worker#endif
679*58b9f456SAndroid Build Coastguard Worker
680*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
681*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
682*58b9f456SAndroid Build Coastguard Worker// The inline should be removed once PR32114 is resolved
683*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
684*58b9f456SAndroid Build Coastguard Worker#  else
685*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
686*58b9f456SAndroid Build Coastguard Worker#  endif
687*58b9f456SAndroid Build Coastguard Worker#endif
688*58b9f456SAndroid Build Coastguard Worker
689*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_FUNC_VIS
690*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
691*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
692*58b9f456SAndroid Build Coastguard Worker#  else
693*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_FUNC_VIS
694*58b9f456SAndroid Build Coastguard Worker#  endif
695*58b9f456SAndroid Build Coastguard Worker#endif
696*58b9f456SAndroid Build Coastguard Worker
697*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_TYPE_VIS
698*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
699*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
700*58b9f456SAndroid Build Coastguard Worker#  else
701*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_TYPE_VIS
702*58b9f456SAndroid Build Coastguard Worker#  endif
703*58b9f456SAndroid Build Coastguard Worker#endif
704*58b9f456SAndroid Build Coastguard Worker
705*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_TEMPLATE_VIS
706*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
707*58b9f456SAndroid Build Coastguard Worker#    if __has_attribute(__type_visibility__)
708*58b9f456SAndroid Build Coastguard Worker#      define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
709*58b9f456SAndroid Build Coastguard Worker#    else
710*58b9f456SAndroid Build Coastguard Worker#      define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
711*58b9f456SAndroid Build Coastguard Worker#    endif
712*58b9f456SAndroid Build Coastguard Worker#  else
713*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_TEMPLATE_VIS
714*58b9f456SAndroid Build Coastguard Worker#  endif
715*58b9f456SAndroid Build Coastguard Worker#endif
716*58b9f456SAndroid Build Coastguard Worker
717*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_EXPORTED_FROM_ABI
718*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
719*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default")))
720*58b9f456SAndroid Build Coastguard Worker#  else
721*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_EXPORTED_FROM_ABI
722*58b9f456SAndroid Build Coastguard Worker#  endif
723*58b9f456SAndroid Build Coastguard Worker#endif
724*58b9f456SAndroid Build Coastguard Worker
725*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
726*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS
727*58b9f456SAndroid Build Coastguard Worker#endif
728*58b9f456SAndroid Build Coastguard Worker
729*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_EXCEPTION_ABI
730*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
731*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
732*58b9f456SAndroid Build Coastguard Worker#  else
733*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_EXCEPTION_ABI
734*58b9f456SAndroid Build Coastguard Worker#  endif
735*58b9f456SAndroid Build Coastguard Worker#endif
736*58b9f456SAndroid Build Coastguard Worker
737*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_ENUM_VIS
738*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
739*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default")))
740*58b9f456SAndroid Build Coastguard Worker#  else
741*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_ENUM_VIS
742*58b9f456SAndroid Build Coastguard Worker#  endif
743*58b9f456SAndroid Build Coastguard Worker#endif
744*58b9f456SAndroid Build Coastguard Worker
745*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
746*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
747*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
748*58b9f456SAndroid Build Coastguard Worker#  else
749*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
750*58b9f456SAndroid Build Coastguard Worker#  endif
751*58b9f456SAndroid Build Coastguard Worker#endif
752*58b9f456SAndroid Build Coastguard Worker
753*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
754*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS
755*58b9f456SAndroid Build Coastguard Worker#endif
756*58b9f456SAndroid Build Coastguard Worker
757*58b9f456SAndroid Build Coastguard Worker#if __has_attribute(internal_linkage)
758*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_INTERNAL_LINKAGE __attribute__ ((internal_linkage))
759*58b9f456SAndroid Build Coastguard Worker#else
760*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE
761*58b9f456SAndroid Build Coastguard Worker#endif
762*58b9f456SAndroid Build Coastguard Worker
763*58b9f456SAndroid Build Coastguard Worker#if __has_attribute(exclude_from_explicit_instantiation)
764*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__))
765*58b9f456SAndroid Build Coastguard Worker#else
766*58b9f456SAndroid Build Coastguard Worker   // Try to approximate the effect of exclude_from_explicit_instantiation
767*58b9f456SAndroid Build Coastguard Worker   // (which is that entities are not assumed to be provided by explicit
768*58b9f456SAndroid Build Coastguard Worker   // template instantitations in the dylib) by always inlining those entities.
769*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
770*58b9f456SAndroid Build Coastguard Worker#endif
771*58b9f456SAndroid Build Coastguard Worker
772*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU
773*58b9f456SAndroid Build Coastguard Worker#  ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
774*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDE_FROM_ABI_PER_TU 0
775*58b9f456SAndroid Build Coastguard Worker#  else
776*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDE_FROM_ABI_PER_TU 1
777*58b9f456SAndroid Build Coastguard Worker#  endif
778*58b9f456SAndroid Build Coastguard Worker#endif
779*58b9f456SAndroid Build Coastguard Worker
780*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HIDE_FROM_ABI
781*58b9f456SAndroid Build Coastguard Worker#  if _LIBCPP_HIDE_FROM_ABI_PER_TU
782*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
783*58b9f456SAndroid Build Coastguard Worker#  else
784*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION
785*58b9f456SAndroid Build Coastguard Worker#  endif
786*58b9f456SAndroid Build Coastguard Worker#endif
787*58b9f456SAndroid Build Coastguard Worker
788*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_BUILDING_LIBRARY
789*58b9f456SAndroid Build Coastguard Worker#  if _LIBCPP_ABI_VERSION > 1
790*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI
791*58b9f456SAndroid Build Coastguard Worker#  else
792*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HIDE_FROM_ABI_AFTER_V1
793*58b9f456SAndroid Build Coastguard Worker#  endif
794*58b9f456SAndroid Build Coastguard Worker#else
795*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI
796*58b9f456SAndroid Build Coastguard Worker#endif
797*58b9f456SAndroid Build Coastguard Worker
798*58b9f456SAndroid Build Coastguard Worker// Just so we can migrate to the new macros gradually.
799*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
800*58b9f456SAndroid Build Coastguard Worker
801*58b9f456SAndroid Build Coastguard Worker// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect.
802*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE {
803*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_END_NAMESPACE_STD  } }
804*58b9f456SAndroid Build Coastguard Worker#define _VSTD std::_LIBCPP_ABI_NAMESPACE
805*58b9f456SAndroid Build Coastguard Worker_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
806*58b9f456SAndroid Build Coastguard Worker
807*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER >= 17
808*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
809*58b9f456SAndroid Build Coastguard Worker  _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem {
810*58b9f456SAndroid Build Coastguard Worker#else
811*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \
812*58b9f456SAndroid Build Coastguard Worker  _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem {
813*58b9f456SAndroid Build Coastguard Worker#endif
814*58b9f456SAndroid Build Coastguard Worker
815*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_END_NAMESPACE_FILESYSTEM \
816*58b9f456SAndroid Build Coastguard Worker  _LIBCPP_END_NAMESPACE_STD } }
817*58b9f456SAndroid Build Coastguard Worker
818*58b9f456SAndroid Build Coastguard Worker#define _VSTD_FS _VSTD::__fs::filesystem
819*58b9f456SAndroid Build Coastguard Worker
820*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_PREFERRED_OVERLOAD
821*58b9f456SAndroid Build Coastguard Worker#  if __has_attribute(__enable_if__)
822*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, "")))
823*58b9f456SAndroid Build Coastguard Worker#  endif
824*58b9f456SAndroid Build Coastguard Worker#endif
825*58b9f456SAndroid Build Coastguard Worker
826*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HAS_NO_NOEXCEPT
827*58b9f456SAndroid Build Coastguard Worker#  define _NOEXCEPT noexcept
828*58b9f456SAndroid Build Coastguard Worker#  define _NOEXCEPT_(x) noexcept(x)
829*58b9f456SAndroid Build Coastguard Worker#else
830*58b9f456SAndroid Build Coastguard Worker#  define _NOEXCEPT throw()
831*58b9f456SAndroid Build Coastguard Worker#  define _NOEXCEPT_(x)
832*58b9f456SAndroid Build Coastguard Worker#endif
833*58b9f456SAndroid Build Coastguard Worker
834*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_DEBUG_USE_EXCEPTIONS)
835*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_DEBUG)
836*58b9f456SAndroid Build Coastguard Worker#    error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined
837*58b9f456SAndroid Build Coastguard Worker#  endif
838*58b9f456SAndroid Build Coastguard Worker#  ifdef _LIBCPP_HAS_NO_NOEXCEPT
839*58b9f456SAndroid Build Coastguard Worker#    define _NOEXCEPT_DEBUG
840*58b9f456SAndroid Build Coastguard Worker#    define _NOEXCEPT_DEBUG_(x)
841*58b9f456SAndroid Build Coastguard Worker#  else
842*58b9f456SAndroid Build Coastguard Worker#    define _NOEXCEPT_DEBUG noexcept(false)
843*58b9f456SAndroid Build Coastguard Worker#    define _NOEXCEPT_DEBUG_(x) noexcept(false)
844*58b9f456SAndroid Build Coastguard Worker#  endif
845*58b9f456SAndroid Build Coastguard Worker#else
846*58b9f456SAndroid Build Coastguard Worker#  define _NOEXCEPT_DEBUG _NOEXCEPT
847*58b9f456SAndroid Build Coastguard Worker#  define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x)
848*58b9f456SAndroid Build Coastguard Worker#endif
849*58b9f456SAndroid Build Coastguard Worker
850*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
851*58b9f456SAndroid Build Coastguard Workertypedef unsigned short char16_t;
852*58b9f456SAndroid Build Coastguard Workertypedef unsigned int   char32_t;
853*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_HAS_NO_UNICODE_CHARS
854*58b9f456SAndroid Build Coastguard Worker
855*58b9f456SAndroid Build Coastguard Worker#ifndef __SIZEOF_INT128__
856*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_INT128
857*58b9f456SAndroid Build Coastguard Worker#endif
858*58b9f456SAndroid Build Coastguard Worker
859*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_CXX03_LANG
860*58b9f456SAndroid Build Coastguard Worker#  if __has_extension(c_static_assert)
861*58b9f456SAndroid Build Coastguard Worker#    define static_assert(__b, __m) _Static_assert(__b, __m)
862*58b9f456SAndroid Build Coastguard Worker#  else
863*58b9f456SAndroid Build Coastguard Workerextern "C++" {
864*58b9f456SAndroid Build Coastguard Workertemplate <bool> struct __static_assert_test;
865*58b9f456SAndroid Build Coastguard Workertemplate <> struct __static_assert_test<true> {};
866*58b9f456SAndroid Build Coastguard Workertemplate <unsigned> struct __static_assert_check {};
867*58b9f456SAndroid Build Coastguard Worker}
868*58b9f456SAndroid Build Coastguard Worker#    define static_assert(__b, __m) \
869*58b9f456SAndroid Build Coastguard Worker       typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
870*58b9f456SAndroid Build Coastguard Worker       _LIBCPP_CONCAT(__t, __LINE__)
871*58b9f456SAndroid Build Coastguard Worker#  endif // __has_extension(c_static_assert)
872*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_CXX03_LANG
873*58b9f456SAndroid Build Coastguard Worker
874*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_HAS_NO_DECLTYPE
875*58b9f456SAndroid Build Coastguard Worker// GCC 4.6 provides __decltype in all standard modes.
876*58b9f456SAndroid Build Coastguard Worker#  if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
877*58b9f456SAndroid Build Coastguard Worker#    define decltype(__x) __decltype(__x)
878*58b9f456SAndroid Build Coastguard Worker#  else
879*58b9f456SAndroid Build Coastguard Worker#    define decltype(__x) __typeof__(__x)
880*58b9f456SAndroid Build Coastguard Worker#  endif
881*58b9f456SAndroid Build Coastguard Worker#endif
882*58b9f456SAndroid Build Coastguard Worker
883*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_HAS_NO_CONSTEXPR
884*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR
885*58b9f456SAndroid Build Coastguard Worker#else
886*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR constexpr
887*58b9f456SAndroid Build Coastguard Worker#endif
888*58b9f456SAndroid Build Coastguard Worker
889*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_CXX03_LANG
890*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEFAULT {}
891*58b9f456SAndroid Build Coastguard Worker#else
892*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEFAULT = default;
893*58b9f456SAndroid Build Coastguard Worker#endif
894*58b9f456SAndroid Build Coastguard Worker
895*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_CXX03_LANG
896*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EQUAL_DELETE
897*58b9f456SAndroid Build Coastguard Worker#else
898*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EQUAL_DELETE = delete
899*58b9f456SAndroid Build Coastguard Worker#endif
900*58b9f456SAndroid Build Coastguard Worker
901*58b9f456SAndroid Build Coastguard Worker#ifdef __GNUC__
902*58b9f456SAndroid Build Coastguard Worker#  define _NOALIAS __attribute__((__malloc__))
903*58b9f456SAndroid Build Coastguard Worker#else
904*58b9f456SAndroid Build Coastguard Worker#  define _NOALIAS
905*58b9f456SAndroid Build Coastguard Worker#endif
906*58b9f456SAndroid Build Coastguard Worker
907*58b9f456SAndroid Build Coastguard Worker#if __has_feature(cxx_explicit_conversions) || defined(__IBMCPP__) || \
908*58b9f456SAndroid Build Coastguard Worker    (!defined(_LIBCPP_CXX03_LANG) && defined(__GNUC__)) // All supported GCC versions
909*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPLICIT explicit
910*58b9f456SAndroid Build Coastguard Worker#else
911*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPLICIT
912*58b9f456SAndroid Build Coastguard Worker#endif
913*58b9f456SAndroid Build Coastguard Worker
914*58b9f456SAndroid Build Coastguard Worker#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
915*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
916*58b9f456SAndroid Build Coastguard Worker#endif
917*58b9f456SAndroid Build Coastguard Worker
918*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
919*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
920*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
921*58b9f456SAndroid Build Coastguard Worker     __lx __v_; \
922*58b9f456SAndroid Build Coastguard Worker     _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \
923*58b9f456SAndroid Build Coastguard Worker     _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
924*58b9f456SAndroid Build Coastguard Worker     _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \
925*58b9f456SAndroid Build Coastguard Worker     };
926*58b9f456SAndroid Build Coastguard Worker#else  // _LIBCPP_HAS_NO_STRONG_ENUMS
927*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x
928*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
929*58b9f456SAndroid Build Coastguard Worker#endif  // _LIBCPP_HAS_NO_STRONG_ENUMS
930*58b9f456SAndroid Build Coastguard Worker
931*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_DEBUG
932*58b9f456SAndroid Build Coastguard Worker#  if _LIBCPP_DEBUG == 0
933*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DEBUG_LEVEL 1
934*58b9f456SAndroid Build Coastguard Worker#  elif _LIBCPP_DEBUG == 1
935*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DEBUG_LEVEL 2
936*58b9f456SAndroid Build Coastguard Worker#  else
937*58b9f456SAndroid Build Coastguard Worker#    error Supported values for _LIBCPP_DEBUG are 0 and 1
938*58b9f456SAndroid Build Coastguard Worker#  endif
939*58b9f456SAndroid Build Coastguard Worker#  if !defined(_LIBCPP_BUILDING_LIBRARY)
940*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_EXTERN_TEMPLATE(...)
941*58b9f456SAndroid Build Coastguard Worker#  endif
942*58b9f456SAndroid Build Coastguard Worker#endif
943*58b9f456SAndroid Build Coastguard Worker
944*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
945*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_EXTERN_TEMPLATE(...)
946*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_EXTERN_TEMPLATE2(...)
947*58b9f456SAndroid Build Coastguard Worker#endif
948*58b9f456SAndroid Build Coastguard Worker
949*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_EXTERN_TEMPLATE
950*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
951*58b9f456SAndroid Build Coastguard Worker#endif
952*58b9f456SAndroid Build Coastguard Worker
953*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_EXTERN_TEMPLATE2
954*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
955*58b9f456SAndroid Build Coastguard Worker#endif
956*58b9f456SAndroid Build Coastguard Worker
957*58b9f456SAndroid Build Coastguard Worker#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
958*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
959*58b9f456SAndroid Build Coastguard Worker#endif
960*58b9f456SAndroid Build Coastguard Worker
961*58b9f456SAndroid Build Coastguard Worker#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
962*58b9f456SAndroid Build Coastguard Worker    defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
963*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_LOCALE__L_EXTENSIONS 1
964*58b9f456SAndroid Build Coastguard Worker#endif
965*58b9f456SAndroid Build Coastguard Worker
966*58b9f456SAndroid Build Coastguard Worker#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
967*58b9f456SAndroid Build Coastguard Worker// Most unix variants have catopen.  These are the specific ones that don't.
968*58b9f456SAndroid Build Coastguard Worker#  if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
969*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_CATOPEN 1
970*58b9f456SAndroid Build Coastguard Worker#  endif
971*58b9f456SAndroid Build Coastguard Worker#endif
972*58b9f456SAndroid Build Coastguard Worker
973*58b9f456SAndroid Build Coastguard Worker#ifdef __FreeBSD__
974*58b9f456SAndroid Build Coastguard Worker#define _DECLARE_C99_LDBL_MATH 1
975*58b9f456SAndroid Build Coastguard Worker#endif
976*58b9f456SAndroid Build Coastguard Worker
977*58b9f456SAndroid Build Coastguard Worker// If we are getting operator new from the MSVC CRT, then allocation overloads
978*58b9f456SAndroid Build Coastguard Worker// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
979*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
980*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
981*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
982*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEFER_NEW_TO_VCRUNTIME
983*58b9f456SAndroid Build Coastguard Worker#  if !defined(__cpp_aligned_new)
984*58b9f456SAndroid Build Coastguard Worker     // We're defering to Microsoft's STL to provide aligned new et al. We don't
985*58b9f456SAndroid Build Coastguard Worker     // have it unless the language feature test macro is defined.
986*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
987*58b9f456SAndroid Build Coastguard Worker#  endif
988*58b9f456SAndroid Build Coastguard Worker#endif
989*58b9f456SAndroid Build Coastguard Worker
990*58b9f456SAndroid Build Coastguard Worker#if defined(__APPLE__)
991*58b9f456SAndroid Build Coastguard Worker#  if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \
992*58b9f456SAndroid Build Coastguard Worker      defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
993*58b9f456SAndroid Build Coastguard Worker#    define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
994*58b9f456SAndroid Build Coastguard Worker#  endif
995*58b9f456SAndroid Build Coastguard Worker#endif // defined(__APPLE__)
996*58b9f456SAndroid Build Coastguard Worker
997*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \
998*58b9f456SAndroid Build Coastguard Worker    (defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \
999*58b9f456SAndroid Build Coastguard Worker    (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606))
1000*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
1001*58b9f456SAndroid Build Coastguard Worker#endif
1002*58b9f456SAndroid Build Coastguard Worker
1003*58b9f456SAndroid Build Coastguard Worker#if defined(__APPLE__) || defined(__FreeBSD__)
1004*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_DEFAULTRUNELOCALE
1005*58b9f456SAndroid Build Coastguard Worker#endif
1006*58b9f456SAndroid Build Coastguard Worker
1007*58b9f456SAndroid Build Coastguard Worker#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
1008*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_WCTYPE_IS_MASK
1009*58b9f456SAndroid Build Coastguard Worker#endif
1010*58b9f456SAndroid Build Coastguard Worker
1011*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)
1012*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_NO_HAS_CHAR8_T
1013*58b9f456SAndroid Build Coastguard Worker#endif
1014*58b9f456SAndroid Build Coastguard Worker
1015*58b9f456SAndroid Build Coastguard Worker// Deprecation macros.
1016*58b9f456SAndroid Build Coastguard Worker// Deprecations warnings are only enabled when _LIBCPP_ENABLE_DEPRECATION_WARNINGS is defined.
1017*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_ENABLE_DEPRECATION_WARNINGS)
1018*58b9f456SAndroid Build Coastguard Worker#  if __has_attribute(deprecated)
1019*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DEPRECATED __attribute__ ((deprecated))
1020*58b9f456SAndroid Build Coastguard Worker#  elif _LIBCPP_STD_VER > 11
1021*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DEPRECATED [[deprecated]]
1022*58b9f456SAndroid Build Coastguard Worker#  else
1023*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DEPRECATED
1024*58b9f456SAndroid Build Coastguard Worker#  endif
1025*58b9f456SAndroid Build Coastguard Worker#else
1026*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEPRECATED
1027*58b9f456SAndroid Build Coastguard Worker#endif
1028*58b9f456SAndroid Build Coastguard Worker
1029*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_CXX03_LANG)
1030*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED
1031*58b9f456SAndroid Build Coastguard Worker#else
1032*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEPRECATED_IN_CXX11
1033*58b9f456SAndroid Build Coastguard Worker#endif
1034*58b9f456SAndroid Build Coastguard Worker
1035*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER >= 14
1036*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED
1037*58b9f456SAndroid Build Coastguard Worker#else
1038*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEPRECATED_IN_CXX14
1039*58b9f456SAndroid Build Coastguard Worker#endif
1040*58b9f456SAndroid Build Coastguard Worker
1041*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER >= 17
1042*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED
1043*58b9f456SAndroid Build Coastguard Worker#else
1044*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DEPRECATED_IN_CXX17
1045*58b9f456SAndroid Build Coastguard Worker#endif
1046*58b9f456SAndroid Build Coastguard Worker
1047*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER <= 11
1048*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPLICIT_AFTER_CXX11
1049*58b9f456SAndroid Build Coastguard Worker#else
1050*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
1051*58b9f456SAndroid Build Coastguard Worker#endif
1052*58b9f456SAndroid Build Coastguard Worker
1053*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1054*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
1055*58b9f456SAndroid Build Coastguard Worker#else
1056*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR_AFTER_CXX11
1057*58b9f456SAndroid Build Coastguard Worker#endif
1058*58b9f456SAndroid Build Coastguard Worker
1059*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1060*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr
1061*58b9f456SAndroid Build Coastguard Worker#else
1062*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR_AFTER_CXX14
1063*58b9f456SAndroid Build Coastguard Worker#endif
1064*58b9f456SAndroid Build Coastguard Worker
1065*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1066*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
1067*58b9f456SAndroid Build Coastguard Worker#else
1068*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_CONSTEXPR_AFTER_CXX17
1069*58b9f456SAndroid Build Coastguard Worker#endif
1070*58b9f456SAndroid Build Coastguard Worker
1071*58b9f456SAndroid Build Coastguard Worker// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
1072*58b9f456SAndroid Build Coastguard Worker// NODISCARD macros to the correct attribute.
1073*58b9f456SAndroid Build Coastguard Worker#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
1074*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NODISCARD_ATTRIBUTE [[nodiscard]]
1075*58b9f456SAndroid Build Coastguard Worker#elif defined(_LIBCPP_COMPILER_CLANG) && !defined(_LIBCPP_CXX03_LANG)
1076*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]]
1077*58b9f456SAndroid Build Coastguard Worker#else
1078*58b9f456SAndroid Build Coastguard Worker// We can't use GCC's [[gnu::warn_unused_result]] and
1079*58b9f456SAndroid Build Coastguard Worker// __attribute__((warn_unused_result)), because GCC does not silence them via
1080*58b9f456SAndroid Build Coastguard Worker// (void) cast.
1081*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NODISCARD_ATTRIBUTE
1082*58b9f456SAndroid Build Coastguard Worker#endif
1083*58b9f456SAndroid Build Coastguard Worker
1084*58b9f456SAndroid Build Coastguard Worker// _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not
1085*58b9f456SAndroid Build Coastguard Worker// specified as such as an extension.
1086*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT)
1087*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD_ATTRIBUTE
1088*58b9f456SAndroid Build Coastguard Worker#else
1089*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NODISCARD_EXT
1090*58b9f456SAndroid Build Coastguard Worker#endif
1091*58b9f456SAndroid Build Coastguard Worker
1092*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \
1093*58b9f456SAndroid Build Coastguard Worker    (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD))
1094*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD_ATTRIBUTE
1095*58b9f456SAndroid Build Coastguard Worker#else
1096*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_NODISCARD_AFTER_CXX17
1097*58b9f456SAndroid Build Coastguard Worker#endif
1098*58b9f456SAndroid Build Coastguard Worker
1099*58b9f456SAndroid Build Coastguard Worker#if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
1100*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_INLINE_VAR inline
1101*58b9f456SAndroid Build Coastguard Worker#else
1102*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_INLINE_VAR
1103*58b9f456SAndroid Build Coastguard Worker#endif
1104*58b9f456SAndroid Build Coastguard Worker
1105*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
1106*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
1107*58b9f456SAndroid Build Coastguard Worker#else
1108*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_EXPLICIT_MOVE(x) (x)
1109*58b9f456SAndroid Build Coastguard Worker#endif
1110*58b9f456SAndroid Build Coastguard Worker
1111*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG
1112*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
1113*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CONSTEXPR_IF_NODEBUG
1114*58b9f456SAndroid Build Coastguard Worker#else
1115*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr
1116*58b9f456SAndroid Build Coastguard Worker#endif
1117*58b9f456SAndroid Build Coastguard Worker#endif
1118*58b9f456SAndroid Build Coastguard Worker
1119*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_HAS_NO_ASAN
1120*58b9f456SAndroid Build Coastguard Worker_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
1121*58b9f456SAndroid Build Coastguard Worker  const void *, const void *, const void *, const void *);
1122*58b9f456SAndroid Build Coastguard Worker#endif
1123*58b9f456SAndroid Build Coastguard Worker
1124*58b9f456SAndroid Build Coastguard Worker// Try to find out if RTTI is disabled.
1125*58b9f456SAndroid Build Coastguard Worker// g++ and cl.exe have RTTI on by default and define a macro when it is.
1126*58b9f456SAndroid Build Coastguard Worker// g++ only defines the macro in 4.3.2 and onwards.
1127*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_NO_RTTI)
1128*58b9f456SAndroid Build Coastguard Worker#  if defined(__GNUC__) && \
1129*58b9f456SAndroid Build Coastguard Worker      ((__GNUC__ >= 5) || \
1130*58b9f456SAndroid Build Coastguard Worker       (__GNUC__ == 4 && (__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && \
1131*58b9f456SAndroid Build Coastguard Worker      !defined(__GXX_RTTI)
1132*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_NO_RTTI
1133*58b9f456SAndroid Build Coastguard Worker#  elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI)
1134*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_NO_RTTI
1135*58b9f456SAndroid Build Coastguard Worker#  endif
1136*58b9f456SAndroid Build Coastguard Worker#endif
1137*58b9f456SAndroid Build Coastguard Worker
1138*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_WEAK
1139*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_WEAK __attribute__((__weak__))
1140*58b9f456SAndroid Build Coastguard Worker#endif
1141*58b9f456SAndroid Build Coastguard Worker
1142*58b9f456SAndroid Build Coastguard Worker// Thread API
1143*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_THREADS) && \
1144*58b9f456SAndroid Build Coastguard Worker    !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
1145*58b9f456SAndroid Build Coastguard Worker    !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
1146*58b9f456SAndroid Build Coastguard Worker    !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1147*58b9f456SAndroid Build Coastguard Worker#  if defined(__FreeBSD__) || \
1148*58b9f456SAndroid Build Coastguard Worker      defined(__Fuchsia__) || \
1149*58b9f456SAndroid Build Coastguard Worker      defined(__NetBSD__) || \
1150*58b9f456SAndroid Build Coastguard Worker      defined(__linux__) || \
1151*58b9f456SAndroid Build Coastguard Worker      defined(__GNU__) || \
1152*58b9f456SAndroid Build Coastguard Worker      defined(__APPLE__) || \
1153*58b9f456SAndroid Build Coastguard Worker      defined(__CloudABI__) || \
1154*58b9f456SAndroid Build Coastguard Worker      defined(__sun__) || \
1155*58b9f456SAndroid Build Coastguard Worker      (defined(__MINGW32__) && __has_include(<pthread.h>))
1156*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_THREAD_API_PTHREAD
1157*58b9f456SAndroid Build Coastguard Worker#  elif defined(_LIBCPP_WIN32API)
1158*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_THREAD_API_WIN32
1159*58b9f456SAndroid Build Coastguard Worker#  else
1160*58b9f456SAndroid Build Coastguard Worker#    error "No thread API"
1161*58b9f456SAndroid Build Coastguard Worker#  endif // _LIBCPP_HAS_THREAD_API
1162*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_HAS_NO_THREADS
1163*58b9f456SAndroid Build Coastguard Worker
1164*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
1165*58b9f456SAndroid Build Coastguard Worker#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
1166*58b9f456SAndroid Build Coastguard Worker       _LIBCPP_HAS_NO_THREADS is not defined.
1167*58b9f456SAndroid Build Coastguard Worker#endif
1168*58b9f456SAndroid Build Coastguard Worker
1169*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
1170*58b9f456SAndroid Build Coastguard Worker#error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
1171*58b9f456SAndroid Build Coastguard Worker       _LIBCPP_HAS_NO_THREADS is defined.
1172*58b9f456SAndroid Build Coastguard Worker#endif
1173*58b9f456SAndroid Build Coastguard Worker
1174*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS)
1175*58b9f456SAndroid Build Coastguard Worker#error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \
1176*58b9f456SAndroid Build Coastguard Worker       _LIBCPP_HAS_NO_THREADS is defined.
1177*58b9f456SAndroid Build Coastguard Worker#endif
1178*58b9f456SAndroid Build Coastguard Worker
1179*58b9f456SAndroid Build Coastguard Worker// Systems that use capability-based security (FreeBSD with Capsicum,
1180*58b9f456SAndroid Build Coastguard Worker// Nuxi CloudABI) may only provide local filesystem access (using *at()).
1181*58b9f456SAndroid Build Coastguard Worker// Functions like open(), rename(), unlink() and stat() should not be
1182*58b9f456SAndroid Build Coastguard Worker// used, as they attempt to access the global filesystem namespace.
1183*58b9f456SAndroid Build Coastguard Worker#ifdef __CloudABI__
1184*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
1185*58b9f456SAndroid Build Coastguard Worker#endif
1186*58b9f456SAndroid Build Coastguard Worker
1187*58b9f456SAndroid Build Coastguard Worker// CloudABI is intended for running networked services. Processes do not
1188*58b9f456SAndroid Build Coastguard Worker// have standard input and output channels.
1189*58b9f456SAndroid Build Coastguard Worker#ifdef __CloudABI__
1190*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_STDIN
1191*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_STDOUT
1192*58b9f456SAndroid Build Coastguard Worker#endif
1193*58b9f456SAndroid Build Coastguard Worker
1194*58b9f456SAndroid Build Coastguard Worker#if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
1195*58b9f456SAndroid Build Coastguard Worker    defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
1196*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
1197*58b9f456SAndroid Build Coastguard Worker#endif
1198*58b9f456SAndroid Build Coastguard Worker
1199*58b9f456SAndroid Build Coastguard Worker// Thread-unsafe functions such as strtok() and localtime()
1200*58b9f456SAndroid Build Coastguard Worker// are not available.
1201*58b9f456SAndroid Build Coastguard Worker#ifdef __CloudABI__
1202*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
1203*58b9f456SAndroid Build Coastguard Worker#endif
1204*58b9f456SAndroid Build Coastguard Worker
1205*58b9f456SAndroid Build Coastguard Worker#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
1206*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_C_ATOMIC_IMP
1207*58b9f456SAndroid Build Coastguard Worker#elif _GNUC_VER > 407
1208*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_HAS_GCC_ATOMIC_IMP
1209*58b9f456SAndroid Build Coastguard Worker#endif
1210*58b9f456SAndroid Build Coastguard Worker
1211*58b9f456SAndroid Build Coastguard Worker#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
1212*58b9f456SAndroid Build Coastguard Worker     || defined(_LIBCPP_HAS_NO_THREADS)
1213*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_ATOMIC_HEADER
1214*58b9f456SAndroid Build Coastguard Worker#endif
1215*58b9f456SAndroid Build Coastguard Worker
1216*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1217*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
1218*58b9f456SAndroid Build Coastguard Worker#endif
1219*58b9f456SAndroid Build Coastguard Worker
1220*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
1221*58b9f456SAndroid Build Coastguard Worker#  if defined(__clang__) && __has_attribute(acquire_capability)
1222*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
1223*58b9f456SAndroid Build Coastguard Worker#  endif
1224*58b9f456SAndroid Build Coastguard Worker#endif
1225*58b9f456SAndroid Build Coastguard Worker
1226*58b9f456SAndroid Build Coastguard Worker#if __has_attribute(require_constant_initialization)
1227*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
1228*58b9f456SAndroid Build Coastguard Worker#else
1229*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_SAFE_STATIC
1230*58b9f456SAndroid Build Coastguard Worker#endif
1231*58b9f456SAndroid Build Coastguard Worker
1232*58b9f456SAndroid Build Coastguard Worker#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
1233*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
1234*58b9f456SAndroid Build Coastguard Worker#endif
1235*58b9f456SAndroid Build Coastguard Worker
1236*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
1237*58b9f456SAndroid Build Coastguard Worker#  if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
1238*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
1239*58b9f456SAndroid Build Coastguard Worker#  endif
1240*58b9f456SAndroid Build Coastguard Worker#endif
1241*58b9f456SAndroid Build Coastguard Worker
1242*58b9f456SAndroid Build Coastguard Worker#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
1243*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DIAGNOSE_WARNING(...) \
1244*58b9f456SAndroid Build Coastguard Worker     __attribute__((diagnose_if(__VA_ARGS__, "warning")))
1245*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DIAGNOSE_ERROR(...) \
1246*58b9f456SAndroid Build Coastguard Worker     __attribute__((diagnose_if(__VA_ARGS__, "error")))
1247*58b9f456SAndroid Build Coastguard Worker#else
1248*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DIAGNOSE_WARNING(...)
1249*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DIAGNOSE_ERROR(...)
1250*58b9f456SAndroid Build Coastguard Worker#endif
1251*58b9f456SAndroid Build Coastguard Worker
1252*58b9f456SAndroid Build Coastguard Worker// Use a function like macro to imply that it must be followed by a semicolon
1253*58b9f456SAndroid Build Coastguard Worker#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
1254*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_FALLTHROUGH() [[fallthrough]]
1255*58b9f456SAndroid Build Coastguard Worker#elif __has_cpp_attribute(clang::fallthrough)
1256*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]]
1257*58b9f456SAndroid Build Coastguard Worker#elif __has_attribute(fallthough) || _GNUC_VER >= 700
1258*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
1259*58b9f456SAndroid Build Coastguard Worker#else
1260*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_FALLTHROUGH() ((void)0)
1261*58b9f456SAndroid Build Coastguard Worker#endif
1262*58b9f456SAndroid Build Coastguard Worker
1263*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_ABI_MICROSOFT) && \
1264*58b9f456SAndroid Build Coastguard Worker    (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
1265*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
1266*58b9f456SAndroid Build Coastguard Worker#else
1267*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DECLSPEC_EMPTY_BASES
1268*58b9f456SAndroid Build Coastguard Worker#endif
1269*58b9f456SAndroid Build Coastguard Worker
1270*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
1271*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
1272*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
1273*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
1274*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
1275*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
1276*58b9f456SAndroid Build Coastguard Worker
1277*58b9f456SAndroid Build Coastguard Worker#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
1278*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
1279*58b9f456SAndroid Build Coastguard Worker#endif
1280*58b9f456SAndroid Build Coastguard Worker
1281*58b9f456SAndroid Build Coastguard Worker#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
1282*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_IS_AGGREGATE
1283*58b9f456SAndroid Build Coastguard Worker#endif
1284*58b9f456SAndroid Build Coastguard Worker
1285*58b9f456SAndroid Build Coastguard Worker#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
1286*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_COROUTINES
1287*58b9f456SAndroid Build Coastguard Worker#endif
1288*58b9f456SAndroid Build Coastguard Worker
1289*58b9f456SAndroid Build Coastguard Worker// FIXME: Correct this macro when either (A) a feature test macro for the
1290*58b9f456SAndroid Build Coastguard Worker// spaceship operator is provided, or (B) a compiler provides a complete
1291*58b9f456SAndroid Build Coastguard Worker// implementation.
1292*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
1293*58b9f456SAndroid Build Coastguard Worker
1294*58b9f456SAndroid Build Coastguard Worker// Decide whether to use availability macros.
1295*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_BUILDING_LIBRARY) &&                                      \
1296*58b9f456SAndroid Build Coastguard Worker    !defined(_LIBCPP_DISABLE_AVAILABILITY) &&                                  \
1297*58b9f456SAndroid Build Coastguard Worker    __has_feature(attribute_availability_with_strict) &&                       \
1298*58b9f456SAndroid Build Coastguard Worker    __has_feature(attribute_availability_in_templates)
1299*58b9f456SAndroid Build Coastguard Worker#  ifdef __APPLE__
1300*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_USE_AVAILABILITY_APPLE
1301*58b9f456SAndroid Build Coastguard Worker#  endif
1302*58b9f456SAndroid Build Coastguard Worker#endif
1303*58b9f456SAndroid Build Coastguard Worker
1304*58b9f456SAndroid Build Coastguard Worker// Define availability macros.
1305*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_USE_AVAILABILITY_APPLE)
1306*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_SHARED_MUTEX                                    \
1307*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(macosx,strict,introduced=10.12)))             \
1308*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=10.0)))                 \
1309*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(tvos,strict,introduced=10.0)))                \
1310*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(watchos,strict,introduced=3.0)))
1311*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS                             \
1312*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(macosx,strict,introduced=10.14)))             \
1313*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=12.0)))                 \
1314*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(tvos,strict,introduced=12.0)))                \
1315*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(watchos,strict,introduced=5.0)))
1316*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS                              \
1317*58b9f456SAndroid Build Coastguard Worker     _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
1318*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_BAD_ANY_CAST                                    \
1319*58b9f456SAndroid Build Coastguard Worker     _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
1320*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS                             \
1321*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(macosx,strict,introduced=10.12)))             \
1322*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=10.0)))                 \
1323*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(tvos,strict,introduced=10.0)))                \
1324*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(watchos,strict,introduced=3.0)))
1325*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE                                \
1326*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(macosx,strict,introduced=10.12)))             \
1327*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=10.0)))                 \
1328*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(tvos,strict,introduced=10.0)))                \
1329*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(watchos,strict,introduced=3.0)))
1330*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_FUTURE_ERROR                                    \
1331*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=6.0)))
1332*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE                                 \
1333*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(macosx,strict,introduced=10.9)))              \
1334*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=7.0)))
1335*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY                                 \
1336*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(macosx,strict,introduced=10.9)))              \
1337*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=7.0)))
1338*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR                               \
1339*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(macosx,strict,introduced=10.9)))              \
1340*58b9f456SAndroid Build Coastguard Worker     __attribute__((availability(ios,strict,introduced=7.0)))
1341*58b9f456SAndroid Build Coastguard Worker#else
1342*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_SHARED_MUTEX
1343*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
1344*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
1345*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1346*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
1347*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
1348*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_FUTURE_ERROR
1349*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
1350*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
1351*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
1352*58b9f456SAndroid Build Coastguard Worker#endif
1353*58b9f456SAndroid Build Coastguard Worker
1354*58b9f456SAndroid Build Coastguard Worker// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
1355*58b9f456SAndroid Build Coastguard Worker#ifdef _LIBCPP_NO_EXCEPTIONS
1356*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_FUTURE
1357*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
1358*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
1359*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
1360*58b9f456SAndroid Build Coastguard Worker#else
1361*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_FUTURE                    _LIBCPP_AVAILABILITY_FUTURE_ERROR
1362*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST        _LIBCPP_AVAILABILITY_BAD_ANY_CAST
1363*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
1364*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS  _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
1365*58b9f456SAndroid Build Coastguard Worker#endif
1366*58b9f456SAndroid Build Coastguard Worker
1367*58b9f456SAndroid Build Coastguard Worker// The stream API was dropped and re-added in the dylib shipped on macOS
1368*58b9f456SAndroid Build Coastguard Worker// and iOS. We can only assume the dylib to provide these definitions for
1369*58b9f456SAndroid Build Coastguard Worker// macosx >= 10.9 and ios >= 7.0. Otherwise, the definitions are available
1370*58b9f456SAndroid Build Coastguard Worker// from the headers, but not from the dylib. Explicit instantiation
1371*58b9f456SAndroid Build Coastguard Worker// declarations for streams exist conditionally to this; if we provide
1372*58b9f456SAndroid Build Coastguard Worker// an explicit instantiation declaration and we try to deploy to a dylib
1373*58b9f456SAndroid Build Coastguard Worker// that does not provide those symbols, we'll get a load-time error.
1374*58b9f456SAndroid Build Coastguard Worker#if !defined(_LIBCPP_BUILDING_LIBRARY) &&                                      \
1375*58b9f456SAndroid Build Coastguard Worker    ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) &&                \
1376*58b9f456SAndroid Build Coastguard Worker      __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) ||                 \
1377*58b9f456SAndroid Build Coastguard Worker     (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) &&               \
1378*58b9f456SAndroid Build Coastguard Worker      __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
1379*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
1380*58b9f456SAndroid Build Coastguard Worker#endif
1381*58b9f456SAndroid Build Coastguard Worker
1382*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_COMPILER_IBM)
1383*58b9f456SAndroid Build Coastguard Worker#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
1384*58b9f456SAndroid Build Coastguard Worker#endif
1385*58b9f456SAndroid Build Coastguard Worker
1386*58b9f456SAndroid Build Coastguard Worker#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1387*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_PUSH_MACROS
1388*58b9f456SAndroid Build Coastguard Worker#  define _LIBCPP_POP_MACROS
1389*58b9f456SAndroid Build Coastguard Worker#else
1390*58b9f456SAndroid Build Coastguard Worker  // Don't warn about macro conflicts when we can restore them at the
1391*58b9f456SAndroid Build Coastguard Worker  // end of the header.
1392*58b9f456SAndroid Build Coastguard Worker#  ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1393*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
1394*58b9f456SAndroid Build Coastguard Worker#  endif
1395*58b9f456SAndroid Build Coastguard Worker#  if defined(_LIBCPP_COMPILER_MSVC)
1396*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_PUSH_MACROS    \
1397*58b9f456SAndroid Build Coastguard Worker       __pragma(push_macro("min")) \
1398*58b9f456SAndroid Build Coastguard Worker       __pragma(push_macro("max"))
1399*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_POP_MACROS     \
1400*58b9f456SAndroid Build Coastguard Worker       __pragma(pop_macro("min"))  \
1401*58b9f456SAndroid Build Coastguard Worker       __pragma(pop_macro("max"))
1402*58b9f456SAndroid Build Coastguard Worker#  else
1403*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_PUSH_MACROS        \
1404*58b9f456SAndroid Build Coastguard Worker       _Pragma("push_macro(\"min\")")  \
1405*58b9f456SAndroid Build Coastguard Worker       _Pragma("push_macro(\"max\")")
1406*58b9f456SAndroid Build Coastguard Worker#    define _LIBCPP_POP_MACROS         \
1407*58b9f456SAndroid Build Coastguard Worker       _Pragma("pop_macro(\"min\")")   \
1408*58b9f456SAndroid Build Coastguard Worker       _Pragma("pop_macro(\"max\")")
1409*58b9f456SAndroid Build Coastguard Worker#  endif
1410*58b9f456SAndroid Build Coastguard Worker#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
1411*58b9f456SAndroid Build Coastguard Worker
1412*58b9f456SAndroid Build Coastguard Worker#ifndef _LIBCPP_NO_AUTO_LINK
1413*58b9f456SAndroid Build Coastguard Worker#  if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1414*58b9f456SAndroid Build Coastguard Worker#    if defined(_DLL)
1415*58b9f456SAndroid Build Coastguard Worker#      pragma comment(lib, "c++.lib")
1416*58b9f456SAndroid Build Coastguard Worker#    else
1417*58b9f456SAndroid Build Coastguard Worker#      pragma comment(lib, "libc++.lib")
1418*58b9f456SAndroid Build Coastguard Worker#    endif
1419*58b9f456SAndroid Build Coastguard Worker#  endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
1420*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_NO_AUTO_LINK
1421*58b9f456SAndroid Build Coastguard Worker
1422*58b9f456SAndroid Build Coastguard Worker#endif // __cplusplus
1423*58b9f456SAndroid Build Coastguard Worker
1424*58b9f456SAndroid Build Coastguard Worker#endif // _LIBCPP_CONFIG
1425