Skip to content

Commit

Permalink
Windows support by Ruben Van Boxem.
Browse files Browse the repository at this point in the history
llvm-svn: 142235
  • Loading branch information
Howard Hinnant committed Oct 17, 2011
1 parent aa563df commit 073458b
Show file tree
Hide file tree
Showing 93 changed files with 286 additions and 40 deletions.
2 changes: 2 additions & 0 deletions libcxx/include/__bit_reference
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#include <__config>
#include <algorithm>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
99 changes: 80 additions & 19 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG

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

#define _LIBCPP_VERSION 1001

Expand Down Expand Up @@ -69,17 +71,45 @@
# endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)

#ifndef _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_VISIBILITY_TAG 1
#if _WIN32

// only really useful for a DLL
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
# ifdef cxx_EXPORTS
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE __declspec(dllexport)
# else
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE __declspec(dllimport)
# endif
#else
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE
#endif

#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __forceinline
#endif

#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE
#endif

#if _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_ALWAYS_INLINE
# if _MSC_VER
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif

#endif // _WIN32

#ifndef _LIBCPP_HIDDEN
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#endif

#ifndef _LIBCPP_VISIBLE
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#else // _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN
#define _LIBCPP_VISIBLE
#endif // _LIBCPP_VISIBILITY_TAG
#endif

#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
Expand All @@ -89,12 +119,22 @@
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif

#ifndef _LIBCPP_CANTTHROW
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#endif

#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif

#if defined(__clang__)

#if __has_feature(cxx_alignas)
# define _ALIGNAS(x) alignas(x)
#else
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif

#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
Expand Down Expand Up @@ -181,16 +221,6 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_OBJC_ARC_WEAK
#endif

// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE

namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}

#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
Expand All @@ -207,10 +237,20 @@ namespace std {
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif

// end defined(__clang__)
// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE

namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}

#elif defined(__GNUC__)

#define _ALIGNAS(x) __attribute__((__aligned__(x)))

#define _ATTRIBUTE(x) __attribute__((x))

#if !__EXCEPTIONS
Expand Down Expand Up @@ -275,7 +315,28 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}

#endif // defined(__GNUC__)
#elif defined(_MSC_VER)

#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define __alignof__ __alignof
#define _ATTRIBUTE __declspec
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS

#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)

#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _VSTD std

namespace std {
}

#endif // __clang__ || __GNUC___ || _MSC_VER

#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__functional_03
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

// manual variadic expansion for <functional>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

template <class _Tp>
class __mem_fn
Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__functional_base
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#include <typeinfo>
#include <exception>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__hash_table
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
#include <algorithm>
#include <cmath>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__locale
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__mutex_base
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
#include <system_error>
#include <pthread.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

#ifdef _LIBCPP_SHARED_LOCK

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__split_buffer
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#include <type_traits>
#include <algorithm>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__sso_allocator
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include <type_traits>
#include <new>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__std_stream
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include <__locale>
#include <cstdio>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__tree
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include <stdexcept>
#include <algorithm>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__tuple
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include <cstddef>
#include <type_traits>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

#ifdef _LIBCPP_HAS_NO_VARIADICS

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__tuple_03
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

#include <__config>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/algorithm
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,9 @@ template <class BidirectionalIterator, class Compare>
#include <iterator>
#include <cstdlib>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/array
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
#include <cassert>
#endif

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ void atomic_signal_fence(memory_order m);
#include <cstdint>
#include <type_traits>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/bitset
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ template <size_t N> struct hash<std::bitset<N>>;
*/

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

#include <__config>
#include <__bit_reference>
Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/cassert
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ Macros:
#include <__config>
#include <assert.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
2 changes: 2 additions & 0 deletions libcxx/include/ccomplex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

#include <complex>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

// hh 080623 Created

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/cctype
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ int toupper(int c);
#include <__config>
#include <ctype.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/cerrno
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ Macros:
#include <__config>
#include <errno.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

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

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/cfenv
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp);
#include <__config>
#include <fenv.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/cfloat
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ Macros:
#include <__config>
#include <float.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/chrono
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ typedef steady_clock high_resolution_clock;
#include <ratio>
#include <limits>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/cinttypes
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
#include <cstdint>
#include <inttypes.h>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

Expand Down
Loading

0 comments on commit 073458b

Please sign in to comment.