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