154154# define _LIBCPP_HAS_QUICK_EXIT
155155#endif // __NetBSD__
156156
157- #ifdef _WIN32
157+ #if defined(_WIN32)
158+ # define _LIBCPP_WIN32API 1
158159# define _LIBCPP_LITTLE_ENDIAN 1
159160# define _LIBCPP_BIG_ENDIAN 0
161+ # define _LIBCPP_SHORT_WCHAR 1
160162// Compiler intrinsics (MSVC)
161- #if defined(_MSC_VER) && _MSC_VER >= 1400
163+ # if defined(_MSC_VER) && _MSC_VER >= 1400
162164# define _LIBCPP_HAS_IS_BASE_OF
163165# endif
164166# if defined(_MSC_VER) && !defined(__clang__)
167169# define _LIBCPP_TOSTRING (x ) _LIBCPP_TOSTRING2(x)
168170# define _LIBCPP_WARNING (x ) __pragma(message(__FILE__ " (" _LIBCPP_TOSTRING(__LINE__) " ) : warning note: " x))
169171# endif
170- # // If mingw not explicitly detected, assume using MS C runtime only.
172+ // If mingw not explicitly detected, assume using MS C runtime only.
171173# ifndef __MINGW32__
172174# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
173175# endif
174- #endif // _WIN32
176+ #endif // defined( _WIN32)
175177
176178#ifdef __sun__
177179# include < sys/isa_defs.h>
195197 // including accesses to the special files under /dev. C++11's
196198 // std::random_device is instead exposed through a NaCl syscall.
197199# define _LIBCPP_USING_NACL_RANDOM
198- #elif defined(_WIN32 )
200+ #elif defined(_LIBCPP_WIN32API )
199201# define _LIBCPP_USING_WIN32_RANDOM
200202#else
201203# define _LIBCPP_USING_DEV_RANDOM
@@ -520,8 +522,15 @@ namespace std {
520522
521523#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
522524
525+ #if defined(__ELF__)
526+ #define _LIBCPP_OBJECT_FORMAT_ELF 1
527+ #elif defined(__MACH__)
528+ #define _LIBCPP_OBJECT_FORMAT_MACHO 1
529+ #else
530+ #define _LIBCPP_OBJECT_FORMAT_COFF 1
531+ #endif
523532
524- #ifdef _WIN32
533+ #if defined(_LIBCPP_OBJECT_FORMAT_COFF)
525534#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
526535# define _LIBCPP_DLL_VIS
527536# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
@@ -546,6 +555,7 @@ namespace std {
546555#define _LIBCPP_TYPE_VIS_ONLY
547556#define _LIBCPP_FUNC_VIS_ONLY
548557#define _LIBCPP_ENUM_VIS
558+
549559#if defined(_LIBCPP_MSVC)
550560# define _LIBCPP_INLINE_VISIBILITY __forceinline
551561# define _LIBCPP_ALWAYS_INLINE __forceinline
@@ -555,7 +565,7 @@ namespace std {
555565# define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
556566# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
557567#endif
558- #endif // _WIN32
568+ #endif // defined(_LIBCPP_OBJECT_FORMAT_COFF)
559569
560570#ifndef _LIBCPP_HIDDEN
561571#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
@@ -778,14 +788,14 @@ template <unsigned> struct __static_assert_check {};
778788#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63 )
779789#endif
780790
781- #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32 ) || \
791+ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT ) || \
782792 defined (__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
783793#define _LIBCPP_LOCALE__L_EXTENSIONS 1
784794#endif
785795
786796#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
787797// Most unix variants have catopen. These are the specific ones that don't.
788- #if !defined(_WIN32) && !defined( __BIONIC__) && !defined(_NEWLIB_VERSION)
798+ #if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
789799#define _LIBCPP_HAS_CATOPEN 1
790800#endif
791801#endif
@@ -959,7 +969,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
959969#endif
960970
961971#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
962- #if defined(_WIN32 ) || defined(_NEWLIB_VERSION)
972+ #if defined(_LIBCPP_MSVCRT ) || defined(_NEWLIB_VERSION)
963973#define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
964974#endif
965975#endif
0 commit comments