Skip to content

Commit 073458b

Browse files
author
Howard Hinnant
committed
Windows support by Ruben Van Boxem.
llvm-svn: 142235
1 parent aa563df commit 073458b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+286
-40
lines changed

libcxx/include/__bit_reference

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
#include <__config>
1515
#include <algorithm>
1616

17+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1718
#pragma GCC system_header
19+
#endif
1820

1921
_LIBCPP_BEGIN_NAMESPACE_STD
2022

libcxx/include/__config

Lines changed: 80 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
#ifndef _LIBCPP_CONFIG
1212
#define _LIBCPP_CONFIG
1313

14+
#if !_MSC_VER // explicit macro necessary because it is only defined below in this file
1415
#pragma GCC system_header
16+
#endif
1517

1618
#define _LIBCPP_VERSION 1001
1719

@@ -69,17 +71,45 @@
6971
# endif
7072
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
7173

72-
#ifndef _LIBCPP_VISIBILITY_TAG
73-
#define _LIBCPP_VISIBILITY_TAG 1
74+
#if _WIN32
75+
76+
// only really useful for a DLL
77+
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
78+
# ifdef cxx_EXPORTS
79+
# define _LIBCPP_HIDDEN
80+
# define _LIBCPP_VISIBLE __declspec(dllexport)
81+
# else
82+
# define _LIBCPP_HIDDEN
83+
# define _LIBCPP_VISIBLE __declspec(dllimport)
84+
# endif
85+
#else
86+
# define _LIBCPP_HIDDEN
87+
# define _LIBCPP_VISIBLE
88+
#endif
89+
90+
#ifndef _LIBCPP_INLINE_VISIBILITY
91+
#define _LIBCPP_INLINE_VISIBILITY __forceinline
92+
#endif
93+
94+
#ifndef _LIBCPP_EXCEPTION_ABI
95+
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE
7496
#endif
7597

76-
#if _LIBCPP_VISIBILITY_TAG
98+
#ifndef _LIBCPP_ALWAYS_INLINE
99+
# if _MSC_VER
100+
# define _LIBCPP_ALWAYS_INLINE __forceinline
101+
# endif
102+
#endif
103+
104+
#endif // _WIN32
105+
106+
#ifndef _LIBCPP_HIDDEN
77107
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
108+
#endif
109+
110+
#ifndef _LIBCPP_VISIBLE
78111
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
79-
#else // _LIBCPP_VISIBILITY_TAG
80-
#define _LIBCPP_HIDDEN
81-
#define _LIBCPP_VISIBLE
82-
#endif // _LIBCPP_VISIBILITY_TAG
112+
#endif
83113

84114
#ifndef _LIBCPP_INLINE_VISIBILITY
85115
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
@@ -89,12 +119,22 @@
89119
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
90120
#endif
91121

122+
#ifndef _LIBCPP_CANTTHROW
92123
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
124+
#endif
93125

126+
#ifndef _LIBCPP_ALWAYS_INLINE
94127
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
128+
#endif
95129

96130
#if defined(__clang__)
97131

132+
#if __has_feature(cxx_alignas)
133+
# define _ALIGNAS(x) alignas(x)
134+
#else
135+
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
136+
#endif
137+
98138
#if !__has_feature(cxx_alias_templates)
99139
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
100140
#endif
@@ -181,16 +221,6 @@ typedef __char32_t char32_t;
181221
#define _LIBCPP_HAS_OBJC_ARC_WEAK
182222
#endif
183223

