Fix various GCC mis-configurations for newer versions.
This patch goes through and enables C++11 and C++14 features for newer GCC's. The main changes are: 1. Turn on variable templates. (Uses __cpp_variable_templates) 2. Assert atomic<Tp> is trivially copyable (Uses _GNUC_VER >= 501). 3. Turn on trailing return support for GCC. (Uses _GNUC_VER >= 404) 4. XFAIL void_t test for GCC 5.1 and 5.2. Fixed in GCC 6. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@255585 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8459d20624
commit
e39f4b996e
@ -472,7 +472,9 @@ namespace std {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// GCC 5 will support variable templates
|
// GCC 5 will support variable templates
|
||||||
|
#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
|
||||||
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _NOEXCEPT throw()
|
#define _NOEXCEPT throw()
|
||||||
#define _NOEXCEPT_(x)
|
#define _NOEXCEPT_(x)
|
||||||
@ -494,7 +496,6 @@ namespace std {
|
|||||||
|
|
||||||
#else // __GXX_EXPERIMENTAL_CXX0X__
|
#else // __GXX_EXPERIMENTAL_CXX0X__
|
||||||
|
|
||||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
|
||||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||||
|
|
||||||
#if _GNUC_VER < 403
|
#if _GNUC_VER < 403
|
||||||
@ -508,6 +509,7 @@ namespace std {
|
|||||||
#if _GNUC_VER < 404
|
#if _GNUC_VER < 404
|
||||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
|
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||||
#define _LIBCPP_HAS_NO_VARIADICS
|
#define _LIBCPP_HAS_NO_VARIADICS
|
||||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||||
|
@ -552,6 +552,12 @@ typedef enum memory_order
|
|||||||
namespace __gcc_atomic {
|
namespace __gcc_atomic {
|
||||||
template <typename _Tp>
|
template <typename _Tp>
|
||||||
struct __gcc_atomic_t {
|
struct __gcc_atomic_t {
|
||||||
|
|
||||||
|
#if _GNUC_VER >= 501
|
||||||
|
static_assert(is_trivially_copyable<_Tp>::value,
|
||||||
|
"std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
|
||||||
|
#endif
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
__gcc_atomic_t() _NOEXCEPT = default;
|
__gcc_atomic_t() _NOEXCEPT = default;
|
||||||
|
@ -59,7 +59,7 @@ struct NotTriviallyCopyable {
|
|||||||
int i_;
|
int i_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T, class >
|
||||||
void test ( T t ) {
|
void test ( T t ) {
|
||||||
std::atomic<T> t0(t);
|
std::atomic<T> t0(t);
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,11 @@
|
|||||||
|
|
||||||
// void_t
|
// void_t
|
||||||
|
|
||||||
#include <type_traits>
|
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
||||||
|
|
||||||
#if _LIBCPP_STD_VER <= 14
|
// XFAIL: gcc-5.1 gcc-5.2
|
||||||
int main () {}
|
|
||||||
#else
|
#include <type_traits>
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void test1()
|
void test1()
|
||||||
@ -66,4 +66,3 @@ int main()
|
|||||||
|
|
||||||
static_assert( std::is_same<void, std::void_t<int, double const &, Class, volatile int[], void>>::value, "");
|
static_assert( std::is_same<void, std::void_t<int, double const &, Class, volatile int[], void>>::value, "");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user