184-
// Inline namespaces are available in Clang regardless of C++ dialect.
185-
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
186-
#define _LIBCPP_END_NAMESPACE_STD } }
187-
#define _VSTD std::_LIBCPP_NAMESPACE
188-
189-
namespace std {
190-
inline namespace _LIBCPP_NAMESPACE {
191-
}
192-
}
193-
194224
#if !(__has_feature(cxx_constexpr))
195225
#define _LIBCPP_HAS_NO_CONSTEXPR
196226
#endif
@@ -207,10 +237,20 @@ namespace std {
207237
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
208238
#endif
209239

210-
// end defined(__clang__)
240+
// Inline namespaces are available in Clang regardless of C++ dialect.
241+
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
242+
#define _LIBCPP_END_NAMESPACE_STD } }
243+
#define _VSTD std::_LIBCPP_NAMESPACE
244+
245+
namespace std {
246+
inline namespace _LIBCPP_NAMESPACE {
247+
}
248+
}
211249

212250
#elif defined(__GNUC__)
213251

252+
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
253+
214254
#define _ATTRIBUTE(x) __attribute__((x))
215255

216256
#if !__EXCEPTIONS
@@ -275,7 +315,28 @@ namespace _LIBCPP_NAMESPACE {
275315
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
276316
}
277317

278-
#endif // defined(__GNUC__)
318+
#elif defined(_MSC_VER)
319+
320+
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
321+
#define _LIBCPP_HAS_NO_CONSTEXPR
322+
#define _LIBCPP_HAS_NO_UNICODE_CHARS
323+
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
324+
#define __alignof__ __alignof
325+
#define _ATTRIBUTE __declspec
326+
#define _ALIGNAS(x) __declspec(align(x))
327+
#define _LIBCPP_HAS_NO_VARIADICS
328+
329+
#define _NOEXCEPT throw()
330+
#define _NOEXCEPT_(x)
331+
332+
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
333+
#define _LIBCPP_END_NAMESPACE_STD }
334+
#define _VSTD std
335+
336+
namespace std {
337+
}
338+
339+
#endif // __clang__ || __GNUC___ || _MSC_VER
279340

280341
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
281342
typedef unsigned short char16_t;

libcxx/include/__functional_03

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
// manual variadic expansion for <functional>
1515

16+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1617
#pragma GCC system_header
18+
#endif
1719

1820
template <class _Tp>
1921
class __mem_fn

libcxx/include/__functional_base

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#include <typeinfo>
1717
#include <exception>
1818

19+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1920
#pragma GCC system_header
21+
#endif
2022

2123
_LIBCPP_BEGIN_NAMESPACE_STD
2224

libcxx/include/__hash_table

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#include <algorithm>
1919
#include <cmath>
2020

21+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2122
#pragma GCC system_header
23+
#endif
2224

2325
_LIBCPP_BEGIN_NAMESPACE_STD
2426

libcxx/include/__locale

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
# include <xlocale.h>
2626
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
2727

28+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2829
#pragma GCC system_header
30+
#endif
2931

3032
_LIBCPP_BEGIN_NAMESPACE_STD
3133

libcxx/include/__mutex_base

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#include <system_error>
1717
#include <pthread.h>
1818

19+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1920
#pragma GCC system_header
21+
#endif
2022

2123
#ifdef _LIBCPP_SHARED_LOCK
2224

libcxx/include/__split_buffer

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
#include <type_traits>
77
#include <algorithm>
88

9+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
910
#pragma GCC system_header
11+
#endif
1012

1113
_LIBCPP_BEGIN_NAMESPACE_STD
1214

libcxx/include/__sso_allocator

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
#include <type_traits>
1616
#include <new>
1717

18+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1819
#pragma GCC system_header
20+
#endif
1921

2022
_LIBCPP_BEGIN_NAMESPACE_STD
2123

libcxx/include/__std_stream

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#include <__locale>
1818
#include <cstdio>
1919

20+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2021
#pragma GCC system_header
22+
#endif
2123

2224
_LIBCPP_BEGIN_NAMESPACE_STD
2325

libcxx/include/__tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#include <stdexcept>
1818
#include <algorithm>
1919

20+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2021
#pragma GCC system_header
22+
#endif
2123

2224
_LIBCPP_BEGIN_NAMESPACE_STD
2325

libcxx/include/__tuple

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
#include <cstddef>
1616
#include <type_traits>
1717

18+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1819
#pragma GCC system_header
20+
#endif
1921

2022
#ifdef _LIBCPP_HAS_NO_VARIADICS
2123

libcxx/include/__tuple_03

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313

1414
#include <__config>
1515

16+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1617
#pragma GCC system_header
18+
#endif
1719

1820
_LIBCPP_BEGIN_NAMESPACE_STD
1921

libcxx/include/algorithm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,9 @@ template <class BidirectionalIterator, class Compare>
595595
#include <iterator>
596596
#include <cstdlib>
597597

598+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
598599
#pragma GCC system_header
600+
#endif
599601

600602
_LIBCPP_BEGIN_NAMESPACE_STD
601603

libcxx/include/array

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
111111
#include <cassert>
112112
#endif
113113

114+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
114115
#pragma GCC system_header
116+
#endif
115117

116118
_LIBCPP_BEGIN_NAMESPACE_STD
117119

libcxx/include/atomic

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,9 @@ void atomic_signal_fence(memory_order m);
526526
#include <cstdint>
527527
#include <type_traits>
528528

529+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
529530
#pragma GCC system_header
531+
#endif
530532

531533
_LIBCPP_BEGIN_NAMESPACE_STD
532534

libcxx/include/bitset

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ template <size_t N> struct hash<std::bitset<N>>;
113113
114114
*/
115115

116+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
116117
#pragma GCC system_header
118+
#endif
117119

118120
#include <__config>
119121
#include <__bit_reference>

libcxx/include/cassert

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ Macros:
2020
#include <__config>
2121
#include <assert.h>
2222

23+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2324
#pragma GCC system_header
25+
#endif

libcxx/include/ccomplex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
#include <complex>
2222

23+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2324
#pragma GCC system_header
25+
#endif
2426

2527
// hh 080623 Created
2628

libcxx/include/cctype

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ int toupper(int c);
3838
#include <__config>
3939
#include <ctype.h>
4040

41+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
4142
#pragma GCC system_header
43+
#endif
4244

4345
_LIBCPP_BEGIN_NAMESPACE_STD
4446

libcxx/include/cerrno

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ Macros:
2626
#include <__config>
2727
#include <errno.h>
2828

29+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2930
#pragma GCC system_header
31+
#endif
3032

3133
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
3234

libcxx/include/cfenv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp);
5656
#include <__config>
5757
#include <fenv.h>
5858

59+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
5960
#pragma GCC system_header
61+
#endif
6062

6163
_LIBCPP_BEGIN_NAMESPACE_STD
6264

libcxx/include/cfloat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Macros:
6363
#include <__config>
6464
#include <float.h>
6565

66+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
6667
#pragma GCC system_header
68+
#endif
6769

6870
#ifndef FLT_EVAL_METHOD
6971
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__

libcxx/include/chrono

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ typedef steady_clock high_resolution_clock;
255255
#include <ratio>
256256
#include <limits>
257257

258+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
258259
#pragma GCC system_header
260+
#endif
259261

260262
_LIBCPP_BEGIN_NAMESPACE_STD
261263

libcxx/include/cinttypes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
239239
#include <cstdint>
240240
#include <inttypes.h>
241241

242+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
242243
#pragma GCC system_header
244+
#endif
243245

244246
_LIBCPP_BEGIN_NAMESPACE_STD
245247

0 commit comments

Comments
 (0)